You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #373openfortivpn must be run with root privilege. There are multiples reasons for that. It would be worth re-investigating whether there are ways around that, or at least whether dropping root privilege after initial setup is a possibility, for example after spawning pppd.
Spawning pppd
Members of the dip group may run pppd on Linux distributions such as Debian or Ubuntu:
$ ls -l /usr/sbin/pppd
-rwsr-xr-- 1 root dip 395144 Feb 11 16:03 /usr/sbin/pppd
$
Yet openfortivpn requires root privilege because option noauth is privileged:
$ id -nG
[...] sudo dip plugdev [...]
$
$ pppd noauth
pppd: using the noauth option requires root privilege
$
Not sure how to work around this is an a generic way - apart from complex solutions such as splitting openfortivpn into multiple pieces of software with root privileges only the one spawning pppd.
Setting routes
The CAP_NET_ADMIN capability might be enough for ipv4_set_route() / ioctl():
I don't know how easy it is to manage capabilities (probably apply setcap to openfortivpn) and whether Linux distributions are willing to allow/manage capabilities.
In any case we could check either for rootgeteuid() == 0or the current process capabilities with something like prctl(PR_CAPBSET_READ, CAP_NET_ADMIN).
Alternatively routes might be handled outside of openfortivpn:
Routing can be handled by the calling framework, for example NetworkManager. Use option --set-routes=0/--no-routes.
Routing could be handled by openfortivpn call-back scripts. Such scripts would require specific sudo privileges. See Wrapper for ip.
Name resolution
DNS servers and search domains might be handled outside of openfortivpn:
DNS can be handled by the calling framework, for example NetworkManager. Use options --set-dns=0/--no-dns and --pppd-use-peerdns=0. Note that NetworkManager-fortisslvpn currently relies on --pppd-use-peerdns=1 to retrieve DNS parameters from openfortivpn, however that is sort of a hack: Add dns suffix information to informative message #636.
DNS could be handled by openfortivpn call-back scripts. Such scripts would require specific sudo privileges. See Wrapper for ip.
After #373 openfortivpn must be run with root privilege. There are multiples reasons for that. It would be worth re-investigating whether there are ways around that, or at least whether dropping root privilege after initial setup is a possibility, for example after spawning pppd.
Spawning pppd
Members of the
dipgroup may runpppdon Linux distributions such as Debian or Ubuntu:Yet openfortivpn requires root privilege because option
noauthis privileged:Not sure how to work around this is an a generic way - apart from complex solutions such as splitting openfortivpn into multiple pieces of software with root privileges only the one spawning pppd.
Setting routes
The
CAP_NET_ADMINcapability might be enough for ipv4_set_route() / ioctl():geteuid() == 0or the current process capabilities with something likeprctl(PR_CAPBSET_READ, CAP_NET_ADMIN).Alternatively routes might be handled outside of openfortivpn:
--set-routes=0/--no-routes.Name resolution
DNS servers and search domains might be handled outside of openfortivpn:
--set-dns=0/--no-dnsand--pppd-use-peerdns=0. Note that NetworkManager-fortisslvpn currently relies on--pppd-use-peerdns=1to retrieve DNS parameters from openfortivpn, however that is sort of a hack: Add dns suffix information to informative message #636.External links
Online articles of interest: