anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0328-units-turn-on-RestrictSUIDSGID-in-most-of-our-long-r.patch

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