freebsd-src/crypto/openssh/regress/cfginclude.sh
Ed Maste 19261079b7 openssh: update to OpenSSH v8.7p1
Some notable changes, from upstream's release notes:

- sshd(8): Remove support for obsolete "host/port" syntax.
- ssh(1): When prompting whether to record a new host key, accept the key
  fingerprint as a synonym for "yes".
- ssh-keygen(1): when acting as a CA and signing certificates with an RSA
  key, default to using the rsa-sha2-512 signature algorithm.
- ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa"
  (RSA/SHA1) algorithm from those accepted for certificate signatures.
- ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F
  support to provide address-space isolation for token middleware
  libraries (including the internal one).
- ssh(1): this release enables UpdateHostkeys by default subject to some
  conservative preconditions.
- scp(1): this release changes the behaviour of remote to remote copies
  (e.g. "scp host-a:/path host-b:") to transfer through the local host
  by default.
- scp(1): experimental support for transfers using the SFTP protocol as
  a replacement for the venerable SCP/RCP protocol that it has
  traditionally used.

Additional integration work is needed to support FIDO/U2F in the base
system.

Deprecation Notice
------------------

OpenSSH will disable the ssh-rsa signature scheme by default in the
next release.

Reviewed by:	imp
MFC after:	1 month
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29985
2021-09-07 21:05:51 -04:00

294 lines
4.5 KiB
Bash

