Browse code

systemd: Add more security feature for systemd units

ProtectSystem=true mounts the /usr and /boot directories read-only.

ProtectHome=true makes the directories /home, /root and /run/user
inaccessible and empty for the process.

See systemd.exec(5) [0] for details.

v2: Replace ProtectSystem=strict with ProtectSystem=true. Some
configurations may want to write to /etc or the like.

[0] https://www.freedesktop.org/software/systemd/man/systemd.exec.html

Signed-off-by: Christian Hesse <mail@eworm.de>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20161227221832.610-1-list@eworm.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13743.html
Signed-off-by: David Sommerseth <davids@openvpn.net>

Christian Hesse authored on 2016/12/28 07:18:32
Showing 2 changed files
... ...
@@ -15,6 +15,8 @@ CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETU
15 15
 LimitNPROC=10
16 16
 DeviceAllow=/dev/null rw
17 17
 DeviceAllow=/dev/net/tun rw
18
+ProtectSystem=true
19
+ProtectHome=true
18 20
 
19 21
 [Install]
20 22
 WantedBy=multi-user.target
... ...
@@ -15,6 +15,8 @@ CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RA
15 15
 LimitNPROC=10
16 16
 DeviceAllow=/dev/null rw
17 17
 DeviceAllow=/dev/net/tun rw
18
+ProtectSystem=true
19
+ProtectHome=true
18 20
 
19 21
 [Install]
20 22
 WantedBy=multi-user.target