summaryrefslogtreecommitdiff
path: root/regress/hostkey-agent.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/hostkey-agent.sh')
-rw-r--r--regress/hostkey-agent.sh17
1 files changed, 7 insertions, 10 deletions
diff --git a/regress/hostkey-agent.sh b/regress/hostkey-agent.sh
index 4562f42af..84fb2c2d2 100644
--- a/regress/hostkey-agent.sh
+++ b/regress/hostkey-agent.sh
@@ -1,12 +1,9 @@
1# $OpenBSD: hostkey-agent.sh,v 1.1 2015/01/17 18:54:30 djm Exp $ 1# $OpenBSD: hostkey-agent.sh,v 1.2 2015/01/19 06:01:32 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="hostkey agent" 4tid="hostkey agent"
5 5
6# Need full names here since they are used in HostKeyAlgorithms 6rm -f $OBJ/agent.* $OBJ/ssh_proxy.orig $OBJ/known_hosts.orig
7HOSTKEY_TYPES="ecdsa-sha2-nistp256 ssh-ed25519 ssh-rsa ssh-dss"
8
9rm -f $OBJ/agent.* $OBJ/ssh_proxy.orig
10 7
11trace "start agent" 8trace "start agent"
12eval `${SSHAGENT} -s` > /dev/null 9eval `${SSHAGENT} -s` > /dev/null
@@ -15,31 +12,31 @@ r=$?
15 12
16grep -vi 'hostkey' $OBJ/sshd_proxy > $OBJ/sshd_proxy.orig 13grep -vi 'hostkey' $OBJ/sshd_proxy > $OBJ/sshd_proxy.orig
17echo "HostKeyAgent $SSH_AUTH_SOCK" >> $OBJ/sshd_proxy.orig 14echo "HostKeyAgent $SSH_AUTH_SOCK" >> $OBJ/sshd_proxy.orig
18echo "LogLevel debug3" >> $OBJ/sshd_proxy.orig
19rm $OBJ/known_hosts
20 15
21trace "load hostkeys" 16trace "load hostkeys"
22for k in $HOSTKEY_TYPES ; do 17for k in `${SSH} -Q key-plain` ; do
23 ${SSHKEYGEN} -qt $k -f $OBJ/agent.$k -N '' || fatal "ssh-keygen $k" 18 ${SSHKEYGEN} -qt $k -f $OBJ/agent.$k -N '' || fatal "ssh-keygen $k"
24 ( 19 (
25 echo -n 'localhost-with-alias,127.0.0.1,::1 ' 20 echo -n 'localhost-with-alias,127.0.0.1,::1 '
26 cat $OBJ/agent.$k.pub 21 cat $OBJ/agent.$k.pub
27 ) >> $OBJ/known_hosts 22 ) >> $OBJ/known_hosts.orig
28 ${SSHADD} $OBJ/agent.$k >/dev/null 2>&1 || \ 23 ${SSHADD} $OBJ/agent.$k >/dev/null 2>&1 || \
29 fatal "couldn't load key $OBJ/agent.$k" 24 fatal "couldn't load key $OBJ/agent.$k"
30 echo "Hostkey $OBJ/agent.${k}" >> sshd_proxy.orig 25 echo "Hostkey $OBJ/agent.${k}" >> sshd_proxy.orig
31 # Remove private key so the server can't use it. 26 # Remove private key so the server can't use it.
32 rm $OBJ/agent.$k || fatal "couldn't rm $OBJ/agent.$k" 27 rm $OBJ/agent.$k || fatal "couldn't rm $OBJ/agent.$k"
33done 28done
29cp $OBJ/known_hosts.orig $OBJ/known_hosts
34 30
35unset SSH_AUTH_SOCK 31unset SSH_AUTH_SOCK
36 32
37for ps in no yes; do 33for ps in no yes; do
38 cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy 34 cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
39 echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy 35 echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy
40 for k in $HOSTKEY_TYPES ; do 36 for k in `${SSH} -Q key-plain` ; do
41 verbose "key type $k privsep=$ps" 37 verbose "key type $k privsep=$ps"
42 opts="-oHostKeyAlgorithms=$k -F $OBJ/ssh_proxy" 38 opts="-oHostKeyAlgorithms=$k -F $OBJ/ssh_proxy"
39 cp $OBJ/known_hosts.orig $OBJ/known_hosts
43 SSH_CONNECTION=`${SSH} $opts host 'echo $SSH_CONNECTION'` 40 SSH_CONNECTION=`${SSH} $opts host 'echo $SSH_CONNECTION'`
44 if [ $? -ne 0 ]; then 41 if [ $? -ne 0 ]; then
45 fail "protocol $p privsep=$ps failed" 42 fail "protocol $p privsep=$ps failed"