Now we don't necessarily need strace(1) installed at build time.
It's now the responsibility of `WITH_STRACE' to clear away the strace(1)
process if there is one. There's now too much process hierarchy in
between the wait and the child for us to wait on the proxy process
itself. It doesn't really matter much, fortunately.
## Set up the evil proxy.
alicemitm=24516 bobmitm=14016
## 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
+ mknod pipe-mitmpid p
+ WITH_STRACE([mitm],
+ [sh -c 'echo $$ >pipe-mitmpid; exec "$@"' - \
+ 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])&
+ read mitmpid <pipe-mitmpid
+ trap 'kill $mitmpid; exit 127' EXIT INT QUIT TERM HUP
+ exec 3>&-
## Try to establish keys anyway.
AWAIT_KXDONE([alice], [alice], [bob], [bob], [
## Try to establish keys anyway.
AWAIT_KXDONE([alice], [alice], [bob], [bob], [
## Tear down the MITM proxy.
kill $mitmpid
## Tear down the MITM proxy.
kill $mitmpid
- wait $mitmpid
- wait $mitmtrace