Skip to content

Commit

Permalink
earlyoom.service: drop root privileges
Browse files Browse the repository at this point in the history
Run as a random unprivilege user instead of as root,
but add the capabilities CAP_KILL CAP_IPC_LOCK.

Supersedes #158
  • Loading branch information
rfjakob committed Feb 12, 2020
1 parent 247ccd3 commit f2b45e6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions earlyoom.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Documentation=man:earlyoom(1) https://github.com/rfjakob/earlyoom
[Service]
EnvironmentFile=-:SYSCONFDIR:/default/earlyoom
ExecStart=:TARGET:/earlyoom $EARLYOOM_ARGS
# Run as an unprivileged user with random user id
DynamicUser=true
# Allow killing processes and calling mlockall()
AmbientCapabilities=CAP_KILL CAP_IPC_LOCK
# We don't need write access anywhere
ProtectSystem=strict
# We don't need /home at all, make it inaccessible
ProtectHome=true

[Install]
WantedBy=multi-user.target

0 comments on commit f2b45e6

Please sign in to comment.