server/peer.c, etc.: Introduce who-goes-there protocol. mdw/wgt
authorMark Wooding <mdw@distorted.org.uk>
Mon, 20 Sep 2021 20:13:27 +0000 (21:13 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 30 Apr 2022 00:51:38 +0000 (01:51 +0100)
commit693588c0c399828e61728376aaebecd837dac2b2
tree7915d1098227bf403e0ede8364a7358ddc5cf761
parent18969e42a11e11ef8a3ea81eaf0038e8e74e004d
server/peer.c, etc.: Introduce who-goes-there protocol.

If a laptop (say) has been asleep for a short while, then its peer has
likely forgotten about it, but it will wait for a ping-timeout cycle
before attempting to reconnect.

Introduce a new protocol to speed this up.

  * When a packet which contains a ciphertext (e.g., `MSG_PACKET',
    `MISC_EPING') is received from an unknown sender, then send back a
    `MISC_WGT' (`who-goes-there') message quoting a prefix of the
    offending packet.  These are rate-limited so that TrIPE can't be
    used as an amplifier.  (Under adverse circumstances, we fall back to
    the old timeout mechanisms.)

  * When a `MISC_WGT' packet is received, we check to see whether the
    peer is configured with a `knock' string, and the quoted prefix
    matches a message we sent to that peer recently.  If so, we try to
    restart the key-exchange protocol.  Hence, an adversary who can't
    read the wire has very little chance of proviking a pointless
    key-exchange.  The 20 s cooling-off period still applies, so even an
    adversary who /can/ read the wire can't do too much harm.
common/protocol.h
server/peer.c
server/tests.at
server/tripe-admin.5.in
server/tripe.h
svc/connect.in
wireshark/tripe.lua