1 # $OpenBSD: rekey.sh,v 1.8 2013/05/17 04:29:14 dtucker Exp $
2 # Placed in the Public Domain.
6 LOG=${TEST_SSH_LOGFILE}
10 for s in 16 1k 128k 256k; do
11 verbose "client rekeylimit ${s}"
14 ${SSH} -oCompression=no -oRekeyLimit=$s \
15 -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}"
19 cmp $DATA ${COPY} || fail "corrupted copy"
20 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
22 trace "$n rekeying(s)"
24 fail "no rekeying occured"
29 verbose "client rekeylimit default ${s}"
32 ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
33 $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3"
37 cmp $DATA ${COPY} || fail "corrupted copy"
38 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
40 trace "$n rekeying(s)"
42 fail "no rekeying occured"
47 verbose "client rekeylimit default ${s} no data"
49 ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
50 $OBJ/ssh_proxy somehost "sleep $s;sleep 3"
54 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
56 trace "$n rekeying(s)"
58 fail "no rekeying occured"
62 echo "rekeylimit default 5" >>$OBJ/sshd_proxy
64 verbose "server rekeylimit default ${s} no data"
66 ${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 3"
70 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
72 trace "$n rekeying(s)"
74 fail "no rekeying occured"
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
84 1m|1M) bytes=1048576 ;;
85 1g|1G) bytes=1073741824 ;;
90 1h|1H) seconds=3600 ;;
91 1d|1D) seconds=86400 ;;
92 1w|1W) seconds=604800 ;;
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}'`
100 if [ "$bytes" != "$b" ]; then
101 fatal "rekeylimit size: expected $bytes got $b"
103 if [ "$seconds" != "$s" ]; then
104 fatal "rekeylimit time: expected $time got $s"
109 rm -f ${COPY} ${DATA}