diff options
Diffstat (limited to 'regress')
| -rw-r--r-- | regress/Makefile | 3 | ||||
| -rw-r--r-- | regress/agent-getpeereid.sh | 12 | ||||
| -rw-r--r-- | regress/exit-status-signal.sh | 24 | ||||
| -rw-r--r-- | regress/hostkey-rotate.sh | 19 | ||||
| -rw-r--r-- | regress/keys-command.sh | 4 | ||||
| -rw-r--r-- | regress/knownhosts-command.sh | 6 | ||||
| -rw-r--r-- | regress/putty-ciphers.sh | 12 | ||||
| -rw-r--r-- | regress/putty-kex.sh | 12 | ||||
| -rw-r--r-- | regress/putty-transfer.sh | 12 | ||||
| -rw-r--r-- | regress/sftp-chroot.sh | 9 | ||||
| -rw-r--r-- | regress/sshfp-connect.sh | 14 | ||||
| -rw-r--r-- | regress/test-exec.sh | 10 |
12 files changed, 101 insertions, 36 deletions
diff --git a/regress/Makefile b/regress/Makefile index 810d74ce599d..0b5ad45d753a 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.116 2021/08/04 21:28:00 djm Exp $ +# $OpenBSD: Makefile,v 1.117 2021/09/03 04:11:13 dtucker Exp $ tests: prep file-tests t-exec unit @@ -27,6 +27,7 @@ LTESTS= connect \ proto-version \ proto-mismatch \ exit-status \ + exit-status-signal \ envpass \ transfer \ banner \ diff --git a/regress/agent-getpeereid.sh b/regress/agent-getpeereid.sh index ddeef01f1b73..2874100fa0f1 100644 --- a/regress/agent-getpeereid.sh +++ b/regress/agent-getpeereid.sh @@ -1,4 +1,4 @@ -# $OpenBSD: agent-getpeereid.sh,v 1.11 2019/11/26 23:43:10 djm Exp $ +# $OpenBSD: agent-getpeereid.sh,v 1.13 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="disallow agent attach from other uid" @@ -10,19 +10,15 @@ SSH_AUTH_SOCK=/nonexistent if config_defined HAVE_GETPEEREID HAVE_GETPEERUCRED HAVE_SO_PEERCRED ; then : else - echo "skipped (not supported on this platform)" - exit 0 + skip "skipped (not supported on this platform)" fi case "x$SUDO" in xsudo) sudo=1;; xdoas|xdoas\ *) ;; x) - echo "need SUDO to switch to uid $UNPRIV" - echo SKIPPED - exit 0 ;; + skip "need SUDO to switch to uid $UNPRIV" ;; *) - echo "unsupported $SUDO - "doas" and "sudo" are allowed" - exit 0 ;; + skip "unsupported $SUDO - "doas" and "sudo" are allowed" ;; esac trace "start agent" diff --git a/regress/exit-status-signal.sh b/regress/exit-status-signal.sh new file mode 100644 index 000000000000..1b3af0d84ddd --- /dev/null +++ b/regress/exit-status-signal.sh @@ -0,0 +1,24 @@ +# This test performs validation that ssh client is not successive on being terminated + +tid="exit status on signal" + +# spawn client in background +rm -f $OBJ/remote_pid +${SSH} -F $OBJ/ssh_proxy somehost 'echo $$ >'$OBJ'/remote_pid; sleep 444' & +ssh_pid=$! + +# wait for it to start +n=20 +while [ ! -f $OBJ/remote_pid ] && [ $n -gt 0 ]; do + n=$(($n - 1)) + sleep 1 +done + +kill $ssh_pid +wait $ssh_pid +exit_code=$? + +if [ $exit_code -eq 0 ]; then + fail "ssh client should fail on signal" +fi + diff --git a/regress/hostkey-rotate.sh b/regress/hostkey-rotate.sh index 2852c457c259..0ae0c3dfcb44 100644 --- a/regress/hostkey-rotate.sh +++ b/regress/hostkey-rotate.sh @@ -3,6 +3,25 @@ tid="hostkey rotate" +# +# GNU (f)grep <=2.18, as shipped by FreeBSD<=12 and NetBSD<=9 will occasionally +# fail to find ssh host keys in the hostkey-rotate test. If we have those +# versions, use awk instead. +# See # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258616 +# +case `grep --version 2>&1 | awk '/GNU grep/{print $4}'` in +2.19) fgrep=good ;; +1.*|2.?|2.?.?|2.1?) fgrep=bad ;; # stock GNU grep +2.5.1*) fgrep=bad ;; # FreeBSD and NetBSD +*) fgrep=good ;; +esac +if test "x$fgrep" = "xbad"; then + fgrep() +{ + awk 'BEGIN{e=1} {if (index($0,"'$1'")>0){e=0;print}} END{exit e}' $2 +} +fi + rm -f $OBJ/hkr.* $OBJ/ssh_proxy.orig $OBJ/ssh_proxy.orig grep -vi 'hostkey' $OBJ/sshd_proxy > $OBJ/sshd_proxy.orig diff --git a/regress/keys-command.sh b/regress/keys-command.sh index 33b6e7b423df..a3acf5e4d905 100644 --- a/regress/keys-command.sh +++ b/regress/keys-command.sh @@ -1,4 +1,4 @@ -# $OpenBSD: keys-command.sh,v 1.6 2019/07/25 08:48:11 dtucker Exp $ +# $OpenBSD: keys-command.sh,v 1.7 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="authorized keys from command" @@ -77,5 +77,5 @@ if [ -x $KEY_COMMAND ]; then fail "connect failed" fi else - echo "SKIPPED: $KEY_COMMAND not executable (/var/run mounted noexec?)" + skip "$KEY_COMMAND not executable (/var/run mounted noexec?)" fi diff --git a/regress/knownhosts-command.sh b/regress/knownhosts-command.sh index f15df670b0c8..8472ec8121c5 100644 --- a/regress/knownhosts-command.sh +++ b/regress/knownhosts-command.sh @@ -1,4 +1,4 @@ -# $OpenBSD: knownhosts-command.sh,v 1.2 2020/12/22 06:47:24 djm Exp $ +# $OpenBSD: knownhosts-command.sh,v 1.3 2021/08/30 01:15:45 djm Exp $ # Placed in the Public Domain. tid="known hosts command " @@ -39,7 +39,9 @@ chmod a+x $OBJ/knownhosts_command ${SSH} -F $OBJ/ssh_proxy x true && fail "ssh connect succeeded with bad exit" for keytype in ${SSH_HOSTKEY_TYPES} ; do + algs=$keytype test "x$keytype" = "xssh-dss" && continue + test "x$keytype" = "xssh-rsa" && algs=ssh-rsa,rsa-sha2-256,rsa-sha2-512 verbose "keytype $keytype" cat > $OBJ/knownhosts_command << _EOF #!/bin/sh @@ -48,6 +50,6 @@ test "x\$1" = "x$keytype" || die "wrong keytype \$1 (expected $keytype)" test "x\$3" = "x$LOGNAME" || die "wrong username \$3 (expected $LOGNAME)" grep -- "\$1.*\$2" $OBJ/known_hosts _EOF - ${SSH} -F $OBJ/ssh_proxy -oHostKeyAlgorithms=$keytype x true || + ${SSH} -F $OBJ/ssh_proxy -oHostKeyAlgorithms=$algs x true || fail "ssh connect failed for keytype $x" done diff --git a/regress/putty-ciphers.sh b/regress/putty-ciphers.sh index 708c288d73ae..5b8e25a27199 100644 --- a/regress/putty-ciphers.sh +++ b/regress/putty-ciphers.sh @@ -1,11 +1,17 @@ -# $OpenBSD: putty-ciphers.sh,v 1.7 2020/01/23 03:35:07 dtucker Exp $ +# $OpenBSD: putty-ciphers.sh,v 1.11 2021/09/01 03:16:06 dtucker Exp $ # Placed in the Public Domain. tid="putty ciphers" if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then - echo "putty interop tests not enabled" - exit 0 + skip "putty interop tests not enabled" +fi + +# Re-enable ssh-rsa on older PuTTY versions. +oldver="`${PLINK} --version | awk '/plink: Release/{if ($3<0.76)print "yes"}'`" +if [ "x$oldver" = "xyes" ]; then + echo "HostKeyAlgorithms +ssh-rsa" >> ${OBJ}/sshd_proxy + echo "PubkeyAcceptedKeyTypes +ssh-rsa" >> ${OBJ}/sshd_proxy fi for c in aes 3des aes128-ctr aes192-ctr aes256-ctr chacha20 ; do diff --git a/regress/putty-kex.sh b/regress/putty-kex.sh index 686d0e1af2e5..c75802a06103 100644 --- a/regress/putty-kex.sh +++ b/regress/putty-kex.sh @@ -1,11 +1,17 @@ -# $OpenBSD: putty-kex.sh,v 1.5 2020/01/23 03:24:38 dtucker Exp $ +# $OpenBSD: putty-kex.sh,v 1.9 2021/09/01 03:16:06 dtucker Exp $ # Placed in the Public Domain. tid="putty KEX" if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then - echo "putty interop tests not enabled" - exit 0 + skip "putty interop tests not enabled" +fi + +# Re-enable ssh-rsa on older PuTTY versions. +oldver="`${PLINK} --version | awk '/plink: Release/{if ($3<0.76)print "yes"}'`" +if [ "x$oldver" = "xyes" ]; then + echo "HostKeyAlgorithms +ssh-rsa" >> ${OBJ}/sshd_proxy + echo "PubkeyAcceptedKeyTypes +ssh-rsa" >> ${OBJ}/sshd_proxy fi for k in dh-gex-sha1 dh-group1-sha1 dh-group14-sha1 ecdh ; do diff --git a/regress/putty-transfer.sh b/regress/putty-transfer.sh index 14b41022f8a6..a6864f9515a7 100644 --- a/regress/putty-transfer.sh +++ b/regress/putty-transfer.sh @@ -1,11 +1,17 @@ -# $OpenBSD: putty-transfer.sh,v 1.7 2020/01/23 11:19:12 dtucker Exp $ +# $OpenBSD: putty-transfer.sh,v 1.11 2021/09/01 03:16:06 dtucker Exp $ # Placed in the Public Domain. tid="putty transfer data" if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then - echo "putty interop tests not enabled" - exit 0 + skip "putty interop tests not enabled" +fi + +# Re-enable ssh-rsa on older PuTTY versions. +oldver="`${PLINK} --version | awk '/plink: Release/{if ($3<0.76)print "yes"}'`" +if [ "x$oldver" = "xyes" ]; then + echo "HostKeyAlgorithms +ssh-rsa" >> ${OBJ}/sshd_proxy + echo "PubkeyAcceptedKeyTypes +ssh-rsa" >> ${OBJ}/sshd_proxy fi if [ "`${SSH} -Q compression`" = "none" ]; then diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh index 5acc4d2de4a6..a7766fe63a2e 100644 --- a/regress/sftp-chroot.sh +++ b/regress/sftp-chroot.sh @@ -1,4 +1,4 @@ -# $OpenBSD: sftp-chroot.sh,v 1.7 2018/11/22 08:48:32 dtucker Exp $ +# $OpenBSD: sftp-chroot.sh,v 1.8 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. tid="sftp in chroot" @@ -9,14 +9,11 @@ PRIVDATA=${CHROOT}/${FILENAME} trap "${SUDO} rm -f ${PRIVDATA}" 0 if [ -z "$SUDO" -a ! -w /var/run ]; then - echo "need SUDO to create file in /var/run, test won't work without" - echo SKIPPED - exit 0 + skip "need SUDO to create file in /var/run, test won't work without" fi if ! $OBJ/check-perm -m chroot "$CHROOT" ; then - echo "skipped: $CHROOT is unsuitable as ChrootDirectory" - exit 0 + skip "$CHROOT is unsuitable as ChrootDirectory" fi $SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \ diff --git a/regress/sshfp-connect.sh b/regress/sshfp-connect.sh index 06e91cdbb851..f78646922efe 100644 --- a/regress/sshfp-connect.sh +++ b/regress/sshfp-connect.sh @@ -1,4 +1,4 @@ -# $OpenBSD: sshfp-connect.sh,v 1.2 2021/07/19 08:48:33 dtucker Exp $ +# $OpenBSD: sshfp-connect.sh,v 1.4 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. # This test requires external setup and thus is skipped unless @@ -24,9 +24,11 @@ tid="sshfp connect" -if [ ! -z "${TEST_SSH_SSHFP_DOMAIN}" ] && \ - $SSH -Q key-plain | grep ssh-rsa >/dev/null; then - +if ! $SSH -Q key-plain | grep ssh-rsa >/dev/null; then + skip "RSA keys not supported." +elif [ -z "${TEST_SSH_SSHFP_DOMAIN}" ]; then + skip "TEST_SSH_SSHFP_DOMAIN not set." +else # Set RSA host key to match fingerprints above. mv $OBJ/sshd_proxy $OBJ/sshd_proxy.orig $SUDO cp $SRC/rsa_openssh.prv $OBJ/host.ssh-rsa @@ -45,7 +47,7 @@ if [ ! -z "${TEST_SSH_SSHFP_DOMAIN}" ] && \ trace "sshfp connect $n good fingerprint" host="${n}.dtucker.net" opts="-F $OBJ/ssh_proxy -o VerifyHostKeyDNS=yes " - opts="$opts -o HostKeyAlgorithms=ssh-rsa" + opts="$opts -o HostKeyAlgorithms=rsa-sha2-512,rsa-sha2-256" host="${n}.${TEST_SSH_SSHFP_DOMAIN}" SSH_CONNECTION=`${SSH} $opts $host 'echo $SSH_CONNECTION'` if [ $? -ne 0 ]; then @@ -61,6 +63,4 @@ if [ ! -z "${TEST_SSH_SSHFP_DOMAIN}" ] && \ fail "sshfp-connect succeeded with bad SSHFP record" fi done -else - echo SKIPPED: TEST_SSH_SSHFP_DOMAIN not set. fi diff --git a/regress/test-exec.sh b/regress/test-exec.sh index db6d6161aa2b..415422ef5573 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.86 2021/08/08 08:27:28 dtucker Exp $ +# $OpenBSD: test-exec.sh,v 1.87 2021/09/01 00:50:27 dtucker Exp $ # Placed in the Public Domain. #SUDO=sudo @@ -462,6 +462,14 @@ fatal () exit $RESULT } +# Skip remaining tests in script. +skip () +{ + echo "SKIPPED: $@" + cleanup + exit $RESULT +} + RESULT=0 PIDFILE=$OBJ/pidfile |
