Repository navigation
feat(vpn): add a preshared key to the cluster VPN - #1441
Draft
gsanchietti wants to merge 1 commit into
Draft
gsanchietti wants to merge 1 commit into
gsanchietti wants to merge 1 commit into
Conversation
A WireGuard preshared key mixed into the handshake protects recorded cluster VPN traffic against a future quantum computer. The leader keeps one preshared key for the whole cluster, in /etc/nethserver/wg0.psk (mode 600) and in Redis at private/nodes/vpn_psk. create-cluster makes it; add-node makes it if missing. A joining node asks for it with the new add-node input vpn_psk, gets it as vpn_preshared_key and writes it in its first wg0.conf. add-node marks the node with "psk" in node/<id>/vpn. apply-vpn-routes reads the replica as the cluster user, writes the key file from Redis if it is missing or different (leader change), and sets the key on the links of flagged workers only. Nodes that do not ask for the key, like older workers and the NS7 migration tool, work as before. Assisted-by: Claude Code:claude-opus-5-5
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cluster VPN (
wg0) carries Redis, LDAP, logs and metrics in clear text inside the tunnel. A future quantum computer could decrypt recorded WireGuard traffic, because the tunnel keys are agreed with Curve25519 only. A WireGuard preshared key mixed into the handshake closes this gap. This PR adds it for nodes that join from now on.The leader keeps one preshared key for the whole cluster, handled like the WireGuard private key: a root-only file
/etc/nethserver/wg0.psk, plus a copy in Redis (private/nodes/vpn_psk) so a new leader can recreate it. A joining node asks for the key and receives it in the join reply. Nodes that do not ask for it, such as older workers and the NS7 migration tool, work as before. Existing nodes are not changed: that needs a later step with a short tunnel interruption.create-clustermakes the key;add-nodemakes it if missing, returns it when the input hasvpn_psk: true, and marks the node withpskinnode/<id>/vpn.join-clusterasks for the key;join-nodewrites it and addsPresharedKeyto the firstwg0.conf.apply-vpn-routesreads Redis as the localclusteruser, rewrites the key file if it is missing or different, and sets the key only on links to marked nodes.Known limit: the key is in the
add-nodetask output, which is not masked and stays in Redis for some hours. A possible fix is to let the new node read the key from Redis after replication starts.How to test
Tested so far on a single node with a fake node added and removed (key file, Redis copy, key on the link, restart, file rebuilt from Redis, removal). Still to test on a real cluster:
wg show wg0 preshared-keysshows a key on both ends; Redis replication works.Generated by Claude Code:claude-opus-5-5 with nethserver-pr