[PATCH 1/1] make the systemd unit example more general

Jason A. Donenfeld Jason at zx2c4.com
Thu Dec 8 13:48:13 CET 2016


On Thu, Dec 8, 2016 at 12:33 PM, Christian Hesse <list at eworm.de> wrote:
> "Jason A. Donenfeld" <Jason at zx2c4.com> on Thu, 2016/12/08 12:18:
>> I like this, but two questions.
>>
>> 1. Why did you get rid of the ExecStop config saving line?
>
> I do not like units altering configuration. If you want to save configuration
> on stop create a second unit with correct dependencies an ordering that
> writes the configuration.

That's fair. Want to submit a v2, then, with a shutdown unit too?
(By the way, please prefix the commit message with "contrib: ".)

> Not sure about that. :-p At least I left it in examples directory. ;)
>
> In first place this is a RFC. Nevertheless we should polish things a bit and
> provide a usable systemd unit.

Alright then. By the way, there's some work upstream with systemd to
include this in systemd-networkd, which would probably be the "more
correct" way of doing it. But I guess a unit would nonetheless be
useful for folks who don't use systemd-networkd.

>
> I still do not like to have two files that hold the settings... But no idea
> how to get rid of that in a clean way. Having shell code in a systemd unit is
> even worse...

Yea, it's not nice. There's some additional logic: adding allowed-ips
to routes for the device, if the allowed-ips aren't already included
in the device's address prefix route.

I've thought about just adding this to `wg(8)` itself, and letting it
be specified in the config file. This would indeed be _nice_, but it
still seems like the wrong place to be doing these things. Maybe it'd
be useful to have an extra shell-script in contrib called wg-config.sh
that takes a device name, a `wg(8)`, config file, a list of IPs given
by --address=, a list of additional routes given by --route=, and the
ability to disable auto-route-from-allowed-ips-adding via
--no-auto-routes. Maybe I'll code this up myself -- it should only
take a few minutes to do...


More information about the WireGuard mailing list