Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Nils Werner <nils.werner@audiolabs-erlangen.de>
To: <wireguard@lists.zx2c4.com>
Subject: wg-quick@.service argument prevents configs in non-standard locations
Date: Tue, 30 Aug 2022 14:07:01 +0200	[thread overview]
Message-ID: <b3f6decc-4622-a15c-dab6-57f58a5abcb7@audiolabs-erlangen.de> (raw)

Hi,

right now `wg-quick@.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@wg0

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

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

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

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.

Best
-- 
Nils Werner

                 reply	other threads:[~2022-09-04 16:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3f6decc-4622-a15c-dab6-57f58a5abcb7@audiolabs-erlangen.de \
    --to=nils.werner@audiolabs-erlangen.de \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).