-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nixos/wireguard: Add dynamicEndpointRefreshSeconds
option
#121331
nixos/wireguard: Add dynamicEndpointRefreshSeconds
option
#121331
Conversation
Standard best-practice shell quoting, which can prevent the most horrible production accidents. Note that we cannot use `+ optionalString someBool '' someString''` because Nix's multi-line ''double-quoted'' strings remove leading whitespace.
dynamicEndpointRefreshSeconds
optiondynamicEndpointRefreshSeconds
option
The feature is great, but turning the regular oneshot service into |
@peterhoeg I am not in favour of it, because timers + oneshot do not work well with reliable automation:
That surprises me a bit -- I found it quite sensible that a "do it once" configuration turns into a |
@peterhoeg I am not in favour of it, because timers + oneshot do not work well with reliable automation:
That surprises me a bit -- I found it quite sensible that a "do it once" configuration turns into a We could make a separate |
Diff LGTM. Excellent documentation! |
dynamicEndpointRefreshSeconds
optiondynamicEndpointRefreshSeconds
option
51f8edd
to
83ed11c
Compare
I've force-pushed out the timer, which was superfluous from my preivous implementation. |
83ed11c
to
0da7487
Compare
I have implemented this with the last force-push; the service is now suffixed |
Motivation for this change
Implements refreshing the IP of DNS-based endpoints periodically, which WireGuard itself cannot do. It only does it once at the beginning when the
wg
utility is invoked.See also ArchWiki: Endpoint with changing IP
Those also mention a script called
reresolve-dns
that is included in WireGuard's examples folder (but not packaged in nixpkgs); however, that does some pretty ugly shell-based config file parsing, and it is much cleaner to just periodically execute thewg set wg0 peer
command we already construct in the module for initial setup.Also included:
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)