richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
5d2ee9
From b0573f1a6f8022aed4954d5ca19cc037d25cd5e7 Mon Sep 17 00:00:00 2001
5d2ee9
From: Lennart Poettering <lennart@poettering.net>
5d2ee9
Date: Wed, 20 Mar 2019 19:52:20 +0100
5d2ee9
Subject: [PATCH] units: turn on RestrictSUIDSGID= in most of our long-running
5d2ee9
 daemons
5d2ee9
5d2ee9
(cherry picked from commit 62aa29247c3d74bcec0607c347f2be23cd90675d)
5d2ee9
Related: #1687512
5d2ee9
---
5d2ee9
 units/systemd-coredump@.service.in      | 1 +
5d2ee9
 units/systemd-hostnamed.service.in      | 1 +
5d2ee9
 units/systemd-journal-remote.service.in | 1 +
5d2ee9
 units/systemd-journald.service.in       | 1 +
5d2ee9
 units/systemd-localed.service.in        | 1 +
5d2ee9
 units/systemd-logind.service.in         | 1 +
5d2ee9
 units/systemd-networkd.service.in       | 1 +
5d2ee9
 units/systemd-resolved.service.in       | 1 +
5d2ee9
 units/systemd-timedated.service.in      | 1 +
5d2ee9
 units/systemd-timesyncd.service.in      | 1 +
5d2ee9
 units/systemd-udevd.service.in          | 3 ++-
5d2ee9
 11 files changed, 12 insertions(+), 1 deletion(-)
5d2ee9
5d2ee9
diff --git a/units/systemd-coredump@.service.in b/units/systemd-coredump@.service.in
5d2ee9
index 68a68a5055..d69ebd8b24 100644
5d2ee9
--- a/units/systemd-coredump@.service.in
5d2ee9
+++ b/units/systemd-coredump@.service.in
5d2ee9
@@ -33,6 +33,7 @@ MemoryDenyWriteExecute=yes
5d2ee9
 RestrictRealtime=yes
5d2ee9
 RestrictNamespaces=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 SystemCallFilter=@system-service
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native
5d2ee9
diff --git a/units/systemd-hostnamed.service.in b/units/systemd-hostnamed.service.in
5d2ee9
index 4e5470dd29..97d4e142bc 100644
5d2ee9
--- a/units/systemd-hostnamed.service.in
5d2ee9
+++ b/units/systemd-hostnamed.service.in
5d2ee9
@@ -29,6 +29,7 @@ MemoryDenyWriteExecute=yes
5d2ee9
 RestrictRealtime=yes
5d2ee9
 RestrictNamespaces=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 SystemCallFilter=@system-service sethostname
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native
5d2ee9
diff --git a/units/systemd-journal-remote.service.in b/units/systemd-journal-remote.service.in
5d2ee9
index a94265f215..3c914f5a40 100644
5d2ee9
--- a/units/systemd-journal-remote.service.in
5d2ee9
+++ b/units/systemd-journal-remote.service.in
5d2ee9
@@ -28,6 +28,7 @@ MemoryDenyWriteExecute=yes
5d2ee9
 RestrictRealtime=yes
5d2ee9
 RestrictNamespaces=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 SystemCallArchitectures=native
5d2ee9
 LockPersonality=yes
5d2ee9
 LogsDirectory=journal/remote
5d2ee9
diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in
5d2ee9
index e109b25792..ab9ec35ff8 100644
5d2ee9
--- a/units/systemd-journald.service.in
5d2ee9
+++ b/units/systemd-journald.service.in
5d2ee9
@@ -21,6 +21,7 @@ Sockets=systemd-journald.socket systemd-journald-dev-log.socket
5d2ee9
 ExecStart=@rootlibexecdir@/systemd-journald
5d2ee9
 Restart=always
5d2ee9
 RestartSec=0
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 StandardOutput=null
5d2ee9
 WatchdogSec=3min
5d2ee9
 FileDescriptorStoreMax=4224
