naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
c2dfb7
From 797ebaa8240aefc39de3d1713468b221c83ed3f5 Mon Sep 17 00:00:00 2001
c2dfb7
From: Lennart Poettering <lennart@poettering.net>
c2dfb7
Date: Wed, 20 Mar 2019 19:45:32 +0100
c2dfb7
Subject: [PATCH] man: document the new RestrictSUIDSGID= setting
c2dfb7
c2dfb7
(cherry picked from commit 7445db6eb70e8d5989f481d0c5a08ace7047ae5b)
c2dfb7
Related: #1687512
c2dfb7
---
c2dfb7
 doc/TRANSIENT-SETTINGS.md |  1 +
c2dfb7
 man/systemd.exec.xml      | 41 +++++++++++++++++++++++++++------------
c2dfb7
 2 files changed, 30 insertions(+), 12 deletions(-)
c2dfb7
c2dfb7
diff --git a/doc/TRANSIENT-SETTINGS.md b/doc/TRANSIENT-SETTINGS.md
c2dfb7
index 0ea444b133..c2b5c0dcce 100644
c2dfb7
--- a/doc/TRANSIENT-SETTINGS.md
c2dfb7
+++ b/doc/TRANSIENT-SETTINGS.md
c2dfb7
@@ -149,6 +149,7 @@ All execution-related settings are available for transient units.
c2dfb7
 ✓ MemoryDenyWriteExecute=
c2dfb7
 ✓ RestrictNamespaces=
c2dfb7
 ✓ RestrictRealtime=
c2dfb7
+✓ RestrictSUIDSGID=
c2dfb7
 ✓ RestrictAddressFamilies=
c2dfb7
 ✓ LockPersonality=
c2dfb7
 ✓ LimitCPU=
c2dfb7
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
c2dfb7
index 87fb8b34f4..45ed1864f8 100644
c2dfb7
--- a/man/systemd.exec.xml
c2dfb7
+++ b/man/systemd.exec.xml
c2dfb7
@@ -348,18 +348,19 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
c2dfb7
       <varlistentry>
c2dfb7
         <term><varname>NoNewPrivileges=</varname></term>
c2dfb7
 
c2dfb7
-        <listitem><para>Takes a boolean argument. If true, ensures that the service process and all its children can
c2dfb7
-        never gain new privileges through <function>execve()</function> (e.g. via setuid or setgid bits, or filesystem
c2dfb7
-        capabilities). This is the simplest and most effective way to ensure that a process and its children can never
c2dfb7
-        elevate privileges again. Defaults to false, but certain settings override this and ignore the value of this
c2dfb7
-        setting.  This is the case when <varname>SystemCallFilter=</varname>,
c2dfb7
-        <varname>SystemCallArchitectures=</varname>, <varname>RestrictAddressFamilies=</varname>,
c2dfb7
-        <varname>RestrictNamespaces=</varname>, <varname>PrivateDevices=</varname>,
c2dfb7
-        <varname>ProtectKernelTunables=</varname>, <varname>ProtectKernelModules=</varname>,
c2dfb7
-        <varname>MemoryDenyWriteExecute=</varname>, <varname>RestrictRealtime=</varname>, or
c2dfb7
-        <varname>LockPersonality=</varname> are specified. Note that even if this setting is overridden by them,
c2dfb7
-        <command>systemctl show</command> shows the original value of this setting. Also see
c2dfb7
-        <ulink url="https://www.kernel.org/doc/html/latest/userspace-api/no_new_privs.html">No New Privileges
c2dfb7
+        <listitem><para>Takes a boolean argument. If true, ensures that the service process and all its
c2dfb7
+        children can never gain new privileges through <function>execve()</function> (e.g. via setuid or
c2dfb7
+        setgid bits, or filesystem capabilities). This is the simplest and most effective way to ensure that
c2dfb7
+        a process and its children can never elevate privileges again. Defaults to false, but certain
c2dfb7
+        settings override this and ignore the value of this setting.  This is the case when
c2dfb7
+        <varname>SystemCallFilter=</varname>, <varname>SystemCallArchitectures=</varname>,
c2dfb7
+        <varname>RestrictAddressFamilies=</varname>, <varname>RestrictNamespaces=</varname>,
c2dfb7
+        <varname>PrivateDevices=</varname>, <varname>ProtectKernelTunables=</varname>,
c2dfb7
+        <varname>ProtectKernelModules=</varname>, <varname>MemoryDenyWriteExecute=</varname>,
c2dfb7
+        <varname>RestrictRealtime=</varname>, <varname>RestrictSUIDSGID=</varname> or
c2dfb7
+        <varname>LockPersonality=</varname> are specified. Note that even if this setting is overridden by
c2dfb7
+        them, <command>systemctl show</command> shows the original value of this setting. Also see 
c2dfb7
+        url="https://www.kernel.org/doc/html/latest/userspace-api/no_new_privs.html">No New Privileges
c2dfb7
         Flag</ulink>.  </para></listitem>
c2dfb7
       </varlistentry>
c2dfb7
 
c2dfb7
@@ -1274,6 +1275,22 @@ RestrictNamespaces=~cgroup net</programlisting>
c2dfb7
         that actually require them. Defaults to off.</para></listitem>
c2dfb7
       </varlistentry>
c2dfb7
 
c2dfb7
+      <varlistentry>
c2dfb7
+        <term><varname>RestrictSUIDSGID=</varname></term>
c2dfb7
+
c2dfb7
+        <listitem><para>Takes a boolean argument. If set, any attempts to set the set-user-ID (SUID) or
c2dfb7
+        set-group-ID (SGID) bits on files or directories will be denied (for details on these bits see
c2dfb7
+        
c2dfb7
+        project='man-pages'><refentrytitle>inode</refentrytitle><manvolnum>7</manvolnum></citerefentry>). If
c2dfb7
+        running in user mode, or in system mode, but without the <constant>CAP_SYS_ADMIN</constant>
c2dfb7
+        capability (e.g. setting <varname>User=</varname>), <varname>NoNewPrivileges=yes</varname> is
c2dfb7
+        implied. As the SUID/SGID bits are mechanisms to elevate privileges, and allows users to acquire the
c2dfb7
+        identity of other users, it is recommended to restrict creation of SUID/SGID files to the few
c2dfb7
+        programs that actually require them. Note that this restricts marking of any type of file system
c2dfb7
+        object with these bits, including both regular files and directories (where the SGID is a different
c2dfb7
+        meaning than for files, see documentation). Defaults to off.</para></listitem>
c2dfb7
+      </varlistentry>
c2dfb7
+
c2dfb7
       <varlistentry>
c2dfb7
         <term><varname>RemoveIPC=</varname></term>
c2dfb7