diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-10 00:27:24 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-02-10 02:40:28 +0000 |
commit | a2b8818c5d21cfcba443625251f691a2ea3a29c7 (patch) | |
tree | 8fe1fe448cde57eecf71a7bcd57186661b90313f /regress | |
parent | d399ecd8eb7d4aed3b7ba0d2727e619607fb901b (diff) | |
parent | ee8d8b97cc2c6081df3af453a228992b87309ec4 (diff) |
Merge 6.5p1.
* New upstream release (http://www.openssh.com/txt/release-6.5,
LP: #1275068):
- ssh(1): Add support for client-side hostname canonicalisation using a
set of DNS suffixes and rules in ssh_config(5). This allows
unqualified names to be canonicalised to fully-qualified domain names
to eliminate ambiguity when looking up keys in known_hosts or checking
host certificate names (closes: #115286).
Diffstat (limited to 'regress')
-rw-r--r-- | regress/Makefile | 20 | ||||
-rw-r--r-- | regress/agent-ptrace.sh | 12 | ||||
-rw-r--r-- | regress/agent.sh | 34 | ||||
-rw-r--r-- | regress/cert-hostkey.sh | 60 | ||||
-rw-r--r-- | regress/cert-userkey.sh | 31 | ||||
-rw-r--r-- | regress/cipher-speed.sh | 23 | ||||
-rw-r--r-- | regress/forward-control.sh | 2 | ||||
-rw-r--r-- | regress/integrity.sh | 24 | ||||
-rw-r--r-- | regress/kextype.sh | 14 | ||||
-rw-r--r-- | regress/keytype.sh | 16 | ||||
-rw-r--r-- | regress/krl.sh | 5 | ||||
-rwxr-xr-x | regress/modpipe.c | 6 | ||||
-rw-r--r-- | regress/rekey.sh | 63 | ||||
-rw-r--r-- | regress/scp-ssh-wrapper.sh | 6 | ||||
-rw-r--r-- | regress/scp.sh | 1 | ||||
-rw-r--r-- | regress/setuid-allowed.c | 56 | ||||
-rw-r--r-- | regress/sftp-perm.sh | 269 | ||||
-rw-r--r-- | regress/test-exec.sh | 21 | ||||
-rw-r--r-- | regress/try-ciphers.sh | 31 |
19 files changed, 526 insertions, 168 deletions
diff --git a/regress/Makefile b/regress/Makefile index ab2a6ae7b..0c66b1774 100644 --- a/regress/Makefile +++ b/regress/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | # $OpenBSD: Makefile,v 1.65 2013/04/18 02:46:12 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.67 2013/12/06 13:52:46 markus Exp $ |
2 | 2 | ||
3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec | 3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t-exec |
4 | tests: $(REGRESS_TARGETS) | 4 | tests: $(REGRESS_TARGETS) |
5 | 5 | ||
6 | # Interop tests are not run by default | 6 | # Interop tests are not run by default |
@@ -44,6 +44,7 @@ LTESTS= connect \ | |||
44 | sftp-badcmds \ | 44 | sftp-badcmds \ |
45 | sftp-batch \ | 45 | sftp-batch \ |
46 | sftp-glob \ | 46 | sftp-glob \ |
47 | sftp-perm \ | ||
47 | reconfigure \ | 48 | reconfigure \ |
48 | dynamic-forward \ | 49 | dynamic-forward \ |
49 | forwarding \ | 50 | forwarding \ |
@@ -72,7 +73,7 @@ INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers | |||
72 | 73 | ||
73 | USER!= id -un | 74 | USER!= id -un |
74 | CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | 75 | CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ |
75 | t8.out t8.out.pub t9.out t9.out.pub \ | 76 | t8.out t8.out.pub t9.out t9.out.pub t10.out t10.out.pub \ |
76 | authorized_keys_${USER} known_hosts pidfile testdata \ | 77 | authorized_keys_${USER} known_hosts pidfile testdata \ |
77 | ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \ | 78 | ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \ |
78 | rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ | 79 | rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ |
@@ -86,7 +87,10 @@ CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | |||
86 | authorized_principals_${USER} expect actual ready \ | 87 | authorized_principals_${USER} expect actual ready \ |
87 | sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* \ | 88 | sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* \ |
88 | ssh.log failed-ssh.log sshd.log failed-sshd.log \ | 89 | ssh.log failed-ssh.log sshd.log failed-sshd.log \ |
89 | regress.log failed-regress.log ssh-log-wrapper.sh | 90 | regress.log failed-regress.log ssh-log-wrapper.sh \ |
91 | sftp-server.sh sftp-server.log sftp.log setuid-allowed \ | ||
92 | data ed25519-agent ed25519-agent.pub key.ed25519-512 \ | ||
93 | key.ed25519-512.pub | ||
90 | 94 | ||
91 | SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER} | 95 | SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER} |
92 | 96 | ||
@@ -151,6 +155,14 @@ t9: $(OBJ)/t9.out | |||
151 | test "${TEST_SSH_ECC}" != yes || \ | 155 | test "${TEST_SSH_ECC}" != yes || \ |
152 | ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null | 156 | ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null |
153 | 157 | ||
158 | |||
159 | $(OBJ)/t10.out: | ||
160 | ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@ | ||
161 | |||
162 | t10: $(OBJ)/t10.out | ||
163 | ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null | ||
164 | ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null | ||
165 | |||
154 | t-exec: ${LTESTS:=.sh} | 166 | t-exec: ${LTESTS:=.sh} |
155 | @if [ "x$?" = "x" ]; then exit 0; fi; \ | 167 | @if [ "x$?" = "x" ]; then exit 0; fi; \ |
156 | for TEST in ""$?; do \ | 168 | for TEST in ""$?; do \ |
diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh index 9f29464c5..ae150641f 100644 --- a/regress/agent-ptrace.sh +++ b/regress/agent-ptrace.sh | |||
@@ -19,6 +19,13 @@ else | |||
19 | exit 0 | 19 | exit 0 |
20 | fi | 20 | fi |
21 | 21 | ||
22 | if $OBJ/setuid-allowed ${SSHAGENT} ; then | ||
23 | : ok | ||
24 | else | ||
25 | echo "skipped (${SSHAGENT} is mounted on a no-setuid filesystem)" | ||
26 | exit 0 | ||
27 | fi | ||
28 | |||
22 | if test -z "$SUDO" ; then | 29 | if test -z "$SUDO" ; then |
23 | echo "skipped (SUDO not set)" | 30 | echo "skipped (SUDO not set)" |
24 | exit 0 | 31 | exit 0 |
@@ -38,8 +45,9 @@ else | |||
38 | gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF | 45 | gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF |
39 | quit | 46 | quit |
40 | EOF | 47 | EOF |
41 | if [ $? -ne 0 ]; then | 48 | r=$? |
42 | fail "gdb failed: exit code $?" | 49 | if [ $r -ne 0 ]; then |
50 | fail "gdb failed: exit code $r" | ||
43 | fi | 51 | fi |
44 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task ' >/dev/null ${OBJ}/gdb.out | 52 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task ' >/dev/null ${OBJ}/gdb.out |
45 | r=$? | 53 | r=$? |
diff --git a/regress/agent.sh b/regress/agent.sh index be7d91334..cf1a45fe0 100644 --- a/regress/agent.sh +++ b/regress/agent.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: agent.sh,v 1.8 2013/05/17 00:37:40 dtucker Exp $ | 1 | # $OpenBSD: agent.sh,v 1.9 2013/12/06 13:52:46 markus Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="simple agent test" | 4 | tid="simple agent test" |
@@ -20,7 +20,7 @@ else | |||
20 | fi | 20 | fi |
21 | trace "overwrite authorized keys" | 21 | trace "overwrite authorized keys" |
22 | printf '' > $OBJ/authorized_keys_$USER | 22 | printf '' > $OBJ/authorized_keys_$USER |
23 | for t in rsa rsa1; do | 23 | for t in ed25519 rsa rsa1; do |
24 | # generate user key for agent | 24 | # generate user key for agent |
25 | rm -f $OBJ/$t-agent | 25 | rm -f $OBJ/$t-agent |
26 | ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\ | 26 | ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\ |
@@ -34,40 +34,46 @@ else | |||
34 | fi | 34 | fi |
35 | done | 35 | done |
36 | ${SSHADD} -l > /dev/null 2>&1 | 36 | ${SSHADD} -l > /dev/null 2>&1 |
37 | if [ $? -ne 0 ]; then | 37 | r=$? |
38 | fail "ssh-add -l failed: exit code $?" | 38 | if [ $r -ne 0 ]; then |
39 | fail "ssh-add -l failed: exit code $r" | ||
39 | fi | 40 | fi |
40 | # the same for full pubkey output | 41 | # the same for full pubkey output |
41 | ${SSHADD} -L > /dev/null 2>&1 | 42 | ${SSHADD} -L > /dev/null 2>&1 |
42 | if [ $? -ne 0 ]; then | 43 | r=$? |
43 | fail "ssh-add -L failed: exit code $?" | 44 | if [ $r -ne 0 ]; then |
45 | fail "ssh-add -L failed: exit code $r" | ||
44 | fi | 46 | fi |
45 | 47 | ||
46 | trace "simple connect via agent" | 48 | trace "simple connect via agent" |
47 | for p in 1 2; do | 49 | for p in 1 2; do |
48 | ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p | 50 | ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p |
49 | if [ $? -ne 5$p ]; then | 51 | r=$? |
50 | fail "ssh connect with protocol $p failed (exit code $?)" | 52 | if [ $r -ne 5$p ]; then |
53 | fail "ssh connect with protocol $p failed (exit code $r)" | ||
51 | fi | 54 | fi |
52 | done | 55 | done |
53 | 56 | ||
54 | trace "agent forwarding" | 57 | trace "agent forwarding" |
55 | for p in 1 2; do | 58 | for p in 1 2; do |
56 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 | 59 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 |
57 | if [ $? -ne 0 ]; then | 60 | r=$? |
58 | fail "ssh-add -l via agent fwd proto $p failed (exit code $?)" | 61 | if [ $r -ne 0 ]; then |
62 | fail "ssh-add -l via agent fwd proto $p failed (exit code $r)" | ||
59 | fi | 63 | fi |
60 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \ | 64 | ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \ |
61 | "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p" | 65 | "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p" |
62 | if [ $? -ne 5$p ]; then | 66 | r=$? |
63 | fail "agent fwd proto $p failed (exit code $?)" | 67 | if [ $r -ne 5$p ]; then |
68 | fail "agent fwd proto $p failed (exit code $r)" | ||
64 | fi | 69 | fi |
65 | done | 70 | done |
66 | 71 | ||
67 | trace "delete all agent keys" | 72 | trace "delete all agent keys" |
68 | ${SSHADD} -D > /dev/null 2>&1 | 73 | ${SSHADD} -D > /dev/null 2>&1 |
69 | if [ $? -ne 0 ]; then | 74 | r=$? |
70 | fail "ssh-add -D failed: exit code $?" | 75 | if [ $r -ne 0 ]; then |
76 | fail "ssh-add -D failed: exit code $r" | ||
71 | fi | 77 | fi |
72 | 78 | ||
73 | trace "kill agent" | 79 | trace "kill agent" |
diff --git a/regress/cert-hostkey.sh b/regress/cert-hostkey.sh index 35cd39293..a1318cd53 100644 --- a/regress/cert-hostkey.sh +++ b/regress/cert-hostkey.sh | |||
@@ -1,14 +1,8 @@ | |||
1 | # $OpenBSD: cert-hostkey.sh,v 1.7 2013/05/17 00:37:40 dtucker Exp $ | 1 | # $OpenBSD: cert-hostkey.sh,v 1.8 2013/12/06 13:52:46 markus Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="certified host keys" | 4 | tid="certified host keys" |
5 | 5 | ||
6 | # used to disable ECC based tests on platforms without ECC | ||
7 | ecdsa="" | ||
8 | if test "x$TEST_SSH_ECC" = "xyes"; then | ||
9 | ecdsa=ecdsa | ||
10 | fi | ||
11 | |||
12 | rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key* | 6 | rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key* |
13 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak | 7 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak |
14 | 8 | ||
@@ -23,8 +17,17 @@ ${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/host_ca_key ||\ | |||
23 | cat $OBJ/host_ca_key.pub | 17 | cat $OBJ/host_ca_key.pub |
24 | ) > $OBJ/known_hosts-cert | 18 | ) > $OBJ/known_hosts-cert |
25 | 19 | ||
20 | PLAIN_TYPES=`$SSH -Q key-plain | sed 's/^ssh-dss/ssh-dsa/g;s/^ssh-//'` | ||
21 | |||
22 | type_has_legacy() { | ||
23 | case $1 in | ||
24 | ed25519*|ecdsa*) return 1 ;; | ||
25 | esac | ||
26 | return 0 | ||
27 | } | ||
28 | |||
26 | # Generate and sign host keys | 29 | # Generate and sign host keys |
27 | for ktype in rsa dsa $ecdsa ; do | 30 | for ktype in $PLAIN_TYPES ; do |
28 | verbose "$tid: sign host ${ktype} cert" | 31 | verbose "$tid: sign host ${ktype} cert" |
29 | # Generate and sign a host key | 32 | # Generate and sign a host key |
30 | ${SSHKEYGEN} -q -N '' -t ${ktype} \ | 33 | ${SSHKEYGEN} -q -N '' -t ${ktype} \ |
@@ -34,10 +37,10 @@ for ktype in rsa dsa $ecdsa ; do | |||
34 | -I "regress host key for $USER" \ | 37 | -I "regress host key for $USER" \ |
35 | -n $HOSTS $OBJ/cert_host_key_${ktype} || | 38 | -n $HOSTS $OBJ/cert_host_key_${ktype} || |
36 | fail "couldn't sign cert_host_key_${ktype}" | 39 | fail "couldn't sign cert_host_key_${ktype}" |
37 | # v00 ecdsa certs do not exist | 40 | type_has_legacy $ktype || continue |
38 | test "${ktype}" = "ecdsa" && continue | ||
39 | cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00 | 41 | cp $OBJ/cert_host_key_${ktype} $OBJ/cert_host_key_${ktype}_v00 |
40 | cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub | 42 | cp $OBJ/cert_host_key_${ktype}.pub $OBJ/cert_host_key_${ktype}_v00.pub |
43 | verbose "$tid: sign host ${ktype}_v00 cert" | ||
41 | ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \ | 44 | ${SSHKEYGEN} -t v00 -h -q -s $OBJ/host_ca_key \ |
42 | -I "regress host key for $USER" \ | 45 | -I "regress host key for $USER" \ |
43 | -n $HOSTS $OBJ/cert_host_key_${ktype}_v00 || | 46 | -n $HOSTS $OBJ/cert_host_key_${ktype}_v00 || |
@@ -46,7 +49,7 @@ done | |||
46 | 49 | ||
47 | # Basic connect tests | 50 | # Basic connect tests |
48 | for privsep in yes no ; do | 51 | for privsep in yes no ; do |
49 | for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00; do | 52 | for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do |
50 | verbose "$tid: host ${ktype} cert connect privsep $privsep" | 53 | verbose "$tid: host ${ktype} cert connect privsep $privsep" |
51 | ( | 54 | ( |
52 | cat $OBJ/sshd_proxy_bak | 55 | cat $OBJ/sshd_proxy_bak |
@@ -69,26 +72,13 @@ done | |||
69 | printf '@cert-authority ' | 72 | printf '@cert-authority ' |
70 | printf "$HOSTS " | 73 | printf "$HOSTS " |
71 | cat $OBJ/host_ca_key.pub | 74 | cat $OBJ/host_ca_key.pub |
72 | printf '@revoked ' | 75 | for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do |
73 | printf "* " | 76 | test -f "$OBJ/cert_host_key_${ktype}.pub" || fatal "no pubkey" |
74 | cat $OBJ/cert_host_key_rsa.pub | 77 | printf "@revoked * `cat $OBJ/cert_host_key_${ktype}.pub`\n" |
75 | if test "x$TEST_SSH_ECC" = "xyes"; then | 78 | done |
76 | printf '@revoked ' | ||
77 | printf "* " | ||
78 | cat $OBJ/cert_host_key_ecdsa.pub | ||
79 | fi | ||
80 | printf '@revoked ' | ||
81 | printf "* " | ||
82 | cat $OBJ/cert_host_key_dsa.pub | ||
83 | printf '@revoked ' | ||
84 | printf "* " | ||
85 | cat $OBJ/cert_host_key_rsa_v00.pub | ||
86 | printf '@revoked ' | ||
87 | printf "* " | ||
88 | cat $OBJ/cert_host_key_dsa_v00.pub | ||
89 | ) > $OBJ/known_hosts-cert | 79 | ) > $OBJ/known_hosts-cert |
90 | for privsep in yes no ; do | 80 | for privsep in yes no ; do |
91 | for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00; do | 81 | for ktype in $PLAIN_TYPES rsa_v00 dsa_v00; do |
92 | verbose "$tid: host ${ktype} revoked cert privsep $privsep" | 82 | verbose "$tid: host ${ktype} revoked cert privsep $privsep" |
93 | ( | 83 | ( |
94 | cat $OBJ/sshd_proxy_bak | 84 | cat $OBJ/sshd_proxy_bak |
@@ -115,7 +105,7 @@ done | |||
115 | printf "* " | 105 | printf "* " |
116 | cat $OBJ/host_ca_key.pub | 106 | cat $OBJ/host_ca_key.pub |
117 | ) > $OBJ/known_hosts-cert | 107 | ) > $OBJ/known_hosts-cert |
118 | for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do | 108 | for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do |
119 | verbose "$tid: host ${ktype} revoked cert" | 109 | verbose "$tid: host ${ktype} revoked cert" |
120 | ( | 110 | ( |
121 | cat $OBJ/sshd_proxy_bak | 111 | cat $OBJ/sshd_proxy_bak |
@@ -186,9 +176,8 @@ test_one "cert has constraints" failure "-h -Oforce-command=false" | |||
186 | 176 | ||
187 | # Check downgrade of cert to raw key when no CA found | 177 | # Check downgrade of cert to raw key when no CA found |
188 | for v in v01 v00 ; do | 178 | for v in v01 v00 ; do |
189 | for ktype in rsa dsa $ecdsa ; do | 179 | for ktype in $PLAIN_TYPES ; do |
190 | # v00 ecdsa certs do not exist. | 180 | type_has_legacy $ktype || continue |
191 | test "${v}${ktype}" = "v00ecdsa" && continue | ||
192 | rm -f $OBJ/known_hosts-cert $OBJ/cert_host_key* | 181 | rm -f $OBJ/known_hosts-cert $OBJ/cert_host_key* |
193 | verbose "$tid: host ${ktype} ${v} cert downgrade to raw key" | 182 | verbose "$tid: host ${ktype} ${v} cert downgrade to raw key" |
194 | # Generate and sign a host key | 183 | # Generate and sign a host key |
@@ -225,9 +214,8 @@ done | |||
225 | cat $OBJ/host_ca_key.pub | 214 | cat $OBJ/host_ca_key.pub |
226 | ) > $OBJ/known_hosts-cert | 215 | ) > $OBJ/known_hosts-cert |
227 | for v in v01 v00 ; do | 216 | for v in v01 v00 ; do |
228 | for kt in rsa dsa $ecdsa ; do | 217 | for kt in $PLAIN_TYPES ; do |
229 | # v00 ecdsa certs do not exist. | 218 | type_has_legacy $kt || continue |
230 | test "${v}${ktype}" = "v00ecdsa" && continue | ||
231 | rm -f $OBJ/cert_host_key* | 219 | rm -f $OBJ/cert_host_key* |
232 | # Self-sign key | 220 | # Self-sign key |
233 | ${SSHKEYGEN} -q -N '' -t ${kt} \ | 221 | ${SSHKEYGEN} -q -N '' -t ${kt} \ |
diff --git a/regress/cert-userkey.sh b/regress/cert-userkey.sh index 6018b38f4..b093a9196 100644 --- a/regress/cert-userkey.sh +++ b/regress/cert-userkey.sh | |||
@@ -1,23 +1,26 @@ | |||
1 | # $OpenBSD: cert-userkey.sh,v 1.11 2013/05/17 00:37:40 dtucker Exp $ | 1 | # $OpenBSD: cert-userkey.sh,v 1.12 2013/12/06 13:52:46 markus Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="certified user keys" | 4 | tid="certified user keys" |
5 | 5 | ||
6 | # used to disable ECC based tests on platforms without ECC | ||
7 | ecdsa="" | ||
8 | if test "x$TEST_SSH_ECC" = "xyes"; then | ||
9 | ecdsa=ecdsa | ||
10 | fi | ||
11 | |||
12 | rm -f $OBJ/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/cert_user_key* | 6 | rm -f $OBJ/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/cert_user_key* |
13 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak | 7 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak |
14 | 8 | ||
9 | PLAIN_TYPES=`$SSH -Q key-plain | sed 's/^ssh-dss/ssh-dsa/;s/^ssh-//'` | ||
10 | |||
11 | type_has_legacy() { | ||
12 | case $1 in | ||
13 | ed25519*|ecdsa*) return 1 ;; | ||
14 | esac | ||
15 | return 0 | ||
16 | } | ||
17 | |||
15 | # Create a CA key | 18 | # Create a CA key |
16 | ${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_ca_key ||\ | 19 | ${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_ca_key ||\ |
17 | fail "ssh-keygen of user_ca_key failed" | 20 | fail "ssh-keygen of user_ca_key failed" |
18 | 21 | ||
19 | # Generate and sign user keys | 22 | # Generate and sign user keys |
20 | for ktype in rsa dsa $ecdsa ; do | 23 | for ktype in $PLAIN_TYPES ; do |
21 | verbose "$tid: sign user ${ktype} cert" | 24 | verbose "$tid: sign user ${ktype} cert" |
22 | ${SSHKEYGEN} -q -N '' -t ${ktype} \ | 25 | ${SSHKEYGEN} -q -N '' -t ${ktype} \ |
23 | -f $OBJ/cert_user_key_${ktype} || \ | 26 | -f $OBJ/cert_user_key_${ktype} || \ |
@@ -25,18 +28,18 @@ for ktype in rsa dsa $ecdsa ; do | |||
25 | ${SSHKEYGEN} -q -s $OBJ/user_ca_key -I "regress user key for $USER" \ | 28 | ${SSHKEYGEN} -q -s $OBJ/user_ca_key -I "regress user key for $USER" \ |
26 | -z $$ -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype} || | 29 | -z $$ -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype} || |
27 | fail "couldn't sign cert_user_key_${ktype}" | 30 | fail "couldn't sign cert_user_key_${ktype}" |
28 | # v00 ecdsa certs do not exist | 31 | type_has_legacy $ktype || continue |
29 | test "${ktype}" = "ecdsa" && continue | ||
30 | cp $OBJ/cert_user_key_${ktype} $OBJ/cert_user_key_${ktype}_v00 | 32 | cp $OBJ/cert_user_key_${ktype} $OBJ/cert_user_key_${ktype}_v00 |
31 | cp $OBJ/cert_user_key_${ktype}.pub $OBJ/cert_user_key_${ktype}_v00.pub | 33 | cp $OBJ/cert_user_key_${ktype}.pub $OBJ/cert_user_key_${ktype}_v00.pub |
34 | verbose "$tid: sign host ${ktype}_v00 cert" | ||
32 | ${SSHKEYGEN} -q -t v00 -s $OBJ/user_ca_key -I \ | 35 | ${SSHKEYGEN} -q -t v00 -s $OBJ/user_ca_key -I \ |
33 | "regress user key for $USER" \ | 36 | "regress user key for $USER" \ |
34 | -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype}_v00 || | 37 | -n ${USER},mekmitasdigoat $OBJ/cert_user_key_${ktype}_v00 || |
35 | fail "couldn't sign cert_user_key_${ktype}_v00" | 38 | fatal "couldn't sign cert_user_key_${ktype}_v00" |
36 | done | 39 | done |
37 | 40 | ||
38 | # Test explicitly-specified principals | 41 | # Test explicitly-specified principals |
39 | for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do | 42 | for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do |
40 | for privsep in yes no ; do | 43 | for privsep in yes no ; do |
41 | _prefix="${ktype} privsep $privsep" | 44 | _prefix="${ktype} privsep $privsep" |
42 | 45 | ||
@@ -162,7 +165,7 @@ basic_tests() { | |||
162 | extra_sshd="TrustedUserCAKeys $OBJ/user_ca_key.pub" | 165 | extra_sshd="TrustedUserCAKeys $OBJ/user_ca_key.pub" |
163 | fi | 166 | fi |
164 | 167 | ||
165 | for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do | 168 | for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do |
166 | for privsep in yes no ; do | 169 | for privsep in yes no ; do |
167 | _prefix="${ktype} privsep $privsep $auth" | 170 | _prefix="${ktype} privsep $privsep $auth" |
168 | # Simple connect | 171 | # Simple connect |
@@ -332,7 +335,7 @@ test_one "principals key option no principals" failure "" \ | |||
332 | 335 | ||
333 | # Wrong certificate | 336 | # Wrong certificate |
334 | cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy | 337 | cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy |
335 | for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do | 338 | for ktype in $PLAIN_TYPES rsa_v00 dsa_v00 ; do |
336 | case $ktype in | 339 | case $ktype in |
337 | *_v00) args="-t v00" ;; | 340 | *_v00) args="-t v00" ;; |
338 | *) args="" ;; | 341 | *) args="" ;; |
diff --git a/regress/cipher-speed.sh b/regress/cipher-speed.sh index 489d9f5fa..a6d53a78d 100644 --- a/regress/cipher-speed.sh +++ b/regress/cipher-speed.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: cipher-speed.sh,v 1.9 2013/05/17 04:29:14 dtucker Exp $ | 1 | # $OpenBSD: cipher-speed.sh,v 1.11 2013/11/21 03:18:51 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="cipher speed" | 4 | tid="cipher speed" |
@@ -11,18 +11,7 @@ getbytes () | |||
11 | 11 | ||
12 | tries="1 2" | 12 | tries="1 2" |
13 | 13 | ||
14 | ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc | 14 | for c in `${SSH} -Q cipher`; do n=0; for m in `${SSH} -Q mac`; do |
15 | arcfour128 arcfour256 arcfour | ||
16 | aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se | ||
17 | aes128-ctr aes192-ctr aes256-ctr" | ||
18 | config_defined OPENSSL_HAVE_EVPGCM && \ | ||
19 | ciphers="$ciphers aes128-gcm@openssh.com aes256-gcm@openssh.com" | ||
20 | macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com | ||
21 | hmac-sha1-96 hmac-md5-96" | ||
22 | config_defined HAVE_EVP_SHA256 && \ | ||
23 | macs="$macs hmac-sha2-256 hmac-sha2-512" | ||
24 | |||
25 | for c in $ciphers; do n=0; for m in $macs; do | ||
26 | trace "proto 2 cipher $c mac $m" | 15 | trace "proto 2 cipher $c mac $m" |
27 | for x in $tries; do | 16 | for x in $tries; do |
28 | printf "%-60s" "$c/$m:" | 17 | printf "%-60s" "$c/$m:" |
@@ -35,10 +24,10 @@ for c in $ciphers; do n=0; for m in $macs; do | |||
35 | fail "ssh -2 failed with mac $m cipher $c" | 24 | fail "ssh -2 failed with mac $m cipher $c" |
36 | fi | 25 | fi |
37 | done | 26 | done |
38 | # No point trying all MACs for GCM since they are ignored. | 27 | # No point trying all MACs for AEAD ciphers since they are ignored. |
39 | case $c in | 28 | if ssh -Q cipher-auth | grep "^${c}\$" >/dev/null 2>&1 ; then |
40 | aes*-gcm@openssh.com) test $n -gt 0 && break;; | 29 | break |
41 | esac | 30 | fi |
42 | n=`expr $n + 1` | 31 | n=`expr $n + 1` |
43 | done; done | 32 | done; done |
44 | 33 | ||
diff --git a/regress/forward-control.sh b/regress/forward-control.sh index 80ddb4167..7f7d105e8 100644 --- a/regress/forward-control.sh +++ b/regress/forward-control.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: forward-control.sh,v 1.1 2012/12/02 20:47:48 djm Exp $ | 1 | # $OpenBSD: forward-control.sh,v 1.2 2013/11/18 05:09:32 naddy Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="sshd control of local and remote forwarding" | 4 | tid="sshd control of local and remote forwarding" |
diff --git a/regress/integrity.sh b/regress/integrity.sh index 1d17fe10a..852d82690 100644 --- a/regress/integrity.sh +++ b/regress/integrity.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: integrity.sh,v 1.10 2013/05/17 01:32:11 dtucker Exp $ | 1 | # $OpenBSD: integrity.sh,v 1.12 2013/11/21 03:18:51 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="integrity" | 4 | tid="integrity" |
@@ -8,18 +8,10 @@ tid="integrity" | |||
8 | # XXX and ssh tries to read... | 8 | # XXX and ssh tries to read... |
9 | tries=10 | 9 | tries=10 |
10 | startoffset=2900 | 10 | startoffset=2900 |
11 | macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com | 11 | macs=`${SSH} -Q mac` |
12 | hmac-sha1-96 hmac-md5-96 | ||
13 | hmac-sha1-etm@openssh.com hmac-md5-etm@openssh.com | ||
14 | umac-64-etm@openssh.com umac-128-etm@openssh.com | ||
15 | hmac-sha1-96-etm@openssh.com hmac-md5-96-etm@openssh.com" | ||
16 | config_defined HAVE_EVP_SHA256 && | ||
17 | macs="$macs hmac-sha2-256 hmac-sha2-512 | ||
18 | hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com" | ||
19 | # The following are not MACs, but ciphers with integrated integrity. They are | 12 | # The following are not MACs, but ciphers with integrated integrity. They are |
20 | # handled specially below. | 13 | # handled specially below. |
21 | config_defined OPENSSL_HAVE_EVPGCM && \ | 14 | macs="$macs `${SSH} -Q cipher-auth`" |
22 | macs="$macs aes128-gcm@openssh.com aes256-gcm@openssh.com" | ||
23 | 15 | ||
24 | # avoid DH group exchange as the extra traffic makes it harder to get the | 16 | # avoid DH group exchange as the extra traffic makes it harder to get the |
25 | # offset into the stream right. | 17 | # offset into the stream right. |
@@ -44,12 +36,14 @@ for m in $macs; do | |||
44 | fi | 36 | fi |
45 | # modify output from sshd at offset $off | 37 | # modify output from sshd at offset $off |
46 | pxy="proxycommand=$cmd | $OBJ/modpipe -wm xor:$off:1" | 38 | pxy="proxycommand=$cmd | $OBJ/modpipe -wm xor:$off:1" |
47 | case $m in | 39 | if ssh -Q cipher-auth | grep "^${m}\$" >/dev/null 2>&1 ; then |
48 | aes*gcm*) macopt="-c $m";; | 40 | macopt="-c $m" |
49 | *) macopt="-m $m";; | 41 | else |
50 | esac | 42 | macopt="-m $m -c aes128-ctr" |
43 | fi | ||
51 | verbose "test $tid: $m @$off" | 44 | verbose "test $tid: $m @$off" |
52 | ${SSH} $macopt -2F $OBJ/ssh_proxy -o "$pxy" \ | 45 | ${SSH} $macopt -2F $OBJ/ssh_proxy -o "$pxy" \ |
46 | -oServerAliveInterval=1 -oServerAliveCountMax=30 \ | ||
53 | 999.999.999.999 'printf "%4096s" " "' >/dev/null | 47 | 999.999.999.999 'printf "%4096s" " "' >/dev/null |
54 | if [ $? -eq 0 ]; then | 48 | if [ $? -eq 0 ]; then |
55 | fail "ssh -m $m succeeds with bit-flip at $off" | 49 | fail "ssh -m $m succeeds with bit-flip at $off" |
diff --git a/regress/kextype.sh b/regress/kextype.sh index 79c0817bb..8c2ac09d6 100644 --- a/regress/kextype.sh +++ b/regress/kextype.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: kextype.sh,v 1.1 2010/09/22 12:26:05 djm Exp $ | 1 | # $OpenBSD: kextype.sh,v 1.4 2013/11/07 04:26:56 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="login with different key exchange algorithms" | 4 | tid="login with different key exchange algorithms" |
@@ -7,18 +7,8 @@ TIME=/usr/bin/time | |||
7 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak | 7 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak |
8 | cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak | 8 | cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak |
9 | 9 | ||
10 | if test "$TEST_SSH_ECC" = "yes"; then | ||
11 | kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" | ||
12 | fi | ||
13 | if test "$TEST_SSH_SHA256" = "yes"; then | ||
14 | kextypes="$kextypes diffie-hellman-group-exchange-sha256" | ||
15 | fi | ||
16 | kextypes="$kextypes diffie-hellman-group-exchange-sha1" | ||
17 | kextypes="$kextypes diffie-hellman-group14-sha1" | ||
18 | kextypes="$kextypes diffie-hellman-group1-sha1" | ||
19 | |||
20 | tries="1 2 3 4" | 10 | tries="1 2 3 4" |
21 | for k in $kextypes; do | 11 | for k in `${SSH} -Q kex`; do |
22 | verbose "kex $k" | 12 | verbose "kex $k" |
23 | for i in $tries; do | 13 | for i in $tries; do |
24 | ${SSH} -F $OBJ/ssh_proxy -o KexAlgorithms=$k x true | 14 | ${SSH} -F $OBJ/ssh_proxy -o KexAlgorithms=$k x true |
diff --git a/regress/keytype.sh b/regress/keytype.sh index 59586bf0d..9752acb0a 100644 --- a/regress/keytype.sh +++ b/regress/keytype.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: keytype.sh,v 1.2 2013/05/17 00:37:40 dtucker Exp $ | 1 | # $OpenBSD: keytype.sh,v 1.3 2013/12/06 13:52:46 markus Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="login with different key types" | 4 | tid="login with different key types" |
@@ -11,10 +11,16 @@ fi | |||
11 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak | 11 | cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak |
12 | cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak | 12 | cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak |
13 | 13 | ||
14 | ktypes="dsa-1024 rsa-2048 rsa-3072" | 14 | # Traditional and builtin key types. |
15 | if test "$TEST_SSH_ECC" = "yes"; then | 15 | ktypes="dsa-1024 rsa-2048 rsa-3072 ed25519-512" |
16 | ktypes="$ktypes ecdsa-256 ecdsa-384 ecdsa-521" | 16 | # Types not present in all OpenSSL versions. |
17 | fi | 17 | for i in `$SSH -Q key`; do |
18 | case "$i" in | ||
19 | ecdsa-sha2-nistp256) ktypes="$ktypes ecdsa-256" ;; | ||
20 | ecdsa-sha2-nistp384) ktypes="$ktypes ecdsa-384" ;; | ||
21 | ecdsa-sha2-nistp521) ktypes="$ktypes ecdsa-521" ;; | ||
22 | esac | ||
23 | done | ||
18 | 24 | ||
19 | for kt in $ktypes; do | 25 | for kt in $ktypes; do |
20 | rm -f $OBJ/key.$kt | 26 | rm -f $OBJ/key.$kt |
diff --git a/regress/krl.sh b/regress/krl.sh index de9cc8764..09246371c 100644 --- a/regress/krl.sh +++ b/regress/krl.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: krl.sh,v 1.1 2013/01/18 00:45:29 djm Exp $ | 1 | # $OpenBSD: krl.sh,v 1.2 2013/11/21 03:15:46 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="key revocation lists" | 4 | tid="key revocation lists" |
@@ -101,6 +101,9 @@ $SSHKEYGEN $OPTS -kf $OBJ/krl-keyid -s $OBJ/revoked-ca.pub $OBJ/revoked-keyid \ | |||
101 | >/dev/null || fatal "$SSHKEYGEN KRL failed" | 101 | >/dev/null || fatal "$SSHKEYGEN KRL failed" |
102 | } | 102 | } |
103 | 103 | ||
104 | ## XXX dump with trace and grep for set cert serials | ||
105 | ## XXX test ranges near (u64)-1, etc. | ||
106 | |||
104 | verbose "$tid: generating KRLs" | 107 | verbose "$tid: generating KRLs" |
105 | genkrls | 108 | genkrls |
106 | 109 | ||
diff --git a/regress/modpipe.c b/regress/modpipe.c index 85747cf7d..e854f9e07 100755 --- a/regress/modpipe.c +++ b/regress/modpipe.c | |||
@@ -14,7 +14,7 @@ | |||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* $OpenBSD: modpipe.c,v 1.5 2013/05/10 03:46:14 djm Exp $ */ | 17 | /* $OpenBSD: modpipe.c,v 1.6 2013/11/21 03:16:47 djm Exp $ */ |
18 | 18 | ||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | 20 | ||
@@ -68,7 +68,7 @@ usage(void) | |||
68 | #define MAX_MODIFICATIONS 256 | 68 | #define MAX_MODIFICATIONS 256 |
69 | struct modification { | 69 | struct modification { |
70 | enum { MOD_XOR, MOD_AND_OR } what; | 70 | enum { MOD_XOR, MOD_AND_OR } what; |
71 | u_int64_t offset; | 71 | unsigned long long offset; |
72 | u_int8_t m1, m2; | 72 | u_int8_t m1, m2; |
73 | }; | 73 | }; |
74 | 74 | ||
@@ -79,7 +79,7 @@ parse_modification(const char *s, struct modification *m) | |||
79 | int n, m1, m2; | 79 | int n, m1, m2; |
80 | 80 | ||
81 | bzero(m, sizeof(*m)); | 81 | bzero(m, sizeof(*m)); |
82 | if ((n = sscanf(s, "%16[^:]%*[:]%lli%*[:]%i%*[:]%i", | 82 | if ((n = sscanf(s, "%16[^:]%*[:]%llu%*[:]%i%*[:]%i", |
83 | what, &m->offset, &m1, &m2)) < 3) | 83 | what, &m->offset, &m1, &m2)) < 3) |
84 | errx(1, "Invalid modification spec \"%s\"", s); | 84 | errx(1, "Invalid modification spec \"%s\"", s); |
85 | if (strcasecmp(what, "xor") == 0) { | 85 | if (strcasecmp(what, "xor") == 0) { |
diff --git a/regress/rekey.sh b/regress/rekey.sh index 8eb7efaf9..cf9401ea0 100644 --- a/regress/rekey.sh +++ b/regress/rekey.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: rekey.sh,v 1.8 2013/05/17 04:29:14 dtucker Exp $ | 1 | # $OpenBSD: rekey.sh,v 1.14 2013/11/21 03:18:51 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="rekey" | 4 | tid="rekey" |
@@ -7,34 +7,67 @@ LOG=${TEST_SSH_LOGFILE} | |||
7 | 7 | ||
8 | rm -f ${LOG} | 8 | rm -f ${LOG} |
9 | 9 | ||
10 | for s in 16 1k 128k 256k; do | 10 | # Test rekeying based on data volume only. |
11 | verbose "client rekeylimit ${s}" | 11 | # Arguments will be passed to ssh. |
12 | ssh_data_rekeying() | ||
13 | { | ||
12 | rm -f ${COPY} ${LOG} | 14 | rm -f ${COPY} ${LOG} |
13 | cat $DATA | \ | 15 | ${SSH} <${DATA} -oCompression=no $@ -v -F $OBJ/ssh_proxy somehost \ |
14 | ${SSH} -oCompression=no -oRekeyLimit=$s \ | 16 | "cat > ${COPY}" |
15 | -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" | ||
16 | if [ $? -ne 0 ]; then | 17 | if [ $? -ne 0 ]; then |
17 | fail "ssh failed" | 18 | fail "ssh failed ($@)" |
18 | fi | 19 | fi |
19 | cmp $DATA ${COPY} || fail "corrupted copy" | 20 | cmp ${DATA} ${COPY} || fail "corrupted copy ($@)" |
20 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` | 21 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` |
21 | n=`expr $n - 1` | 22 | n=`expr $n - 1` |
22 | trace "$n rekeying(s)" | 23 | trace "$n rekeying(s)" |
23 | if [ $n -lt 1 ]; then | 24 | if [ $n -lt 1 ]; then |
24 | fail "no rekeying occured" | 25 | fail "no rekeying occured ($@)" |
25 | fi | 26 | fi |
27 | } | ||
28 | |||
29 | increase_datafile_size 300 | ||
30 | |||
31 | opts="" | ||
32 | for i in `${SSH} -Q kex`; do | ||
33 | opts="$opts KexAlgorithms=$i" | ||
34 | done | ||
35 | for i in `${SSH} -Q cipher`; do | ||
36 | opts="$opts Ciphers=$i" | ||
37 | done | ||
38 | for i in `${SSH} -Q mac`; do | ||
39 | opts="$opts MACs=$i" | ||
40 | done | ||
41 | |||
42 | for opt in $opts; do | ||
43 | verbose "client rekey $opt" | ||
44 | ssh_data_rekeying -oRekeyLimit=256k -o$opt | ||
45 | done | ||
46 | |||
47 | # AEAD ciphers are magical so test with all KexAlgorithms | ||
48 | if ${SSH} -Q cipher-auth | grep '^.*$' >/dev/null 2>&1 ; then | ||
49 | for c in `${SSH} -Q cipher-auth`; do | ||
50 | for kex in `${SSH} -Q kex`; do | ||
51 | verbose "client rekey $c $kex" | ||
52 | ssh_data_rekeying -oRekeyLimit=256k -oCiphers=$c -oKexAlgorithms=$kex | ||
53 | done | ||
54 | done | ||
55 | fi | ||
56 | |||
57 | for s in 16 1k 128k 256k; do | ||
58 | verbose "client rekeylimit ${s}" | ||
59 | ssh_data_rekeying -oCompression=no -oRekeyLimit=$s | ||
26 | done | 60 | done |
27 | 61 | ||
28 | for s in 5 10; do | 62 | for s in 5 10; do |
29 | verbose "client rekeylimit default ${s}" | 63 | verbose "client rekeylimit default ${s}" |
30 | rm -f ${COPY} ${LOG} | 64 | rm -f ${COPY} ${LOG} |
31 | cat $DATA | \ | 65 | ${SSH} < ${DATA} -oCompression=no -oRekeyLimit="default $s" -F \ |
32 | ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \ | 66 | $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3" |
33 | $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3" | ||
34 | if [ $? -ne 0 ]; then | 67 | if [ $? -ne 0 ]; then |
35 | fail "ssh failed" | 68 | fail "ssh failed" |
36 | fi | 69 | fi |
37 | cmp $DATA ${COPY} || fail "corrupted copy" | 70 | cmp ${DATA} ${COPY} || fail "corrupted copy" |
38 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` | 71 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` |
39 | n=`expr $n - 1` | 72 | n=`expr $n - 1` |
40 | trace "$n rekeying(s)" | 73 | trace "$n rekeying(s)" |
@@ -98,10 +131,10 @@ for size in 16 1k 1K 1m 1M 1g 1G; do | |||
98 | awk '/rekeylimit/{print $3}'` | 131 | awk '/rekeylimit/{print $3}'` |
99 | 132 | ||
100 | if [ "$bytes" != "$b" ]; then | 133 | if [ "$bytes" != "$b" ]; then |
101 | fatal "rekeylimit size: expected $bytes got $b" | 134 | fatal "rekeylimit size: expected $bytes bytes got $b" |
102 | fi | 135 | fi |
103 | if [ "$seconds" != "$s" ]; then | 136 | if [ "$seconds" != "$s" ]; then |
104 | fatal "rekeylimit time: expected $time got $s" | 137 | fatal "rekeylimit time: expected $time seconds got $s" |
105 | fi | 138 | fi |
106 | done | 139 | done |
107 | done | 140 | done |
diff --git a/regress/scp-ssh-wrapper.sh b/regress/scp-ssh-wrapper.sh index d1005a995..c63bc2bc1 100644 --- a/regress/scp-ssh-wrapper.sh +++ b/regress/scp-ssh-wrapper.sh | |||
@@ -17,7 +17,7 @@ printname () { | |||
17 | } | 17 | } |
18 | 18 | ||
19 | # Discard all but last argument. We use arg later. | 19 | # Discard all but last argument. We use arg later. |
20 | while test "$1" != ""; do | 20 | while test "x$1" != "x"; do |
21 | arg="$1" | 21 | arg="$1" |
22 | shift | 22 | shift |
23 | done | 23 | done |
@@ -52,6 +52,8 @@ badserver_4) | |||
52 | echo "X" | 52 | echo "X" |
53 | ;; | 53 | ;; |
54 | *) | 54 | *) |
55 | exec $arg | 55 | set -- $arg |
56 | shift | ||
57 | exec $SCP "$@" | ||
56 | ;; | 58 | ;; |
57 | esac | 59 | esac |
diff --git a/regress/scp.sh b/regress/scp.sh index 29c5b35d4..c2da2a862 100644 --- a/regress/scp.sh +++ b/regress/scp.sh | |||
@@ -20,6 +20,7 @@ SRC=`dirname ${SCRIPT}` | |||
20 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp | 20 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp |
21 | chmod 755 ${OBJ}/scp-ssh-wrapper.scp | 21 | chmod 755 ${OBJ}/scp-ssh-wrapper.scp |
22 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.scp" | 22 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.scp" |
23 | export SCP # used in scp-ssh-wrapper.scp | ||
23 | 24 | ||
24 | scpclean() { | 25 | scpclean() { |
25 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} | 26 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} |
diff --git a/regress/setuid-allowed.c b/regress/setuid-allowed.c new file mode 100644 index 000000000..37b7dc8ad --- /dev/null +++ b/regress/setuid-allowed.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Damien Miller <djm@mindrot.org> | ||
3 | * | ||
4 | * Permission to use, copy, modify, and distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | /* $OpenBSD$ */ | ||
18 | |||
19 | #include "includes.h" | ||
20 | |||
21 | #include <sys/types.h> | ||
22 | #ifdef HAVE_SYS_STATVFS_H | ||
23 | # include <sys/statvfs.h> | ||
24 | #endif | ||
25 | #include <stdio.h> | ||
26 | #include <errno.h> | ||
27 | |||
28 | void | ||
29 | usage(void) | ||
30 | { | ||
31 | fprintf(stderr, "check-setuid [path]\n"); | ||
32 | exit(1); | ||
33 | } | ||
34 | |||
35 | int | ||
36 | main(int argc, char **argv) | ||
37 | { | ||
38 | const char *path = "."; | ||
39 | struct statvfs sb; | ||
40 | |||
41 | if (argc > 2) | ||
42 | usage(); | ||
43 | else if (argc == 2) | ||
44 | path = argv[1]; | ||
45 | |||
46 | if (statvfs(path, &sb) != 0) { | ||
47 | /* Don't return an error if the host doesn't support statvfs */ | ||
48 | if (errno == ENOSYS) | ||
49 | return 0; | ||
50 | fprintf(stderr, "statvfs for \"%s\" failed: %s\n", | ||
51 | path, strerror(errno)); | ||
52 | } | ||
53 | return (sb.f_flag & ST_NOSUID) ? 1 : 0; | ||
54 | } | ||
55 | |||
56 | |||
diff --git a/regress/sftp-perm.sh b/regress/sftp-perm.sh new file mode 100644 index 000000000..304ca0ac5 --- /dev/null +++ b/regress/sftp-perm.sh | |||
@@ -0,0 +1,269 @@ | |||
1 | # $OpenBSD: sftp-perm.sh,v 1.2 2013/10/17 22:00:18 djm Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="sftp permissions" | ||
5 | |||
6 | SERVER_LOG=${OBJ}/sftp-server.log | ||
7 | CLIENT_LOG=${OBJ}/sftp.log | ||
8 | TEST_SFTP_SERVER=${OBJ}/sftp-server.sh | ||
9 | |||
10 | prepare_server() { | ||
11 | printf "#!/bin/sh\nexec $SFTPSERVER -el debug3 $* 2>$SERVER_LOG\n" \ | ||
12 | > $TEST_SFTP_SERVER | ||
13 | chmod a+x $TEST_SFTP_SERVER | ||
14 | } | ||
15 | |||
16 | run_client() { | ||
17 | echo "$@" | ${SFTP} -D ${TEST_SFTP_SERVER} -vvvb - >$CLIENT_LOG 2>&1 | ||
18 | } | ||
19 | |||
20 | prepare_files() { | ||
21 | _prep="$1" | ||
22 | rm -f ${COPY} ${COPY}.1 | ||
23 | test -d ${COPY}.dd && { rmdir ${COPY}.dd || fatal "rmdir ${COPY}.dd"; } | ||
24 | test -z "$_prep" && return | ||
25 | sh -c "$_prep" || fail "preparation failed: \"$_prep\"" | ||
26 | } | ||
27 | |||
28 | postcondition() { | ||
29 | _title="$1" | ||
30 | _check="$2" | ||
31 | test -z "$_check" && return | ||
32 | ${TEST_SHELL} -c "$_check" || fail "postcondition check failed: $_title" | ||
33 | } | ||
34 | |||
35 | ro_test() { | ||
36 | _desc=$1 | ||
37 | _cmd="$2" | ||
38 | _prep="$3" | ||
39 | _expect_success_post="$4" | ||
40 | _expect_fail_post="$5" | ||
41 | verbose "$tid: read-only $_desc" | ||
42 | # Plain (no options, mostly to test that _cmd is good) | ||
43 | prepare_files "$_prep" | ||
44 | prepare_server | ||
45 | run_client "$_cmd" || fail "plain $_desc failed" | ||
46 | postcondition "$_desc no-readonly" "$_expect_success_post" | ||
47 | # Read-only enabled | ||
48 | prepare_files "$_prep" | ||
49 | prepare_server -R | ||
50 | run_client "$_cmd" && fail "read-only $_desc succeeded" | ||
51 | postcondition "$_desc readonly" "$_expect_fail_post" | ||
52 | } | ||
53 | |||
54 | perm_test() { | ||
55 | _op=$1 | ||
56 | _whitelist_ops=$2 | ||
57 | _cmd="$3" | ||
58 | _prep="$4" | ||
59 | _expect_success_post="$5" | ||
60 | _expect_fail_post="$6" | ||
61 | verbose "$tid: explicit $_op" | ||
62 | # Plain (no options, mostly to test that _cmd is good) | ||
63 | prepare_files "$_prep" | ||
64 | prepare_server | ||
65 | run_client "$_cmd" || fail "plain $_op failed" | ||
66 | postcondition "$_op no white/blacklists" "$_expect_success_post" | ||
67 | # Whitelist | ||
68 | prepare_files "$_prep" | ||
69 | prepare_server -p $_op,$_whitelist_ops | ||
70 | run_client "$_cmd" || fail "whitelisted $_op failed" | ||
71 | postcondition "$_op whitelisted" "$_expect_success_post" | ||
72 | # Blacklist | ||
73 | prepare_files "$_prep" | ||
74 | prepare_server -P $_op | ||
75 | run_client "$_cmd" && fail "blacklisted $_op succeeded" | ||
76 | postcondition "$_op blacklisted" "$_expect_fail_post" | ||
77 | # Whitelist with op missing. | ||
78 | prepare_files "$_prep" | ||
79 | prepare_server -p $_whitelist_ops | ||
80 | run_client "$_cmd" && fail "no whitelist $_op succeeded" | ||
81 | postcondition "$_op not in whitelist" "$_expect_fail_post" | ||
82 | } | ||
83 | |||
84 | ro_test \ | ||
85 | "upload" \ | ||
86 | "put $DATA $COPY" \ | ||
87 | "" \ | ||
88 | "cmp $DATA $COPY" \ | ||
89 | "test ! -f $COPY" | ||
90 | |||
91 | ro_test \ | ||
92 | "setstat" \ | ||
93 | "chmod 0700 $COPY" \ | ||
94 | "touch $COPY; chmod 0400 $COPY" \ | ||
95 | "test -x $COPY" \ | ||
96 | "test ! -x $COPY" | ||
97 | |||
98 | ro_test \ | ||
99 | "rm" \ | ||
100 | "rm $COPY" \ | ||
101 | "touch $COPY" \ | ||
102 | "test ! -f $COPY" \ | ||
103 | "test -f $COPY" | ||
104 | |||
105 | ro_test \ | ||
106 | "mkdir" \ | ||
107 | "mkdir ${COPY}.dd" \ | ||
108 | "" \ | ||
109 | "test -d ${COPY}.dd" \ | ||
110 | "test ! -d ${COPY}.dd" | ||
111 | |||
112 | ro_test \ | ||
113 | "rmdir" \ | ||
114 | "rmdir ${COPY}.dd" \ | ||
115 | "mkdir ${COPY}.dd" \ | ||
116 | "test ! -d ${COPY}.dd" \ | ||
117 | "test -d ${COPY}.dd" | ||
118 | |||
119 | ro_test \ | ||
120 | "posix-rename" \ | ||
121 | "rename $COPY ${COPY}.1" \ | ||
122 | "touch $COPY" \ | ||
123 | "test -f ${COPY}.1 -a ! -f $COPY" \ | ||
124 | "test -f $COPY -a ! -f ${COPY}.1" | ||
125 | |||
126 | ro_test \ | ||
127 | "oldrename" \ | ||
128 | "rename -l $COPY ${COPY}.1" \ | ||
129 | "touch $COPY" \ | ||
130 | "test -f ${COPY}.1 -a ! -f $COPY" \ | ||
131 | "test -f $COPY -a ! -f ${COPY}.1" | ||
132 | |||
133 | ro_test \ | ||
134 | "symlink" \ | ||
135 | "ln -s $COPY ${COPY}.1" \ | ||
136 | "touch $COPY" \ | ||
137 | "test -h ${COPY}.1" \ | ||
138 | "test ! -h ${COPY}.1" | ||
139 | |||
140 | ro_test \ | ||
141 | "hardlink" \ | ||
142 | "ln $COPY ${COPY}.1" \ | ||
143 | "touch $COPY" \ | ||
144 | "test -f ${COPY}.1" \ | ||
145 | "test ! -f ${COPY}.1" | ||
146 | |||
147 | # Test explicit permissions | ||
148 | |||
149 | perm_test \ | ||
150 | "open" \ | ||
151 | "realpath,stat,lstat,read,close" \ | ||
152 | "get $DATA $COPY" \ | ||
153 | "" \ | ||
154 | "cmp $DATA $COPY" \ | ||
155 | "! cmp $DATA $COPY 2>/dev/null" | ||
156 | |||
157 | perm_test \ | ||
158 | "read" \ | ||
159 | "realpath,stat,lstat,open,close" \ | ||
160 | "get $DATA $COPY" \ | ||
161 | "" \ | ||
162 | "cmp $DATA $COPY" \ | ||
163 | "! cmp $DATA $COPY 2>/dev/null" | ||
164 | |||
165 | perm_test \ | ||
166 | "write" \ | ||
167 | "realpath,stat,lstat,open,close" \ | ||
168 | "put $DATA $COPY" \ | ||
169 | "" \ | ||
170 | "cmp $DATA $COPY" \ | ||
171 | "! cmp $DATA $COPY 2>/dev/null" | ||
172 | |||
173 | perm_test \ | ||
174 | "lstat" \ | ||
175 | "realpath,stat,open,read,close" \ | ||
176 | "get $DATA $COPY" \ | ||
177 | "" \ | ||
178 | "cmp $DATA $COPY" \ | ||
179 | "! cmp $DATA $COPY 2>/dev/null" | ||
180 | |||
181 | perm_test \ | ||
182 | "opendir" \ | ||
183 | "realpath,readdir,stat,lstat" \ | ||
184 | "ls -ln $OBJ" | ||
185 | |||
186 | perm_test \ | ||
187 | "readdir" \ | ||
188 | "realpath,opendir,stat,lstat" \ | ||
189 | "ls -ln $OBJ" | ||
190 | |||
191 | perm_test \ | ||
192 | "setstat" \ | ||
193 | "realpath,stat,lstat" \ | ||
194 | "chmod 0700 $COPY" \ | ||
195 | "touch $COPY; chmod 0400 $COPY" \ | ||
196 | "test -x $COPY" \ | ||
197 | "test ! -x $COPY" | ||
198 | |||
199 | perm_test \ | ||
200 | "remove" \ | ||
201 | "realpath,stat,lstat" \ | ||
202 | "rm $COPY" \ | ||
203 | "touch $COPY" \ | ||
204 | "test ! -f $COPY" \ | ||
205 | "test -f $COPY" | ||
206 | |||
207 | perm_test \ | ||
208 | "mkdir" \ | ||
209 | "realpath,stat,lstat" \ | ||
210 | "mkdir ${COPY}.dd" \ | ||
211 | "" \ | ||
212 | "test -d ${COPY}.dd" \ | ||
213 | "test ! -d ${COPY}.dd" | ||
214 | |||
215 | perm_test \ | ||
216 | "rmdir" \ | ||
217 | "realpath,stat,lstat" \ | ||
218 | "rmdir ${COPY}.dd" \ | ||
219 | "mkdir ${COPY}.dd" \ | ||
220 | "test ! -d ${COPY}.dd" \ | ||
221 | "test -d ${COPY}.dd" | ||
222 | |||
223 | perm_test \ | ||
224 | "posix-rename" \ | ||
225 | "realpath,stat,lstat" \ | ||
226 | "rename $COPY ${COPY}.1" \ | ||
227 | "touch $COPY" \ | ||
228 | "test -f ${COPY}.1 -a ! -f $COPY" \ | ||
229 | "test -f $COPY -a ! -f ${COPY}.1" | ||
230 | |||
231 | perm_test \ | ||
232 | "rename" \ | ||
233 | "realpath,stat,lstat" \ | ||
234 | "rename -l $COPY ${COPY}.1" \ | ||
235 | "touch $COPY" \ | ||
236 | "test -f ${COPY}.1 -a ! -f $COPY" \ | ||
237 | "test -f $COPY -a ! -f ${COPY}.1" | ||
238 | |||
239 | perm_test \ | ||
240 | "symlink" \ | ||
241 | "realpath,stat,lstat" \ | ||
242 | "ln -s $COPY ${COPY}.1" \ | ||
243 | "touch $COPY" \ | ||
244 | "test -h ${COPY}.1" \ | ||
245 | "test ! -h ${COPY}.1" | ||
246 | |||
247 | perm_test \ | ||
248 | "hardlink" \ | ||
249 | "realpath,stat,lstat" \ | ||
250 | "ln $COPY ${COPY}.1" \ | ||
251 | "touch $COPY" \ | ||
252 | "test -f ${COPY}.1" \ | ||
253 | "test ! -f ${COPY}.1" | ||
254 | |||
255 | perm_test \ | ||
256 | "statvfs" \ | ||
257 | "realpath,stat,lstat" \ | ||
258 | "df /" | ||
259 | |||
260 | # XXX need good tests for: | ||
261 | # fstat | ||
262 | # fsetstat | ||
263 | # realpath | ||
264 | # stat | ||
265 | # readlink | ||
266 | # fstatvfs | ||
267 | |||
268 | rm -rf ${COPY} ${COPY}.1 ${COPY}.dd | ||
269 | |||
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index eee446264..aac8aa5c2 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.46 2013/06/21 02:26:26 djm Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.47 2013/11/09 05:41:34 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | #SUDO=sudo | 4 | #SUDO=sudo |
@@ -133,7 +133,12 @@ fi | |||
133 | # Path to sshd must be absolute for rexec | 133 | # Path to sshd must be absolute for rexec |
134 | case "$SSHD" in | 134 | case "$SSHD" in |
135 | /*) ;; | 135 | /*) ;; |
136 | *) SSHD=`which sshd` ;; | 136 | *) SSHD=`which $SSHD` ;; |
137 | esac | ||
138 | |||
139 | case "$SSHAGENT" in | ||
140 | /*) ;; | ||
141 | *) SSHAGENT=`which $SSHAGENT` ;; | ||
137 | esac | 142 | esac |
138 | 143 | ||
139 | # Logfiles. | 144 | # Logfiles. |
@@ -166,14 +171,22 @@ SSH="$SSHLOGWRAP" | |||
166 | 171 | ||
167 | # Some test data. We make a copy because some tests will overwrite it. | 172 | # Some test data. We make a copy because some tests will overwrite it. |
168 | # The tests may assume that $DATA exists and is writable and $COPY does | 173 | # The tests may assume that $DATA exists and is writable and $COPY does |
169 | # not exist. | 174 | # not exist. Tests requiring larger data files can call increase_datafile_size |
175 | # [kbytes] to ensure the file is at least that large. | ||
170 | DATANAME=data | 176 | DATANAME=data |
171 | DATA=$OBJ/${DATANAME} | 177 | DATA=$OBJ/${DATANAME} |
172 | cat $SSHD $SSHD $SSHD $SSHD >${DATA} | 178 | cat ${SSHAGENT} >${DATA} |
173 | chmod u+w ${DATA} | 179 | chmod u+w ${DATA} |
174 | COPY=$OBJ/copy | 180 | COPY=$OBJ/copy |
175 | rm -f ${COPY} | 181 | rm -f ${COPY} |
176 | 182 | ||
183 | increase_datafile_size() | ||
184 | { | ||
185 | while [ `du -k ${DATA} | cut -f1` -lt $1 ]; do | ||
186 | cat ${SSHAGENT} >>${DATA} | ||
187 | done | ||
188 | } | ||
189 | |||
177 | # these should be used in tests | 190 | # these should be used in tests |
178 | export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP | 191 | export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP |
179 | #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP | 192 | #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP |
diff --git a/regress/try-ciphers.sh b/regress/try-ciphers.sh index e17c9f5e9..ac34cedbf 100644 --- a/regress/try-ciphers.sh +++ b/regress/try-ciphers.sh | |||
@@ -1,37 +1,22 @@ | |||
1 | # $OpenBSD: try-ciphers.sh,v 1.20 2013/05/17 10:16:26 dtucker Exp $ | 1 | # $OpenBSD: try-ciphers.sh,v 1.22 2013/11/21 03:18:51 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="try ciphers" | 4 | tid="try ciphers" |
5 | 5 | ||
6 | ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc | 6 | for c in `${SSH} -Q cipher`; do |
7 | arcfour128 arcfour256 arcfour | ||
8 | aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se | ||
9 | aes128-ctr aes192-ctr aes256-ctr" | ||
10 | config_defined OPENSSL_HAVE_EVPGCM && \ | ||
11 | ciphers="$ciphers aes128-gcm@openssh.com aes256-gcm@openssh.com" | ||
12 | macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com | ||
13 | hmac-sha1-96 hmac-md5-96 | ||
14 | hmac-sha1-etm@openssh.com hmac-md5-etm@openssh.com | ||
15 | umac-64-etm@openssh.com umac-128-etm@openssh.com | ||
16 | hmac-sha1-96-etm@openssh.com hmac-md5-96-etm@openssh.com | ||
17 | hmac-ripemd160-etm@openssh.com" | ||
18 | config_defined HAVE_EVP_SHA256 && | ||
19 | macs="$macs hmac-sha2-256 hmac-sha2-512 | ||
20 | hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com" | ||
21 | |||
22 | for c in $ciphers; do | ||
23 | n=0 | 7 | n=0 |
24 | for m in $macs; do | 8 | for m in `${SSH} -Q mac`; do |
25 | trace "proto 2 cipher $c mac $m" | 9 | trace "proto 2 cipher $c mac $m" |
26 | verbose "test $tid: proto 2 cipher $c mac $m" | 10 | verbose "test $tid: proto 2 cipher $c mac $m" |
27 | ${SSH} -F $OBJ/ssh_proxy -2 -m $m -c $c somehost true | 11 | ${SSH} -F $OBJ/ssh_proxy -2 -m $m -c $c somehost true |
28 | if [ $? -ne 0 ]; then | 12 | if [ $? -ne 0 ]; then |
29 | fail "ssh -2 failed with mac $m cipher $c" | 13 | fail "ssh -2 failed with mac $m cipher $c" |
30 | fi | 14 | fi |
31 | # No point trying all MACs for GCM since they are ignored. | 15 | # No point trying all MACs for AEAD ciphers since they |
32 | case $c in | 16 | # are ignored. |
33 | aes*-gcm@openssh.com) test $n -gt 0 && break;; | 17 | if ssh -Q cipher-auth | grep "^${c}\$" >/dev/null 2>&1 ; then |
34 | esac | 18 | break |
19 | fi | ||
35 | n=`expr $n + 1` | 20 | n=`expr $n + 1` |
36 | done | 21 | done |
37 | done | 22 | done |