Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use systemd's sd_notify with option up_sdnotify #79

Merged
merged 1 commit into from
Jun 23, 2018

Conversation

cognifloyd
Copy link
Contributor

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.

Resolves #70

@paulusmack
Copy link
Collaborator

Mostly looks good. Two comments:

  1. Could you please add a Signed-off-by to the commit message?

  2. What happens if a non-privileged user running pppd specifies the up_sdnotify option? Does sd_notify do anything bad if it is called when pppd was not run from systemd? Is there any way that this could let a non-privileged user attack systemd and possibly gain privileges somehow?

@cognifloyd
Copy link
Contributor Author

cognifloyd commented Mar 26, 2017 via email

@paulusmack
Copy link
Collaborator

OK, sounds fair.

Please add a paragraph to the commit message explaining that you have made the new option a non-privileged option because ... (e.g., because a non-privileged user running pppd can't cause any disruption by setting it, and briefly why that is so).

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 <[email protected]>
@cognifloyd
Copy link
Contributor Author

OK. I finally got around to fixing the commit message.

@paulusmack paulusmack merged commit d34159f into ppp-project:master Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants