Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 477248 - net-misc/openvpn - systemd unit improvements
Summary: net-misc/openvpn - systemd unit improvements
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Dirkjan Ochtman (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-07-17 20:14 UTC by Malte Starostik
Modified: 2014-07-03 07:34 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
proposed openvpn@.service change (openvpn.service.diff,514 bytes, patch)
2013-07-17 20:15 UTC, Malte Starostik
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Malte Starostik 2013-07-17 20:14:26 UTC
As a folow up to #448884, here is another take at a service unit for openvpn: For whatever reason the unit currently shipped uses Type=forking and the PID file that goes with it, although systemd's design discourages this and openvpn easily allows for the service not to daemonise itself.
The attached patch changes the unit to have systemd handle all supervision, gets rid of the PID file and also uses systemd to setup the working directory for openvpn.
The tmpfile added in #448884 to create /var/run/openvpn is rendered obsolete by removing the PID file.

TIA for considering

Reproducible: Always
Comment 1 Malte Starostik 2013-07-17 20:15:06 UTC
Created attachment 353538 [details, diff]
proposed openvpn@.service change
Comment 2 Alexander Tsoy 2013-07-18 12:32:30 UTC
Also it would be nice to have support for up.sh/down.sh scripts.
Comment 3 Malte Starostik 2013-07-18 13:22:51 UTC
Right. As a starting point, I use this one on client machines:

ExecStart=/usr/sbin/openvpn --config "/etc/openvpn/%I.conf" --up-delay --up-restart --script-security 2 --up /etc/openvpn/up.sh --down-pre --down /etc/openvpn/down.sh --setenv PEER_DNS yes

That basically adapts the client branch (i.e. if PEER_DNS is "yes") in the openrc init script, it's not the way to go for servers.
Comment 4 Peter Volkov (RETIRED) gentoo-dev 2014-07-01 11:38:32 UTC
Alexander, I think it's better to keep up.sh/down.sh support our of unit file and use --up/--down config file options. Calling scripts requires higher value script-security and thus our installation will be less restrictive by default. Agree?

Malte, as for other systemd improvements. Fedora and arch[1] have same systemd unit files. Are there any real benefits behind these improvements? If not I'd better stay with something everybody use (to ease maintaining).


So I'm inclined to close this bug as WORKSFORME until something really worth to improve will be found.

[1] https://projects.archlinux.org/svntogit/packages.git/tree/trunk/openvpn@.service?h=packages/openvpn



P.S. I suggest to add patch from bug #515982 to improve openvpn handling in Gentoo with systemd.
Comment 5 Malte Starostik 2014-07-01 11:55:14 UTC
Sure thing, if the unit file is more uniform accross distributions that way, I'm all in favour of that.  Still wondering why there are quite a few units in distros as well as upstream that use forking when a non-forking solution is just as easy or even less cluttered with options, pid files etc.  Maybe just a matter of habit.  Anyway, I guess having consistent units is a Good Thing, too.
Comment 6 Alexander Tsoy 2014-07-01 13:12:47 UTC
(In reply to Peter Volkov from comment #4)
> Alexander, I think it's better to keep up.sh/down.sh support our of unit
> file and use --up/--down config file options. Calling scripts requires
> higher value script-security and thus our installation will be less
> restrictive by default. Agree?

Agreed. We should not bloat the unit file. I totally forgot that these options can be added to config file. :)
Comment 7 Peter Volkov (RETIRED) gentoo-dev 2014-07-03 07:34:59 UTC
Great that we discussed this then and found comprise. Closing.