diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/keytype.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/regress/keytype.sh b/regress/keytype.sh new file mode 100644 index 000000000..7be3cc0c8 --- /dev/null +++ b/regress/keytype.sh | |||
@@ -0,0 +1,48 @@ | |||
1 | # $OpenBSD: keytype.sh,v 1.1 2010/09/02 16:12:55 markus Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="login with different key types" | ||
5 | |||
6 | TIME=/usr/bin/time | ||
7 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak | ||
8 | cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak | ||
9 | |||
10 | ktypes="dsa-1024 rsa-2048 ecdsa-256 rsa-3072 ecdsa-384 ecdsa-521" | ||
11 | |||
12 | for kt in $ktypes; do | ||
13 | rm -f $OBJ/key.$kt | ||
14 | bits=${kt#*-} | ||
15 | type=${kt%-*} | ||
16 | printf "keygen $type, $bits bits:\t" | ||
17 | ${TIME} ${SSHKEYGEN} -b $bits -q -N '' -t $type -f $OBJ/key.$kt ||\ | ||
18 | fail "ssh-keygen for type $type, $bits bits failed" | ||
19 | done | ||
20 | |||
21 | tries="1 2 3" | ||
22 | for ut in $ktypes; do | ||
23 | htypes=$ut | ||
24 | #htypes=$ktypes | ||
25 | for ht in $htypes; do | ||
26 | trace "ssh connect, userkey $ut, hostkey $ht" | ||
27 | ( | ||
28 | grep -v HostKey $OBJ/sshd_proxy_bak | ||
29 | echo HostKey $OBJ/key.$ht | ||
30 | ) > $OBJ/sshd_proxy | ||
31 | ( | ||
32 | grep -v IdentityFile $OBJ/ssh_proxy_bak | ||
33 | echo IdentityFile $OBJ/key.$ut | ||
34 | ) > $OBJ/ssh_proxy | ||
35 | ( | ||
36 | echo -n 'localhost-with-alias,127.0.0.1,::1 ' | ||
37 | cat $OBJ/key.$ht.pub | ||
38 | ) > $OBJ/known_hosts | ||
39 | cat $OBJ/key.$ut.pub > $OBJ/authorized_keys_$USER | ||
40 | for i in $tries; do | ||
41 | printf "userkey $ut, hostkey ${ht}:\t" | ||
42 | ${TIME} ${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true | ||
43 | if [ $? -ne 0 ]; then | ||
44 | fail "ssh userkey $ut, hostkey $ht failed" | ||
45 | fi | ||
46 | done | ||
47 | done | ||
48 | done | ||