diff options
author | djm@openbsd.org <djm@openbsd.org> | 2015-01-19 06:01:32 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-01-20 00:26:13 +1100 |
commit | d85e06245907d49a2cd0cfa0abf59150ad616f42 (patch) | |
tree | 0d59921c7b193e52786741cdb8215a0f645cd81b /regress/hostkey-agent.sh | |
parent | 7947810eab5fe0ad311f32a48f4d4eb1f71be6cf (diff) | |
download | openssh-git-d85e06245907d49a2cd0cfa0abf59150ad616f42.tar.gz |
upstream commit
be a bit more careful in these tests to ensure that
known_hosts is clean
Diffstat (limited to 'regress/hostkey-agent.sh')
-rw-r--r-- | regress/hostkey-agent.sh | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/regress/hostkey-agent.sh b/regress/hostkey-agent.sh index 4562f42a..84fb2c2d 100644 --- a/regress/hostkey-agent.sh +++ b/regress/hostkey-agent.sh @@ -1,12 +1,9 @@ -# $OpenBSD: hostkey-agent.sh,v 1.1 2015/01/17 18:54:30 djm Exp $ +# $OpenBSD: hostkey-agent.sh,v 1.2 2015/01/19 06:01:32 djm Exp $ # Placed in the Public Domain. tid="hostkey agent" -# Need full names here since they are used in HostKeyAlgorithms -HOSTKEY_TYPES="ecdsa-sha2-nistp256 ssh-ed25519 ssh-rsa ssh-dss" - -rm -f $OBJ/agent.* $OBJ/ssh_proxy.orig +rm -f $OBJ/agent.* $OBJ/ssh_proxy.orig $OBJ/known_hosts.orig trace "start agent" eval `${SSHAGENT} -s` > /dev/null @@ -15,31 +12,31 @@ r=$? grep -vi 'hostkey' $OBJ/sshd_proxy > $OBJ/sshd_proxy.orig echo "HostKeyAgent $SSH_AUTH_SOCK" >> $OBJ/sshd_proxy.orig -echo "LogLevel debug3" >> $OBJ/sshd_proxy.orig -rm $OBJ/known_hosts trace "load hostkeys" -for k in $HOSTKEY_TYPES ; do +for k in `${SSH} -Q key-plain` ; do ${SSHKEYGEN} -qt $k -f $OBJ/agent.$k -N '' || fatal "ssh-keygen $k" ( echo -n 'localhost-with-alias,127.0.0.1,::1 ' cat $OBJ/agent.$k.pub - ) >> $OBJ/known_hosts + ) >> $OBJ/known_hosts.orig ${SSHADD} $OBJ/agent.$k >/dev/null 2>&1 || \ fatal "couldn't load key $OBJ/agent.$k" echo "Hostkey $OBJ/agent.${k}" >> sshd_proxy.orig # Remove private key so the server can't use it. rm $OBJ/agent.$k || fatal "couldn't rm $OBJ/agent.$k" done +cp $OBJ/known_hosts.orig $OBJ/known_hosts unset SSH_AUTH_SOCK for ps in no yes; do cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy - for k in $HOSTKEY_TYPES ; do + for k in `${SSH} -Q key-plain` ; do verbose "key type $k privsep=$ps" opts="-oHostKeyAlgorithms=$k -F $OBJ/ssh_proxy" + cp $OBJ/known_hosts.orig $OBJ/known_hosts SSH_CONNECTION=`${SSH} $opts host 'echo $SSH_CONNECTION'` if [ $? -ne 0 ]; then fail "protocol $p privsep=$ps failed" |