anitazha / rpms / systemd

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