summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2024-11-26 23:02:28 +0100
committerDamien Miller <djm@mindrot.org>2024-11-26 23:03:33 +0100
commit0ad34a6193357d286042322ea7347262a6fb0778 (patch)
tree62989d598e181146a13416e653ad7b46df179c66
parentupstream: Explicitly specify the signature algorithm when signing (diff)
downloadopenssh-0ad34a6193357d286042322ea7347262a6fb0778.tar.xz
openssh-0ad34a6193357d286042322ea7347262a6fb0778.zip
upstream: regression test for UpdateHostkeys with multiple keys backed
by ssh-agent. Patch from Maxime Rey. OpenBSD-Regress-ID: 1777ab6e639e57c0e20cbcb6df60455b49fd8bb3
-rw-r--r--regress/hostkey-agent.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/regress/hostkey-agent.sh b/regress/hostkey-agent.sh
index 222d424bd..384865857 100644
--- a/regress/hostkey-agent.sh
+++ b/regress/hostkey-agent.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: hostkey-agent.sh,v 1.13 2021/09/30 05:20:08 dtucker Exp $
+# $OpenBSD: hostkey-agent.sh,v 1.14 2024/11/26 22:02:28 djm Exp $
# Placed in the Public Domain.
tid="hostkey agent"
@@ -82,6 +82,30 @@ for k in $SSH_CERTTYPES ; do
fi
done
+verbose "multiple hostkeys"
+cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
+cp $OBJ/ssh_proxy $OBJ/ssh_proxy.orig
+grep -vi 'globalknownhostsfile' $OBJ/ssh_proxy.orig > $OBJ/ssh_proxy
+echo "UpdateHostkeys=yes" >> $OBJ/ssh_proxy
+echo "GlobalKnownHostsFile=none" >> $OBJ/ssh_proxy
+
+for k in $SSH_KEYTYPES ; do
+ verbose "Addkey type $k"
+ echo "Hostkey $OBJ/agent-key.${k}" >> $OBJ/sshd_proxy
+
+ ( printf 'localhost-with-alias ' ;
+ cat $OBJ/agent-key.$k.pub) > $OBJ/known_hosts
+done
+
+opts="-oStrictHostKeyChecking=yes -F $OBJ/ssh_proxy"
+SSH_CONNECTION=`${SSH} $opts host 'echo $SSH_CONNECTION'`
+if [ $? -ne 0 ]; then
+ fail "connection to server with multiple hostkeys failed"
+fi
+if [ "$SSH_CONNECTION" != "UNKNOWN 65535 UNKNOWN 65535" ]; then
+ fail "bad SSH_CONNECTION key while using multiple hostkeys"
+fi
+
trace "kill agent"
${SSHAGENT} -k > /dev/null