From a0951e48c1dea789bcb1ee293677461d54f4a8f8 Mon Sep 17 00:00:00 2001 From: dtucker Date: Thu, 6 Jan 2022 21:46:56 +0000 Subject: [PATCH] Add test for hostbased auth. It requires some external setup (see comments at the top) and thus is disabled unless TEST_SSH_HOSTBASED_AUTH and SUDO are set. --- regress/usr.bin/ssh/Makefile | 5 +-- regress/usr.bin/ssh/hostbased.sh | 62 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 regress/usr.bin/ssh/hostbased.sh diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile index 4bb2ae91447..fe9438d9043 100644 --- a/regress/usr.bin/ssh/Makefile +++ b/regress/usr.bin/ssh/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.119 2021/12/19 22:20:12 djm Exp $ +# $OpenBSD: Makefile,v 1.120 2022/01/06 21:46:56 dtucker Exp $ OPENSSL?= yes @@ -98,7 +98,8 @@ LTESTS= connect \ sshsig \ knownhosts \ knownhosts-command \ - agent-restrict + agent-restrict \ + hostbased INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers #INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp diff --git a/regress/usr.bin/ssh/hostbased.sh b/regress/usr.bin/ssh/hostbased.sh new file mode 100644 index 00000000000..f62d6f5f1b9 --- /dev/null +++ b/regress/usr.bin/ssh/hostbased.sh @@ -0,0 +1,62 @@ +# $OpenBSD: hostbased.sh,v 1.1 2022/01/06 21:46:56 dtucker Exp $ +# Placed in the Public Domain. + +# This test requires external setup and thus is skipped unless +# TEST_SSH_HOSTBASED_AUTH and SUDO are set to "yes". +# Since ssh-keysign has key paths hard coded, unlike the other tests it +# needs to use the real host keys. It requires: +# - ssh-keysign must be installed and setuid. +# - "EnableSSHKeysign yes" must be in the system ssh_config. +# - the system's own real FQDN the system-wide shosts.equiv. +# - the system's real public key fingerprints must me in global ssh_known_hosts. +# +tid="hostbased" + +if [ -z "${TEST_SSH_HOSTBASED_AUTH}" ]; then + skip "TEST_SSH_HOSTBASED_AUTH not set." +elif [ -z "${SUDO}" ]; then + skip "SUDO not set" +fi + +cat >>$OBJ/sshd_proxy <>$OBJ/ssh_proxy <