Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log handshake keys into a keylog file to allow WireGuard traffic decryption with Wireshark #427

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ntqbit
Copy link

@ntqbit ntqbit commented Jan 8, 2025

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-cli was added: keylog, can be set with WGKEYLOGFILE environment variable. Specifies the path to the key lof file.
  • A public set_handshake_keys_listener method was added to Tunn, that allows to set HandshakeKeysListener, that is called once handshake is completed, with the handshake keys passed to it as argument. The public method allows users of boringtun crate to extract handshake keys.

I made sure that there were no breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant