Skip to content

Conversation

@micah-morton
Copy link

This patch adds #ifndef macros in 2 spots in order to allow pppd to be
spawned as a non-root user with only runtime capabilities (e.g.
CAP_NET_{RAW/ADMIN}) instead of giving pppd full root privileges. This
is helpful if pppd is itself spawned by a non-root user and the use of
file permissions (e.g. setuid-root) on the pppd binary is not a
desirable solution.

This patch adds #ifndef macros in 2 spots in order to allow pppd to be
spawned as a non-root user with only runtime capabilities (e.g.
CAP_NET_{RAW/ADMIN}) instead of giving pppd full root privileges. This
is helpful if pppd is itself spawned by a non-root user and the use of
file permissions (e.g. setuid-root) on the pppd binary is not a
desirable solution.
@paulusmack
Copy link
Collaborator

The basic idea seems fine, and the commit message is OK, though lacking a signed-off-by line.

With the ifndef in pppd/main.c, I'd prefer to see an explicit check that we have the capabilities we need if we're not running with euid=0, rather than simply not checking.

The ifndef in pppd/options.c doesn't look to be necessary. That code is about preventing a non-root user from overriding options set by the system administrator, it has basically nothing to do with the euid.

@paulusmack paulusmack closed this Jun 23, 2018
@micah-morton
Copy link
Author

Any idea regarding the set of runtime capabilities that pppd uses (and hence which capabilities we should check for in pppd/main.c)? The only capability I know for sure pppd needs is CAP_NET_ADMIN, but we are currently giving it CAP_NET_RAW and CAP_NET_BIND_SERVICE as well as part of a tree of processes. Then again I'm not familiar with the different functionalities of pppd to know if there are any other capabilities it may need in other use cases that I haven't mentioned here.

@Neustradamus
Copy link
Member

@micah-morton: Have you looked the PR from @a-andreyev?

What do you think?

@paulusmack: Can you look the update from today too?

a-andreyev added a commit to a-andreyev/ppp that referenced this pull request Dec 14, 2025
…root

Add optional libcap support (--with-libcap) for fine-grained privilege
management. When enabled, pppd checks for CAP_NET_ADMIN capability instead
of requiring euid 0, allowing it to run with reduced privileges.

This addresses issue ppp-project#98 by allowing pppd to run without full root access
when given appropriate capabilities via setcap(8).

Details:
- Add configure option --with-libcap to enable capability checking (Linux only)
- Check for CAP_NET_ADMIN (required to open /dev/ppp) instead of CAP_NET_RAW
- Add net_capable() function in sys-linux.c and sys-solaris.c
- Fallback to geteuid()==0 check when libcap is not available or not built
- Add m4/ax_check_cap.m4 macro for autotools detection

The feature is disabled by default to maintain backward compatibility.
Distributions can enable it with --with-libcap during build.

Signed-off-by: Alexey Andreev <[email protected]>
a-andreyev added a commit to a-andreyev/ppp that referenced this pull request Dec 14, 2025
…root

Add optional libcap support (--with-libcap) for fine-grained privilege
management. When enabled, pppd checks for CAP_NET_ADMIN capability instead
of requiring euid 0, allowing it to run with reduced privileges.

This addresses issue ppp-project#98 by allowing pppd to run without full root access
when given appropriate capabilities via setcap(8).

Details:
- Add configure option --with-libcap to enable capability checking (Linux only)
- Check for CAP_NET_ADMIN (required to open /dev/ppp) instead of CAP_NET_RAW
- Add net_capable() function in sys-linux.c and sys-solaris.c
- Fallback to geteuid()==0 check when libcap is not available or not built
- Add m4/ax_check_cap.m4 macro for autotools detection

The feature is disabled by default to maintain backward compatibility.
Distributions can enable it with --with-libcap during build.

Signed-off-by: Alexey Andreev <[email protected]>
a-andreyev added a commit to a-andreyev/ppp that referenced this pull request Dec 14, 2025
…root

Add optional libcap support (--with-libcap) for fine-grained privilege
management. When enabled, pppd checks for CAP_NET_ADMIN capability instead
of requiring euid 0, allowing it to run with reduced privileges.

This addresses issue ppp-project#98 by allowing pppd to run without full root access
when given appropriate capabilities via setcap(8).

Details:
- Add configure option --with-libcap to enable capability checking (Linux only)
- Check for CAP_NET_ADMIN (required to open /dev/ppp) instead of CAP_NET_RAW
- Add net_capable() function in sys-linux.c and sys-solaris.c
- Fallback to geteuid()==0 check when libcap is not available or not built
- Add m4/ax_check_cap.m4 macro for autotools detection

The feature is disabled by default to maintain backward compatibility.
Distributions can enable it with --with-libcap during build.

Signed-off-by: Alexey Andreyev <[email protected]>
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.

3 participants