-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Add namespace support to Wireguard module #71510
Conversation
Tested on nixos-unstable (cherry-picked onto I am successfully using this PR to spawn a wireguard device with the socket end in a "physical" namespace, and the interface end in the "init" namespace as described here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me on nixos-unstable - thanks for this! - I was looking at adding it myself sometime this weekend.
cc @zx2c4 regarding user-interface & documentation of this feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested it yet but the implementation and the configuration interface looks straightforward and understandable to me.
bd02f68
to
0cfcea6
Compare
Added a few tests around namespaces. |
The two new options make it possible to create the interface in one namespace and move it to a different one, as explained at https://www.wireguard.com/netns/.
Renamed the options:
The naming comes from @zx2c4 himself, and trades visual descriptiveness for technical accuracy. |
Motivation for this change
Adds support for creating a Wireguard interface in a network namesapce, or moving it post-creation.
inspired by this unmerged PR, which only allowed specifying a destination namespace to move the Wireguard interface to, whereas this PR also allows specifying where the interface should be created in the first place, so that both the usecases outlined here can be supported.
Things to note:
Pre
/Post
directives)init
string to mean "move the interface back to the init namespace"No additional tests. Happy to write some, but wanted to receive feedback on the general approach first.Tests added.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @fpletz @Mic92 @globin @zx2c4