Blob Blame History Raw
From c53fc08a70679b181b0eff6422f199a51d527e67 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Tue, 9 Oct 2018 15:41:44 +0200
Subject: [PATCH 64/66] SYSTEMD: Re-read KCM configuration on systemctl restart
 kcm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Related:
https://pagure.io/SSSD/sssd/issue/3862

Uses the sssd command together with the --genconf-section=kcm option to
refresh the kcm configuration when the sssd-kcm systemd service is
restarted.

This allows the administrator to e.g. just drop a snippet to
/etc/sssd.conf.d/ or create the [kcm] section directly in the main sssd
config file, then just restart the sssd-kcm service for the changes to
apply.

Reviewed-by: Michal Židek <mzidek@redhat.com>
---
 src/man/sssd-kcm.8.xml               | 33 ++++++++++++++++++++++++++++
 src/sysv/systemd/sssd-kcm.service.in |  1 +
 2 files changed, 34 insertions(+)

diff --git a/src/man/sssd-kcm.8.xml b/src/man/sssd-kcm.8.xml
index ec27aa57b..fff8b0a16 100644
--- a/src/man/sssd-kcm.8.xml
+++ b/src/man/sssd-kcm.8.xml
@@ -127,6 +127,39 @@ systemctl enable sssd-kcm.socket
         </para>
     </refsect1>
 
+    <refsect1 id='debugging'>
+        <title>OBTAINING DEBUG LOGS</title>
+        <para>
+            The sssd-kcm service is typically socket-activated
+            <citerefentry>
+                <refentrytitle>systemd</refentrytitle>
+                <manvolnum>1</manvolnum>
+            </citerefentry>. To generate debug logs, add the following
+            either to the <filename>/etc/sssd/sssd.conf</filename>
+            file directly or as a configuration snippet to
+            <filename>/etc/sssd/conf.d/</filename> directory:
+            <programlisting>
+[kcm]
+debug_level = 10
+            </programlisting>
+            Then, restart the sssd-kcm service:
+            <programlisting>
+systemctl restart sssd-kcm.service
+            </programlisting>
+            Finally, run whatever use-case doesn't work for you. The KCM
+            logs will be generated at
+            <filename>/var/log/sssd/sssd_kcm.log</filename>. It is
+            recommended to disable the debug logs when you no longer need
+            the debugging to be enabled as the sssd-kcm service can generate
+            quite a large amount of debugging information.
+        </para>
+        <para>
+            Please note that configuration snippets are, at the moment,
+            only processed if the main configuration file at
+            <filename>/etc/sssd/sssd.conf</filename> exists at all.
+        </para>
+    </refsect1>
+
     <refsect1 id='options'>
         <title>CONFIGURATION OPTIONS</title>
         <para>
diff --git a/src/sysv/systemd/sssd-kcm.service.in b/src/sysv/systemd/sssd-kcm.service.in
index 8d689bfd7..5c82bee7d 100644
--- a/src/sysv/systemd/sssd-kcm.service.in
+++ b/src/sysv/systemd/sssd-kcm.service.in
@@ -9,4 +9,5 @@ Also=sssd-kcm.socket
 
 [Service]
 Environment=DEBUG_LOGGER=--logger=files
+ExecStartPre=-@sbindir@/sssd --genconf-section=kcm
 ExecStart=@libexecdir@/sssd/sssd_kcm --uid 0 --gid 0 ${DEBUG_LOGGER}
-- 
2.19.1