From: Mark Wooding Date: Wed, 1 Feb 2012 22:56:55 +0000 (+0000) Subject: server/tests.at: Test key exchange and retransmit with a flaky network. X-Git-Tag: 1.0.0pre11~2^2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/commitdiff_plain/f884ef9d0e31b0394b000b834d135f9c68cb0720 server/tests.at: Test key exchange and retransmit with a flaky network. Aha! A use for `tripe-mitm'! --- diff --git a/server/tests.at b/server/tests.at index b3e01a0e..19790a91 100644 --- a/server/tests.at +++ b/server/tests.at @@ -38,6 +38,7 @@ m4_define([TRIPE], $abs_top_builddir/server/tripe -F -d. -aadmin -p0 -b127.0.0.1 -talice]) m4_define([TRIPECTL], [$abs_top_builddir/client/tripectl -d. -aadmin]) m4_define([USLIP], [$abs_top_builddir/uslip/tripe-uslip]) +m4_define([MITM], [$abs_top_builddir/proxy/tripe-mitm]) ## Sequences. (These are used for testing the replay protection machinery.) m4_define([R32], [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 dnl @@ -361,6 +362,44 @@ WITH_2TRIPES([alice], [bob], [-nslip], [-talice], [-tbob], [ AT_CLEANUP +###-------------------------------------------------------------------------- +### Adverse communication. + +AT_SETUP([server retry]) +AT_KEYWORDS([backoff]) +export TRIPE_SLIPIF=USLIP + +for i in alice bob; do (mkdir $i; cd $i; SETUPDIR([dh])); done + +WITH_2TRIPES([alice], [bob], [-nslip], [-talice], [-tbob], [ + + ## Set up the evil proxy. + alicemitm=24516 bobmitm=14016 + MITM -kalice/keyring.pub >mitm.out 2>mitm.err \ + peer:alice:$alicemitm:127.0.0.1:$(cat alice/port) \ + peer:bob:$bobmitm:127.0.0.1:$(cat bob/port) \ + filt:drop:5 filt:send& mitmpid=$! + strace -omitm.trace -p$mitmpid& mitmtrace=$! + trap 'kill $mitmpid $mitmtrace; exit 127' EXIT INT QUIT TERM HUP + + ## Try to establish keys anyway. + AWAIT_KXDONE([alice], [alice], [bob], [bob], [ + AT_CHECK([TRIPECTL -dalice ADD -cork bob INET 127.0.0.1 $alicemitm]) + AT_CHECK([TRIPECTL -dbob ADD alice INET 127.0.0.1 $bobmitm]) + ]) + + ## Check pinging. + COMMS_EPING([alice], [alice], [bob], [bob], [10]) + COMMS_EPING([bob], [bob], [alice], [alice], [10]) + + ## Tear down the MITM proxy. + kill $mitmpid + wait $mitmpid + wait $mitmtrace +]) + +AT_CLEANUP + ###-------------------------------------------------------------------------- ### Services.