Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 222461 - net-misc/openvpn initscript client detection improvement
Summary: net-misc/openvpn initscript client detection improvement
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Cédric Krier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-17 03:45 UTC by Josh Cepek
Modified: 2008-05-18 20:58 UTC (History)
0 users

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


Attachments
droppriv-config improvement patch (openvpn-droppriv-config.patch,1.27 KB, patch)
2008-05-17 03:46 UTC, Josh Cepek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Cepek 2008-05-17 03:45:14 UTC
In the initscript for OpenVPN the user privileges are dropped to the "openvpn" user if it is determined that the config is not a client and a user/group was not specified in the config file. However, if DETECT_CLIENT is set to no in the conf.d/openvpn file, the current initscript enables the user privilege downgrade anyway without first checking if the config looks like a server.

The patch below adds logic to the privilege downgrade to verify that the config looks like a server and adds a test so the privilege downgrade can be overridden through the conf.d/openvpn file. While the override isn't strictly necessary, I think it may be useful for sites that wish to disable privilege downgrading completely without having to specify a user/group of root in all config files.
Comment 1 Josh Cepek 2008-05-17 03:46:31 UTC
Created attachment 153391 [details, diff]
droppriv-config improvement patch

A patch for the files/ subdirectory of the ebuild as explained above
Comment 2 Cédric Krier gentoo-dev 2008-05-18 11:07:51 UTC
See bug#181000

If you are not in a client configuration, there is no need to have openvpn running with root privilege. So I don't think the patch is usefull and if you really want to have root user, you can put it in the configuration file.
Comment 3 Josh Cepek 2008-05-18 19:03:27 UTC
Thanks for the reference bug.

You correctly point out (as I did above), a user and group of root can be specified in the OpenVPN config files if really required. In some instances where I use OpenVPN under Gentoo, a mixture of both client and server configurations run at the same time. In these cases having the master OpenVPN script (which all others are symlinked to) decide that when DETECT_CLIENT is set to no that the privilege downgrade will occur anyway is a behavior that I don't want or expect. This means that even client configurations end up having permissions downgraded to the openvpn user, causing the Gentoo up/down scripts to fail.

The patch I've proposed will keep the current behavior as a default, but provides an important test for people that do choose to disable the client detection through the DETECT_CLIENT variable. As I mentioned in Comment #1, the addition of the DROPPRIV_SERVER variable could be omitted if it doesn't seem as useful, but having the 'else' statement alone on line 104 of the current initscript is indeed a bug reproducible by enabling DETECT_CLIENT in conf.d/openvpn and starting a client instance. Are people who use these combination of settings supposed to set the root user/group as well as call the Gentoo-specific up/down scripts in all client configurations?
Comment 4 Josh Cepek 2008-05-18 19:16:28 UTC
In follow-up to Comment #3, it seems this isn't actually an issue since any initscripts that are symlinked to the master openvpn script don't source the /etc/conf.d/openvpn file (which I assumed they did like the net.* scripts.) This means that users wishing to disable DETECT_CLIENT for a particular configuration won't suffer from this problem when calling other initscripts; other symlinked initscripts source the symlinked name from conf.d/ instead, allowing DETECT_CLIENT to be set to yes as a default.
Comment 5 Cédric Krier gentoo-dev 2008-05-18 20:58:33 UTC
And for me, it is a good behavior to drop the privilege of such services by default if the user didn't specify something.