]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
systemd: Add more security feature for systemd units
authorChristian Hesse <mail@eworm.de>
Tue, 27 Dec 2016 22:18:32 +0000 (23:18 +0100)
committerDavid Sommerseth <davids@openvpn.net>
Wed, 25 Jan 2017 18:41:34 +0000 (19:41 +0100)
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>
(cherry picked from commit 76096c605fcac4815674b6ae76ac1f31f03a8186)

distro/systemd/openvpn-client@.service.in
distro/systemd/openvpn-server@.service.in

index 1be1e33225f3b872a6c39b230fda27be1b202ec1..49e3f51cc5493f6fe72aeeaf76706f93640ab496 100644 (file)
@@ -15,6 +15,8 @@ CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETU
 LimitNPROC=10
 DeviceAllow=/dev/null rw
 DeviceAllow=/dev/net/tun rw
+ProtectSystem=true
+ProtectHome=true
 
 [Install]
 WantedBy=multi-user.target
index 3dccaf253985b3c314ab5998c0da670f5257da29..9a8a2c730c2e73adfb97431a8a4663968ecce921 100644 (file)
@@ -15,6 +15,8 @@ CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RA
 LimitNPROC=10
 DeviceAllow=/dev/null rw
 DeviceAllow=/dev/net/tun rw
+ProtectSystem=true
+ProtectHome=true
 
 [Install]
 WantedBy=multi-user.target