From 417116f23432073162ebfcb286a7800846482eed Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 3 Jun 2014 23:41:44 +0200 Subject: core: add new ReadOnlySystem= and ProtectedHome= settings for service units ReadOnlySystem= uses fs namespaces to mount /usr and /boot read-only for a service. ProtectedHome= uses fs namespaces to mount /home and /run/user inaccessible or read-only for a service. This patch also enables these settings for all our long-running services. Together they should be good building block for a minimal service sandbox, removing the ability for services to modify the operating system or access the user's private data. --- units/systemd-hostnamed.service.in | 2 ++ units/systemd-journal-gatewayd.service.in | 2 ++ units/systemd-journald.service.in | 2 ++ units/systemd-localed.service.in | 2 ++ units/systemd-logind.service.in | 2 ++ units/systemd-machined.service.in | 2 ++ units/systemd-networkd.service.in | 2 ++ units/systemd-resolved.service.in | 2 ++ units/systemd-timedated.service.in | 2 ++ units/systemd-timesyncd.service.in | 2 ++ units/systemd-udevd.service.in | 2 ++ 11 files changed, 22 insertions(+) (limited to 'units') diff --git a/units/systemd-hostnamed.service.in b/units/systemd-hostnamed.service.in index 79e22c1d4f..497b8d9974 100644 --- a/units/systemd-hostnamed.service.in +++ b/units/systemd-hostnamed.service.in @@ -18,3 +18,5 @@ WatchdogSec=1min PrivateTmp=yes PrivateDevices=yes PrivateNetwork=yes +ReadOnlySystem=yes +ProtectedHome=yes diff --git a/units/systemd-journal-gatewayd.service.in b/units/systemd-journal-gatewayd.service.in index e8e571e692..3695240cbf 100644 --- a/units/systemd-journal-gatewayd.service.in +++ b/units/systemd-journal-gatewayd.service.in @@ -17,6 +17,8 @@ SupplementaryGroups=systemd-journal PrivateTmp=yes PrivateDevices=yes PrivateNetwork=yes +ReadOnlySystem=yes +ProtectedHome=yes [Install] Also=systemd-journal-gatewayd.socket diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in index de93879330..ba3f847201 100644 --- a/units/systemd-journald.service.in +++ b/units/systemd-journald.service.in @@ -20,6 +20,8 @@ RestartSec=0 NotifyAccess=all StandardOutput=null CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG CAP_AUDIT_CONTROL CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETUID CAP_SETGID +ReadOnlySystem=yes +ProtectedHome=yes WatchdogSec=1min # Increase the default a bit in order to allow many simultaneous diff --git a/units/systemd-localed.service.in b/units/systemd-localed.service.in index ae1c5e59d1..e1792d6546 100644 --- a/units/systemd-localed.service.in +++ b/units/systemd-localed.service.in @@ -18,3 +18,5 @@ WatchdogSec=1min PrivateTmp=yes PrivateDevices=yes PrivateNetwork=yes +ReadOnlySystem=yes +ProtectedHome=yes diff --git a/units/systemd-logind.service.in b/units/systemd-logind.service.in index c6cbd1c8df..68803fb381 100644 --- a/units/systemd-logind.service.in +++ b/units/systemd-logind.service.in @@ -25,6 +25,8 @@ RestartSec=0 BusName=org.freedesktop.login1 CapabilityBoundingSet=CAP_SYS_ADMIN CAP_AUDIT_CONTROL CAP_CHOWN CAP_KILL CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE CAP_FOWNER CAP_SYS_TTY_CONFIG WatchdogSec=1min +ReadOnlySystem=yes +ProtectedHome=yes # Increase the default a bit in order to allow many simultaneous # logins since we keep one fd open per session. diff --git a/units/systemd-machined.service.in b/units/systemd-machined.service.in index 1a27c6e421..07522e12a4 100644 --- a/units/systemd-machined.service.in +++ b/units/systemd-machined.service.in @@ -20,3 +20,5 @@ WatchdogSec=1min PrivateTmp=yes PrivateDevices=yes PrivateNetwork=yes +ReadOnlySystem=yes +ProtectedHome=yes diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in index 3538295df4..a928999205 100644 --- a/units/systemd-networkd.service.in +++ b/units/systemd-networkd.service.in @@ -20,6 +20,8 @@ Restart=always RestartSec=0 ExecStart=@rootlibexecdir@/systemd-networkd CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETUID CAP_SETGID CAP_SETPCAP CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNER +ReadOnlySystem=yes +ProtectedHome=yes WatchdogSec=1min [Install] diff --git a/units/systemd-resolved.service.in b/units/systemd-resolved.service.in index 9d422ca7f2..787fde2c44 100644 --- a/units/systemd-resolved.service.in +++ b/units/systemd-resolved.service.in @@ -16,6 +16,8 @@ Restart=always RestartSec=0 ExecStart=@rootlibexecdir@/systemd-resolved CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_SETPCAP CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNER +ReadOnlySystem=yes +ProtectedHome=yes [Install] WantedBy=multi-user.target diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in index 5c90290cde..9658149eef 100644 --- a/units/systemd-timedated.service.in +++ b/units/systemd-timedated.service.in @@ -16,3 +16,5 @@ BusName=org.freedesktop.timedate1 CapabilityBoundingSet=CAP_SYS_TIME WatchdogSec=1min PrivateTmp=yes +ReadOnlySystem=yes +ProtectedHome=yes diff --git a/units/systemd-timesyncd.service.in b/units/systemd-timesyncd.service.in index cbde3ff67a..030e4a0423 100644 --- a/units/systemd-timesyncd.service.in +++ b/units/systemd-timesyncd.service.in @@ -23,6 +23,8 @@ ExecStart=@rootlibexecdir@/systemd-timesyncd CapabilityBoundingSet=CAP_SYS_TIME CAP_SETUID CAP_SETGID CAP_SETPCAP CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNER PrivateTmp=yes PrivateDevices=yes +ReadOnlySystem=yes +ProtectedHome=yes WatchdogSec=1min [Install] diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in index ddee01537a..82275f052f 100644 --- a/units/systemd-udevd.service.in +++ b/units/systemd-udevd.service.in @@ -22,3 +22,5 @@ Restart=always RestartSec=0 ExecStart=@rootlibexecdir@/systemd-udevd MountFlags=slave +ReadOnlySystem=yes +ProtectedHome=yes -- cgit v1.2.3-54-g00ecf