5d2ee9
diff --git a/units/systemd-localed.service.in b/units/systemd-localed.service.in
5d2ee9
index ce043db154..b87d60e9eb 100644
5d2ee9
--- a/units/systemd-localed.service.in
5d2ee9
+++ b/units/systemd-localed.service.in
5d2ee9
@@ -29,6 +29,7 @@ MemoryDenyWriteExecute=yes
5d2ee9
 RestrictRealtime=yes
5d2ee9
 RestrictNamespaces=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 SystemCallFilter=@system-service
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native
5d2ee9
diff --git a/units/systemd-logind.service.in b/units/systemd-logind.service.in
5d2ee9
index 6953fac55b..086338e03b 100644
5d2ee9
--- a/units/systemd-logind.service.in
5d2ee9
+++ b/units/systemd-logind.service.in
5d2ee9
@@ -30,6 +30,7 @@ MemoryDenyWriteExecute=yes
5d2ee9
 RestrictRealtime=yes
5d2ee9
 RestrictNamespaces=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX AF_NETLINK
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 SystemCallFilter=@system-service
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native
5d2ee9
diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in
5d2ee9
index 371ab3a9cf..a0f34ac738 100644
5d2ee9
--- a/units/systemd-networkd.service.in
5d2ee9
+++ b/units/systemd-networkd.service.in
5d2ee9
@@ -39,6 +39,7 @@ SystemCallFilter=@system-service
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native
5d2ee9
 LockPersonality=yes
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 RuntimeDirectory=systemd/netif
5d2ee9
 RuntimeDirectoryPreserve=yes
5d2ee9
 
5d2ee9
diff --git a/units/systemd-resolved.service.in b/units/systemd-resolved.service.in
5d2ee9
index aaed406ab2..6c2ad5ca86 100644
5d2ee9
--- a/units/systemd-resolved.service.in
5d2ee9
+++ b/units/systemd-resolved.service.in
5d2ee9
@@ -41,6 +41,7 @@ SystemCallFilter=@system-service
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native
5d2ee9
 LockPersonality=yes
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 RuntimeDirectory=systemd/resolve
5d2ee9
 RuntimeDirectoryPreserve=yes
5d2ee9
 
5d2ee9
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
5d2ee9
index 662b39557a..1da2bc4bb0 100644
5d2ee9
--- a/units/systemd-timedated.service.in
5d2ee9
+++ b/units/systemd-timedated.service.in
5d2ee9
@@ -27,6 +27,7 @@ MemoryDenyWriteExecute=yes
5d2ee9
 RestrictRealtime=yes
5d2ee9
 RestrictNamespaces=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 SystemCallFilter=@system-service @clock
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native
5d2ee9
diff --git a/units/systemd-timesyncd.service.in b/units/systemd-timesyncd.service.in
5d2ee9
index 4a490b6e16..c2b9551726 100644
5d2ee9
--- a/units/systemd-timesyncd.service.in
5d2ee9
+++ b/units/systemd-timesyncd.service.in
5d2ee9
@@ -37,6 +37,7 @@ MemoryDenyWriteExecute=yes
5d2ee9
 RestrictRealtime=yes
5d2ee9
 RestrictNamespaces=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 RuntimeDirectory=systemd/timesync
5d2ee9
 SystemCallFilter=@system-service @clock
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in
5d2ee9
index fd9ead3bb8..970cf0f290 100644
5d2ee9
--- a/units/systemd-udevd.service.in
5d2ee9
+++ b/units/systemd-udevd.service.in
5d2ee9
@@ -27,8 +27,9 @@ WatchdogSec=3min
5d2ee9
 TasksMax=infinity
5d2ee9
 PrivateMounts=yes
5d2ee9
 MemoryDenyWriteExecute=yes
5d2ee9
-RestrictRealtime=yes
5d2ee9
 RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
5d2ee9
+RestrictRealtime=yes
5d2ee9
+RestrictSUIDSGID=yes
5d2ee9
 SystemCallFilter=@system-service @module @raw-io
5d2ee9
 SystemCallErrorNumber=EPERM
5d2ee9
 SystemCallArchitectures=native