[PATCH] Adding support for reloading configuration via systemd

Tore Anderson tore at fud.no
Tue Jul 28 11:54:01 CEST 2020


* Jason A. Donenfeld

> On Mon, Jul 27, 2020 at 10:04 PM Tore Anderson <tore at fud.no> wrote:
> > Absolutely, a 'wg syncconf' wrapper is unable to fully implement every
> > conceivable change to the wg-quick config file. That said, 99.9% of my
> > configuration changes are additions/removal of [Peer] sections that 'wg
> > syncconf' do handle perfectly. Being able to add and remove individual
> > VPN users without disrupting the traffic of other unrelated users is a
> > really big win for me. I would imagine this to ability be highly
> > desirable for most other VPN server operators as well – even for those
> > that do not use systemd.
> 
> But for people shell scripting, can't they just use `wg syncconf
> wgnet0 <(wg-quick strip wgnet0)`, so that it's explicit what's
> happening?

Of course they can, just as they can opt to not use wg-quick at all.

However, it would be better, in my opinion, if every user do not have
to re-invent the wheel in order to accomplish common tasks, which (I
assume) is the reason why wg-quick – «an extremely simple script for
easily bringing up a WireGuard interface, suitable for a few common use
cases», to quote its manual page – exists in the first place.

> I'm still pretty hesitant for the reasons I outlined in the previous
> email. If anything, it'd probably have to be "syncpeers", but even
> then, it wouldn't update the routing information that wg-quick(8)
> sometimes does.

Fair enough. If you do not want it in wg-quick, I won't insist.

> The right thing to do for a `wg-quick reload` command
> would be to take into account all of the various other changes, and
> mutate them the minimal distance to reflect the updated config file.
> But this sounds pretty hard to do in bash. And that makes me worry
> about overall mission creep in wg-quick(8). syncconf in wg(8) is
> fairly simple, though still a bit verbose, but that's in C:
> https://git.zx2c4.com/wireguard-tools/tree/src/setconf.c#n30 . And
> there's a very clear way of doing this, whereas there are lots of
> weird edge cases when handling routing.

Agreed, this sounds very complex and not worth the trouble.

That said, I do believe that most admins would not be bothered by the
fact that some changes would require a restart (i.e., an wg-quick
up/down cycle). This limitation is common in other pieces of software
too, e.g., one can normally not use 'apachectl graceful' to make Apache
listen on a new port below 1024. However, in spite of it not being
perfect, 'apachectl graceful' remains extremely useful.

> Plus, how hard is it to add `wg syncconf wgnet0 <(wg-quick strip
> wgnet0)` to scripts?

Not hard - it is precisely what my patch did, after all.

Tore



More information about the WireGuard mailing list