forked from polkit-org/polkit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
agent helper: support separate socket-activated service to run withou…
…t SETUID SETUID binaries are considered harmful, as te execution context is under the control of unprivileged attackers. Enhance the polkit pam agent helper with a new mode: when running under systemd, add a socket-activated service that the helper will run under, as root. The agent talks to this service via AF_UNIX instead of spawning it, and STDIN/STDOUT are connected as before. The helper can make use of PID FDs and SO_PEERCRED to reliably identify the caller. In order to do this, a third version of the auth D-Bus method is added, that also takes a subject, built using the PID FD. If the AF_UNIX socket is not present, the agent will fork the helper as before, with no changes. Fixes polkit-org#169
- Loading branch information
Showing
14 changed files
with
474 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,19 @@ configure_file( | |
install_dir: systemdsystemunitdir, | ||
) | ||
|
||
configure_file( | ||
input: '[email protected]', | ||
output: '@BASENAME@', | ||
configuration: service_conf, | ||
install: true, | ||
install_dir: systemdsystemunitdir, | ||
) | ||
|
||
install_data( | ||
'polkit-agent-helper.socket', | ||
install_dir: systemdsystemunitdir, | ||
) | ||
|
||
configure_file( | ||
input: 'polkit.conf.in', | ||
output: '@BASENAME@', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Authorization Manager Agent Helper | ||
Documentation=man:polkit(8) | ||
|
||
[Socket] | ||
Accept=yes | ||
RemoveOnStop=yes | ||
ListenStream=/run/polkit/agent-helper.socket | ||
|
||
[Install] | ||
WantedBy=sockets.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[Unit] | ||
Description=Authorization Manager Agent Helper | ||
Documentation=man:polkit(8) | ||
|
||
[Service] | ||
Type=oneshot | ||
DeviceAllow=/dev/null rw | ||
DevicePolicy=strict | ||
ExecStart=@libprivdir@/polkit-agent-helper-1 --socket-activated | ||
StandardInput=socket | ||
StandardOutput=socket | ||
LimitMEMLOCK=0 | ||
LockPersonality=yes | ||
MemoryDenyWriteExecute=yes | ||
NoNewPrivileges=yes | ||
PrivateDevices=yes | ||
PrivateNetwork=yes | ||
PrivateTmp=yes | ||
ProtectControlGroups=yes | ||
ProtectHome=yes | ||
ProtectKernelModules=yes | ||
ProtectKernelLogs=yes | ||
ProtectKernelTunables=yes | ||
ProtectSystem=strict | ||
ProtectClock=yes | ||
ProtectHostname=yes | ||
RemoveIPC=yes | ||
RestrictAddressFamilies=AF_UNIX | ||
RestrictNamespaces=yes | ||
RestrictRealtime=yes | ||
RestrictSUIDSGID=yes | ||
SystemCallArchitectures=native | ||
SystemCallFilter=@system-service | ||
UMask=0077 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.