upstream: regression test for UpdateHostkeys with multiple keys backed

by ssh-agent. Patch from Maxime Rey.

OpenBSD-Regress-ID: 1777ab6e639e57c0e20cbcb6df60455b49fd8bb3
This commit is contained in:
djm@openbsd.org 2024-11-26 22:02:28 +00:00 committed by Damien Miller
parent 84023656d9
commit 0ad34a6193
No known key found for this signature in database

View File

@ -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