-
Notifications
You must be signed in to change notification settings - Fork 2
scx_loader: Lockdown systemd service #25
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
base: main
Are you sure you want to change the base?
Conversation
I'm not sure about above, but LGTM overall. |
Probably not needed since we don't do any networking, but would protect against the binary getting replaced with a malicious one that adds networking, or if any crate we depend on goes rogue or has a malicious upload. Honestly I think most of these options are overkill, but preemptively restricting perms and capabilities as much as possible will reduce the chances of new security issues springing up in future. |
|
Breaks only rustland |
|
worked with that diff (generated using shh) @@ -7,11 +7,8 @@
ExecStart=/usr/bin/scx_loader
KillSignal=SIGINT
ProtectSystem=full
-ProtectHome=true
PrivateTmp=disconnected
-PrivateDevices=true
PrivateMounts=true
-ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
@@ -24,8 +21,8 @@
SocketBindDeny=ipv4:udp
SocketBindDeny=ipv6:tcp
SocketBindDeny=ipv6:udp
-CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_CHOWN CAP_IPC_LOCK CAP_MKNOD CAP_NET_RAW CAP_SYS_BOOT CAP_SYS_CHROOT CAP_SYS_MODULE CAP_SYS_PACCT CAP_SYS_PTRACE CAP_SYS_TIME CAP_SYSLOG CAP_WAKE_ALARM
-SystemCallFilter=~@aio:EPERM @chown:EPERM @clock:EPERM @cpu-emulation:EPERM @debug:EPERM @keyring:EPERM @memlock:EPERM @module:EPERM @mount:EPERM @obsolete:EPERM @pkey:EPERM @raw-io:EPERM @reboot:EPERM @sandbox:EPERM @setuid:EPERM @swap:EPERM @sync:EPERM @timer:EPERM
+CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_CHOWN CAP_MKNOD CAP_NET_RAW CAP_SYS_BOOT CAP_SYS_CHROOT CAP_SYS_MODULE CAP_SYS_PACCT CAP_SYS_PTRACE CAP_SYS_TIME CAP_SYSLOG CAP_WAKE_ALARM
+SystemCallFilter=~@aio:EPERM @chown:EPERM @clock:EPERM @cpu-emulation:EPERM @debug:EPERM @keyring:EPERM @module:EPERM @mount:EPERM @obsolete:EPERM @pkey:EPERM @raw-io:EPERM @reboot:EPERM @setuid:EPERM @swap:EPERM @sync:EPERM @timer:EPERM
[Install]
WantedBy=graphical.target |
vnepogodin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
This is an attempt to perform the systemd hardening suggested by #12 . The following options were determined by profiling the service with shh (systemd hardening helper). It was done by starting profiling with shh, running through every scxctl option (stop, start sched with modes/args, switch with modes/args, restart, get, list), then ending profiling. AFAICT everything works fine w/ the new hardening options, but I would appreciate testing to make sure it works on more than just my system.