summaryrefslogtreecommitdiff
path: root/regress/rekey.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/rekey.sh')
-rw-r--r--regress/rekey.sh103
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
4tid="rekey during transfer data" 4tid="rekey"
5 5
6DATA=${OBJ}/data 6LOG=${TEST_SSH_LOGFILE}
7COPY=${OBJ}/copy
8LOG=${OBJ}/log
9 7
10rm -f ${COPY} ${LOG} ${DATA} 8rm -f ${LOG}
11touch ${DATA}
12dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1
13 9
14for s in 16 1k 128k 256k; do 10for 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
31done 26done
32rm -f ${COPY} ${LOG} ${DATA} 27
28for 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
44done
45
46for 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
60done
61
62echo "rekeylimit default 5" >>$OBJ/sshd_proxy
63for 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
76done
77
78verbose "rekeylimit parsing"
79for 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
107done
108
109rm -f ${COPY} ${DATA}