summaryrefslogtreecommitdiff
path: root/regress/cfgmatch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/cfgmatch.sh')
-rw-r--r--regress/cfgmatch.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/regress/cfgmatch.sh b/regress/cfgmatch.sh
index 0603fab64..80cf22930 100644
--- a/regress/cfgmatch.sh
+++ b/regress/cfgmatch.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cfgmatch.sh,v 1.6 2011/06/03 05:35:10 dtucker Exp $ 1# $OpenBSD: cfgmatch.sh,v 1.8 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sshd_config match" 4tid="sshd_config match"
@@ -15,7 +15,7 @@ start_client()
15 rm -f $pidfile 15 rm -f $pidfile
16 ${SSH} -q -$p $fwd "$@" somehost \ 16 ${SSH} -q -$p $fwd "$@" somehost \
17 exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' \ 17 exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' \
18 >>$TEST_SSH_LOGFILE 2>&1 & 18 >>$TEST_REGRESS_LOGFILE 2>&1 &
19 client_pid=$! 19 client_pid=$!
20 # Wait for remote end 20 # Wait for remote end
21 n=0 21 n=0
@@ -34,21 +34,20 @@ stop_client()
34 pid=`cat $pidfile` 34 pid=`cat $pidfile`
35 if [ ! -z "$pid" ]; then 35 if [ ! -z "$pid" ]; then
36 kill $pid 36 kill $pid
37 sleep 1
38 fi 37 fi
39 wait 38 wait
40} 39}
41 40
42cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 41cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
43grep -v AuthorizedKeysFile $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
44echo "AuthorizedKeysFile /dev/null" >>$OBJ/sshd_proxy
45echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_config 42echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_config
46echo "Match user $USER" >>$OBJ/sshd_proxy
47echo "AuthorizedKeysFile /dev/null $OBJ/authorized_keys_%u" >>$OBJ/sshd_proxy
48echo "Match Address 127.0.0.1" >>$OBJ/sshd_config 43echo "Match Address 127.0.0.1" >>$OBJ/sshd_config
49echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_config 44echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_config
50 45
46grep -v AuthorizedKeysFile $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
47echo "AuthorizedKeysFile /dev/null" >>$OBJ/sshd_proxy
51echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_proxy 48echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_proxy
49echo "Match user $USER" >>$OBJ/sshd_proxy
50echo "AuthorizedKeysFile /dev/null $OBJ/authorized_keys_%u" >>$OBJ/sshd_proxy
52echo "Match Address 127.0.0.1" >>$OBJ/sshd_proxy 51echo "Match Address 127.0.0.1" >>$OBJ/sshd_proxy
53echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_proxy 52echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_proxy
54 53
@@ -75,9 +74,9 @@ for p in 1 2; do
75done 74done
76 75
77# Retry previous with key option, should also be denied. 76# Retry previous with key option, should also be denied.
78echon 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER 77printf 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER
79cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 78cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER
80echon 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER 79printf 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER
81cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 80cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER
82for p in 1 2; do 81for p in 1 2; do
83 trace "match permitopen proxy w/key opts proto $p" 82 trace "match permitopen proxy w/key opts proto $p"