boringtun
boringtun copied to clipboard
Log handshake keys into a keylog file to allow WireGuard traffic decryption with Wireshark
This pull request implements logging of handshake wireguard keys into a file compatible with WireShark's key log file for WireGuard protocol, allowing to decrypt WireGuard traffic in Wireshark.
WireShark allows to decrypt WireGuard traffic given a keylog file in the following format:
LOCAL_STATIC_PRIVATE_KEY = QChaGDXeH3eQsbFAhueUNWFdq9KfpF3yl+eITjZbXEk=
REMOTE_STATIC_PUBLIC_KEY = HzgTY6aWXtuSyW/PUquZtg8LB/DyMwEXGkPiEmdSsUU=
LOCAL_EPHEMERAL_PRIVATE_KEY = UNGdRHuKDeqbFvmiV5FD4wP7a8PqI6v3Xnnz6Jc6NXQ=
PRESHARED_KEY = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
More about WireGuard decryption in Wireshark: https://wiki.wireshark.org/WireGuard
Checklist
- A new option for
boringtun-cliwas added:keylog, can be set withWGKEYLOGFILEenvironment variable. Specifies the path to the key lof file. - A public
set_handshake_keys_listenermethod was added toTunn, that allows to setHandshakeKeysListener, that is called once handshake is completed, with the handshake keys passed to it as argument. The public method allows users ofboringtuncrate to extract handshake keys.
I made sure that there were no breaking changes.