# $OpenBSD: cfginclude.sh,v 1.3 2021/06/08 06:52:43 djm Exp $
# Placed in the Public Domain.
tid="config include"
# to appease StrictModes
umask 022
cat > $OBJ/ssh_config.i << _EOF
Match host a
Hostname aa
Match host b # comment
Hostname bb
Include $OBJ/ssh_config.i.*
Match host c
Include $OBJ/ssh_config.i.*
Hostname cc
Match host m
Include $OBJ/ssh_config.i.* # comment
Host d
Hostname dd # comment
Host e
Hostname ee
Include $OBJ/ssh_config.i.*
Host f
Include $OBJ/ssh_config.i.*
Hostname ff
Host n
Include $OBJ/ssh_config.i.*
_EOF
cat > $OBJ/ssh_config.i.0 << _EOF
Match host xxxxxx
_EOF
cat > $OBJ/ssh_config.i.1 << _EOF
Match host a
Hostname aaa
Match host b
Hostname bbb
Match host c # comment
Hostname ccc
Host d # comment
Hostname ddd
Host e
Hostname eee
Host f
Hostname fff # comment
_EOF
cat > $OBJ/ssh_config.i.2 << _EOF
Match host a
Hostname aaaa
Match host b
Hostname bbbb
Match host c
Hostname cccc
Host d
Hostname dddd
Host e
Hostname eeee
Host f
Hostname ffff
Match all
Hostname xxxx
_EOF
trial() {
_host="$1"
_exp="$2"
${REAL_SSH} -F $OBJ/ssh_config.i -G "$_host" > $OBJ/ssh_config.out ||
fatal "ssh config parse failed"
_got=`grep -i '^hostname ' $OBJ/ssh_config.out | awk '{print $2}'`
if test "x$_exp" != "x$_got" ; then
fail "host $_host include fail: expected $_exp got $_got"
fi
}
trial a aa
trial b bb
trial c ccc
trial d dd
trial e ee
trial f fff
trial m xxxx
trial n xxxx
trial x x
# Prepare an included config with an error.
cat > $OBJ/ssh_config.i.3 << _EOF
Hostname xxxx
Junk
_EOF
${REAL_SSH} -F $OBJ/ssh_config.i -G a 2>/dev/null && \
fail "ssh include allowed invalid config"
${REAL_SSH} -F $OBJ/ssh_config.i -G x 2>/dev/null && \
fail "ssh include allowed invalid config"
rm -f $OBJ/ssh_config.i.*
# Ensure that a missing include is not fatal.
cat > $OBJ/ssh_config.i << _EOF
Include $OBJ/ssh_config.i.*
Hostname aa
_EOF
trial a aa
# Ensure that Match/Host in an included config does not affect parent.
cat > $OBJ/ssh_config.i.x << _EOF
Match host x
_EOF
trial a aa
cat > $OBJ/ssh_config.i.x << _EOF
Host x
_EOF
trial a aa
# cleanup
rm -f $OBJ/ssh_config.i $OBJ/ssh_config.i.* $OBJ/ssh_config.out
# $OpenBSD: cfginclude.sh,v 1.3 2021/06/08 06:52:43 djm Exp $
# Placed in the Public Domain.
tid="config include"
cat > $OBJ/ssh_config.i << _EOF
Match host a
Hostname aa
Match host b
Hostname bb
Include $OBJ/ssh_config.i.*
Match host c
Include $OBJ/ssh_config.i.*
Hostname cc
Match host m
Include $OBJ/ssh_config.i.*
Host d
Hostname dd
Host e
Hostname ee
Include $OBJ/ssh_config.i.*
Host f
Include $OBJ/ssh_config.i.*
Hostname ff
Host n
Include $OBJ/ssh_config.i.*
_EOF
cat > $OBJ/ssh_config.i.0 << _EOF
Match host xxxxxx
_EOF
cat > $OBJ/ssh_config.i.1 << _EOF
Match host a
Hostname aaa
Match host b # comment
Hostname bbb
Match host c
Hostname ccc # comment
Host d
Hostname ddd
Host e
Hostname eee
Host f
Hostname fff
_EOF
cat > $OBJ/ssh_config.i.2 << _EOF
Match host a
Hostname aaaa
Match host b
Hostname bbbb
Match host c
Hostname cccc
Host d
Hostname dddd
Host e
Hostname eeee
Host f
Hostname ffff
Match all # comment
Hostname xxxx # comment
_EOF
trial() {
_host="$1"
_exp="$2"
${REAL_SSH} -F $OBJ/ssh_config.i -G "$_host" > $OBJ/ssh_config.out ||
fatal "ssh config parse failed"
_got=`grep -i '^hostname ' $OBJ/ssh_config.out | awk '{print $2}'`
if test "x$_exp" != "x$_got" ; then
fail "host $_host include fail: expected $_exp got $_got"
fi
}
trial a aa
trial b bb
trial c ccc
trial d dd
trial e ee
trial f fff
trial m xxxx
trial n xxxx
trial x x
# Prepare an included config with an error.
cat > $OBJ/ssh_config.i.3 << _EOF
Hostname xxxx
Junk
_EOF
${REAL_SSH} -F $OBJ/ssh_config.i -G a 2>/dev/null && \
fail "ssh include allowed invalid config"
${REAL_SSH} -F $OBJ/ssh_config.i -G x 2>/dev/null && \
fail "ssh include allowed invalid config"
rm -f $OBJ/ssh_config.i.*
# Ensure that a missing include is not fatal.
cat > $OBJ/ssh_config.i << _EOF
Include $OBJ/ssh_config.i.*
Hostname aa
_EOF
trial a aa
# Ensure that Match/Host in an included config does not affect parent.
cat > $OBJ/ssh_config.i.x << _EOF
Match host x
_EOF
trial a aa
cat > $OBJ/ssh_config.i.x << _EOF
Host x
_EOF
trial a aa
# Ensure that recursive includes are bounded.
cat > $OBJ/ssh_config.i << _EOF
Include $OBJ/ssh_config.i
_EOF
${REAL_SSH} -F $OBJ/ssh_config.i -G a 2>/dev/null && \
fail "ssh include allowed infinite recursion?" # or hang...
# cleanup
rm -f $OBJ/ssh_config.i $OBJ/ssh_config.i.* $OBJ/ssh_config.out