2013-05-17 01:44:20 +02:00
|
|
|
# $OpenBSD: rekey.sh,v 1.6 2013/05/16 04:26:10 dtucker Exp $
|
2003-06-18 14:18:57 +02:00
|
|
|
# Placed in the Public Domain.
|
|
|
|
|
|
|
|
tid="rekey during transfer data"
|
|
|
|
|
|
|
|
DATA=${OBJ}/data
|
|
|
|
COPY=${OBJ}/copy
|
2013-05-17 01:19:10 +02:00
|
|
|
LOG=${TEST_SSH_LOGFILE}
|
2003-06-18 14:18:57 +02:00
|
|
|
|
|
|
|
rm -f ${COPY} ${LOG} ${DATA}
|
2004-12-20 02:35:42 +01:00
|
|
|
touch ${DATA}
|
2003-09-04 06:02:56 +02:00
|
|
|
dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1
|
2003-06-18 14:18:57 +02:00
|
|
|
|
|
|
|
for s in 16 1k 128k 256k; do
|
2013-05-17 01:44:20 +02:00
|
|
|
verbose "client rekeylimit ${s}"
|
2013-05-17 01:42:34 +02:00
|
|
|
rm -f ${COPY} ${LOG}
|
2003-06-18 14:18:57 +02:00
|
|
|
cat $DATA | \
|
|
|
|
${SSH} -oCompression=no -oRekeyLimit=$s \
|
2013-05-17 01:31:39 +02:00
|
|
|
-v -F $OBJ/ssh_proxy somehost "cat > ${COPY}"
|
2003-06-18 14:18:57 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "ssh failed"
|
|
|
|
fi
|
|
|
|
cmp $DATA ${COPY} || fail "corrupted copy"
|
|
|
|
n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
|
|
|
|
n=`expr $n - 1`
|
|
|
|
trace "$n rekeying(s)"
|
|
|
|
if [ $n -lt 1 ]; then
|
|
|
|
fail "no rekeying occured"
|
|
|
|
fi
|
|
|
|
done
|
2013-05-17 01:42:34 +02:00
|
|
|
|
2013-05-17 01:43:33 +02:00
|
|
|
for s in 5 10; do
|
2013-05-17 01:44:20 +02:00
|
|
|
verbose "client rekeylimit default ${s}"
|
2013-05-17 01:42:34 +02:00
|
|
|
rm -f ${COPY} ${LOG}
|
|
|
|
cat $DATA | \
|
|
|
|
${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
|
2013-05-17 01:43:33 +02:00
|
|
|
$OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3"
|
2013-05-17 01:42:34 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "ssh failed"
|
|
|
|
fi
|
|
|
|
cmp $DATA ${COPY} || fail "corrupted copy"
|
|
|
|
n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
|
|
|
|
n=`expr $n - 1`
|
|
|
|
trace "$n rekeying(s)"
|
|
|
|
if [ $n -lt 1 ]; then
|
|
|
|
fail "no rekeying occured"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-05-17 01:43:33 +02:00
|
|
|
for s in 5 10; do
|
2013-05-17 01:44:20 +02:00
|
|
|
verbose "client rekeylimit default ${s} no data"
|
2013-05-17 01:43:33 +02:00
|
|
|
rm -f ${COPY} ${LOG}
|
|
|
|
${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
|
|
|
|
$OBJ/ssh_proxy somehost "sleep $s;sleep 3"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "ssh failed"
|
|
|
|
fi
|
|
|
|
n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
|
|
|
|
n=`expr $n - 1`
|
|
|
|
trace "$n rekeying(s)"
|
|
|
|
if [ $n -lt 1 ]; then
|
|
|
|
fail "no rekeying occured"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-05-17 01:44:20 +02:00
|
|
|
echo "rekeylimit default 5" >>$OBJ/sshd_proxy
|
|
|
|
for s in 5 10; do
|
|
|
|
verbose "server rekeylimit default ${s} no data"
|
|
|
|
rm -f ${COPY} ${LOG}
|
|
|
|
${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 3"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "ssh failed"
|
|
|
|
fi
|
|
|
|
n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
|
|
|
|
n=`expr $n - 1`
|
|
|
|
trace "$n rekeying(s)"
|
|
|
|
if [ $n -lt 1 ]; then
|
|
|
|
fail "no rekeying occured"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-05-17 01:19:10 +02:00
|
|
|
rm -f ${COPY} ${DATA}
|