wg-quick at .service argument prevents configs in non-standard locations

Nils Werner nils.werner at audiolabs-erlangen.de
Tue Aug 30 12:07:01 UTC 2022


right now `wg-quick at .service` uses the lines

     ExecStart=/usr/bin/wg-quick up %i
     ExecStop=/usr/bin/wg-quick down %i
     ExecReload=/bin/bash -c 'exec /usr/bin/wg syncconf %i <(exec 
/usr/bin/wg-quick strip %i)'

to interact with `wq-quick`.

The use of `%i` only allows the use of INTERFACE names, e.g.

     systemctl up wg-quick at wg0

but prevents users of passing CONFIG_FILE paths, e.g.

     systemctl up wg-quick at -home-me-configs-wg0.conf

because `-home-me-configs-wg0.conf` does not get unescaped to 

By replacing the first two lines with

     ExecStart=/usr/bin/wg-quick up %I
     ExecStop=/usr/bin/wg-quick down %I

would allow such usage.

The third line however is a bit tricky, as the argument to `wg syncconf` 
is expected to be an INTERFACE name, and the argument to `wg-quick 
strip` can also be a CONFIG_FILE path.

I am not sure how to solve the `ExecReload` argument issue, but I think 
having the option to also pass in CONFIG_FILE paths to the unit would be 
quite helpful.

Nils Werner

More information about the WireGuard mailing list