4fbe94
From d11fdacaf3c804b60dfe8371062f34ac2b624ac9 Mon Sep 17 00:00:00 2001
4fbe94
From: Jan Synacek <jsynacek@redhat.com>
4fbe94
Date: Fri, 13 Sep 2019 09:23:32 +0200
4fbe94
Subject: [PATCH] man: document systemd-analyze security
4fbe94
4fbe94
(cherry-picked from commit ee93c1e664a7bbc59f1578e285c871999507b14d)
4fbe94
4fbe94
Resolves: #1750343
4fbe94
---
4fbe94
 man/systemd-analyze.xml | 29 +++++++++++++++++++++++++++++
4fbe94
 1 file changed, 29 insertions(+)
4fbe94
4fbe94
diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml
4fbe94
index 7aa10fc68e..f3b595880f 100644
4fbe94
--- a/man/systemd-analyze.xml
4fbe94
+++ b/man/systemd-analyze.xml
4fbe94
@@ -106,6 +106,12 @@
4fbe94
       <arg choice="plain">service-watchdogs</arg>
4fbe94
       <arg choice="opt"><replaceable>BOOL</replaceable></arg>
4fbe94
     </cmdsynopsis>
4fbe94
+    <cmdsynopsis>
4fbe94
+      <command>systemd-analyze</command>
4fbe94
+      <arg choice="opt" rep="repeat">OPTIONS</arg>
4fbe94
+      <arg choice="plain">security</arg>
4fbe94
+      <arg choice="plain" rep="repeat"><replaceable>UNIT</replaceable></arg>
4fbe94
+    </cmdsynopsis>
4fbe94
   </refsynopsisdiv>
4fbe94
 
4fbe94
   <refsect1>
4fbe94
@@ -253,6 +259,29 @@ NAutoVTs=8
4fbe94
     <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
4fbe94
     The hardware watchdog is not affected by this setting.</para>
4fbe94
 
4fbe94
+    <para><command>systemd-analyze security</command> analyzes the security and sandboxing settings of one or more
4fbe94
+    specified service units. If at least one unit name is specified the security settings of the specified service
4fbe94
+    units are inspected and a detailed analysis is shown. If no unit name is specified, all currently loaded,
4fbe94
+    long-running service units are inspected and a terse table with results shown. The command checks for various
4fbe94
+    security-related service settings, assigning each a numeric "exposure level" value, depending on how important a
4fbe94
+    setting is. It then calculates an overall exposure level for the whole unit, which is an estimation in the range
4fbe94
+    0.0…10.0 indicating how exposed a service is security-wise. High exposure levels indicate very little applied
4fbe94
+    sandboxing. Low exposure levels indicate tight sandboxing and strongest security restrictions. Note that this only
4fbe94
+    analyzes the per-service security features systemd itself implements. This means that any additional security
4fbe94
+    mechanisms applied by the service code itself are not accounted for. The exposure level determined this way should
4fbe94
+    not be misunderstood: a high exposure level neither means that there is no effective sandboxing applied by the
4fbe94
+    service code itself, nor that the service is actually vulnerable to remote or local attacks. High exposure levels
4fbe94
+    do indicate however that most likely the service might benefit from additional settings applied to them. Please
4fbe94
+    note that many of the security and sandboxing settings individually can be circumvented — unless combined with
4fbe94
+    others. For example, if a service retains the privilege to establish or undo mount points many of the sandboxing
4fbe94
+    options can be undone by the service code itself. Due to that is essential that each service uses the most
4fbe94
+    comprehensive and strict sandboxing and security settings possible. The tool will take into account some of these
4fbe94
+    combinations and relationships between the settings, but not all. Also note that the security and sandboxing
4fbe94
+    settings analyzed here only apply to the operations executed by the service code itself. If a service has access to
4fbe94
+    an IPC system (such as D-Bus) it might request operations from other services that are not subject to the same
4fbe94
+    restrictions. Any comprehensive security and sandboxing analysis is hence incomplete if the IPC access policy is
4fbe94
+    not validated too.</para>
4fbe94
+
4fbe94
     <para>If no command is passed, <command>systemd-analyze
4fbe94
     time</command> is implied.</para>
4fbe94