All of lore.kernel.org
 help / color / mirror / Atom feed
* [WireGuard] Comments on wgserver.service
@ 2016-07-06 12:04 Bruno Wolff III
  2016-07-06 14:33 ` Jason A. Donenfeld
  0 siblings, 1 reply; 7+ messages in thread
From: Bruno Wolff III @ 2016-07-06 12:04 UTC (permalink / raw)
  To: WireGuard

While wgserver.service is going to need some customization for each 
instance, there are a couple of things you might want to change in the 
example.

If for whatever reason wgserver is left setup, starting and restarting 
the service will fail until the device is manually removed.
Adding the following as the first ExecStart will help:
ExecStart=-/bin/ip link del dev wgserver
That will attempt to clean up any left over device as part of the 
startup process. Which will keep:
ExecStartPre=/usr/sbin/ip link add dev wg0 type wireguard
from failing (exit status 2 if the device already exists) and aborting 
the service startup.

Also according to the systemd documentation, ExecStopPost commands are 
supposed to be run when starting fails. It doesn't seem to actually work 
this way on Fedora and I have filed a bug about it. But it may still 
be better to change:
ExecStop=/bin/ip link del dev wgserver
To:
ExecStopPost=/bin/ip link del dev wgserver

Another note, that I'm not sure there is a standard fix for, but might 
be worth throwing in something for, is that if your config has a host 
name in it, you need functioning DNS when the service starts. And hence 
one may want to add Requires= and After= for a DNS service in some cases.

The example was helpful to me in figuring out the service files I am 
actually using on my two endpoints.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-07-06 15:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06 12:04 [WireGuard] Comments on wgserver.service Bruno Wolff III
2016-07-06 14:33 ` Jason A. Donenfeld
2016-07-06 15:19   ` Bruno Wolff III
2016-07-06 15:22     ` Jason A. Donenfeld
2016-07-06 15:47       ` Bruno Wolff III
2016-07-06 15:58         ` Jason A. Donenfeld
2016-07-06 15:28   ` Daniel Kahn Gillmor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.