diff options
Diffstat (limited to 'regress/rekey.sh')
-rw-r--r-- | regress/rekey.sh | 103 |
1 files changed, 90 insertions, 13 deletions
diff --git a/regress/rekey.sh b/regress/rekey.sh index 3c5f266fc..8eb7efaf9 100644 --- a/regress/rekey.sh +++ b/regress/rekey.sh | |||
@@ -1,23 +1,18 @@ | |||
1 | # $OpenBSD: rekey.sh,v 1.1 2003/03/28 13:58:28 markus Exp $ | 1 | # $OpenBSD: rekey.sh,v 1.8 2013/05/17 04:29:14 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="rekey during transfer data" | 4 | tid="rekey" |
5 | 5 | ||
6 | DATA=${OBJ}/data | 6 | LOG=${TEST_SSH_LOGFILE} |
7 | COPY=${OBJ}/copy | ||
8 | LOG=${OBJ}/log | ||
9 | 7 | ||
10 | rm -f ${COPY} ${LOG} ${DATA} | 8 | rm -f ${LOG} |
11 | touch ${DATA} | ||
12 | dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1 | ||
13 | 9 | ||
14 | for s in 16 1k 128k 256k; do | 10 | for s in 16 1k 128k 256k; do |
15 | trace "rekeylimit ${s}" | 11 | verbose "client rekeylimit ${s}" |
16 | rm -f ${COPY} | 12 | rm -f ${COPY} ${LOG} |
17 | cat $DATA | \ | 13 | cat $DATA | \ |
18 | ${SSH} -oCompression=no -oRekeyLimit=$s \ | 14 | ${SSH} -oCompression=no -oRekeyLimit=$s \ |
19 | -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" \ | 15 | -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" |
20 | 2> ${LOG} | ||
21 | if [ $? -ne 0 ]; then | 16 | if [ $? -ne 0 ]; then |
22 | fail "ssh failed" | 17 | fail "ssh failed" |
23 | fi | 18 | fi |
@@ -29,4 +24,86 @@ for s in 16 1k 128k 256k; do | |||
29 | fail "no rekeying occured" | 24 | fail "no rekeying occured" |
30 | fi | 25 | fi |
31 | done | 26 | done |
32 | rm -f ${COPY} ${LOG} ${DATA} | 27 | |
28 | for s in 5 10; do | ||
29 | verbose "client rekeylimit default ${s}" | ||
30 | rm -f ${COPY} ${LOG} | ||
31 | cat $DATA | \ | ||
32 | ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \ | ||
33 | $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3" | ||
34 | if [ $? -ne 0 ]; then | ||
35 | fail "ssh failed" | ||
36 | fi | ||
37 | cmp $DATA ${COPY} || fail "corrupted copy" | ||
38 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` | ||
39 | n=`expr $n - 1` | ||
40 | trace "$n rekeying(s)" | ||
41 | if [ $n -lt 1 ]; then | ||
42 | fail "no rekeying occured" | ||
43 | fi | ||
44 | done | ||
45 | |||
46 | for s in 5 10; do | ||
47 | verbose "client rekeylimit default ${s} no data" | ||
48 | rm -f ${COPY} ${LOG} | ||
49 | ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \ | ||
50 | $OBJ/ssh_proxy somehost "sleep $s;sleep 3" | ||
51 | if [ $? -ne 0 ]; then | ||
52 | fail "ssh failed" | ||
53 | fi | ||
54 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` | ||
55 | n=`expr $n - 1` | ||
56 | trace "$n rekeying(s)" | ||
57 | if [ $n -lt 1 ]; then | ||
58 | fail "no rekeying occured" | ||
59 | fi | ||
60 | done | ||
61 | |||
62 | echo "rekeylimit default 5" >>$OBJ/sshd_proxy | ||
63 | for s in 5 10; do | ||
64 | verbose "server rekeylimit default ${s} no data" | ||
65 | rm -f ${COPY} ${LOG} | ||
66 | ${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 3" | ||
67 | if [ $? -ne 0 ]; then | ||
68 | fail "ssh failed" | ||
69 | fi | ||
70 | n=`grep 'NEWKEYS sent' ${LOG} | wc -l` | ||
71 | n=`expr $n - 1` | ||
72 | trace "$n rekeying(s)" | ||
73 | if [ $n -lt 1 ]; then | ||
74 | fail "no rekeying occured" | ||
75 | fi | ||
76 | done | ||
77 | |||
78 | verbose "rekeylimit parsing" | ||
79 | for size in 16 1k 1K 1m 1M 1g 1G; do | ||
80 | for time in 1 1m 1M 1h 1H 1d 1D 1w 1W; do | ||
81 | case $size in | ||
82 | 16) bytes=16 ;; | ||
83 | 1k|1K) bytes=1024 ;; | ||
84 | 1m|1M) bytes=1048576 ;; | ||
85 | 1g|1G) bytes=1073741824 ;; | ||
86 | esac | ||
87 | case $time in | ||
88 | 1) seconds=1 ;; | ||
89 | 1m|1M) seconds=60 ;; | ||
90 | 1h|1H) seconds=3600 ;; | ||
91 | 1d|1D) seconds=86400 ;; | ||
92 | 1w|1W) seconds=604800 ;; | ||
93 | esac | ||
94 | |||
95 | b=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \ | ||
96 | awk '/rekeylimit/{print $2}'` | ||
97 | s=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \ | ||
98 | awk '/rekeylimit/{print $3}'` | ||
99 | |||
100 | if [ "$bytes" != "$b" ]; then | ||
101 | fatal "rekeylimit size: expected $bytes got $b" | ||
102 | fi | ||
103 | if [ "$seconds" != "$s" ]; then | ||
104 | fatal "rekeylimit time: expected $time got $s" | ||
105 | fi | ||
106 | done | ||
107 | done | ||
108 | |||
109 | rm -f ${COPY} ${DATA} | ||