]> git.ozlabs.org Git - ppp.git/commit
Use systemd's sd_notify with option up_sdnotify
authorJacob Floyd <cognifloyd@gmail.com>
Sat, 11 Mar 2017 05:25:23 +0000 (23:25 -0600)
committerJacob Floyd <cognifloyd@gmail.com>
Tue, 27 Feb 2018 19:22:23 +0000 (13:22 -0600)
commitd34159f417620eb7c481bf53f29fe04c86ccd223
treeb51300125baefb0af60870d2612beb40ae271a79
parenta3f379befd11934466271aaca76b2809ae8595d0
Use systemd's sd_notify with option up_sdnotify

This adds an up_sdnotify option so that systemd services of
Type=notify can have pppd send the READY=1 signal to systemd
once a network protocol (typically IP) is up.

To use up_sdnotify, pppd must be compiled with SYSTEMD=y.

up_sdnotify is safe as a non-priveleged option because systemd will
ignore any notifications that it is not expecting. If systemd starts
pppd in a unit-file that is Type=notify, then (and only then) will it
handle the READY=1 signal. If systemd didn't start the process, it
ignroes any notifications unless the signaling process was started by a
service that systemd is monitoring (directly or indirectly, such as a
grandchild process in the same cgroup as a process that systemd started)
AND that service is Type=notify, AND that service is explicitly
configured to allow other processes to send a notification on behalf of
that service by setting NotifyAccess=all.

Also, the socket used is defined in an environment variable provided and
deleted by systemd, allowing system and user services to use a different
socket. I really don't think there's any way to use that socket (even via
the sd_notify api of their library) to gain elevated privileges.

Another reason that up_sdnotify is a non-priveleged option is for cases
where ppp should be started as a system service under a non-priveleged
account. There may be other issues with running ppp under other
accounts, but systemd does not require root--or other privileged--access
in order to use the notification feature. Instead the security for this
feature is provided at the process level in that systemd knows which
processes it did and did not start, and which processes those processes
started (ie other processes in the systemd unit's cgroup), as explained
above.

Signed-off-by: Jacob Floyd <cognifloyd@gmail.com>
pppd/Makefile.linux
pppd/auth.c
pppd/options.c
pppd/pppd.8
pppd/pppd.h