#1003620 realmd: don't explicitly enable services

Package:
realmd
Source:
realmd
Description:
DBus service for configuring kerberos and other online identities
Submitter:
Andreas Hasenack
Date:
2022-06-17 18:09:21 UTC
Severity:
normal
#1003620#5
Date:
2022-01-12 18:27:05 UTC
From:
To:
Dear Maintainer,

in Debian and Ubuntu, sssd uses socket activation to start other
daemons as needed.

When realmd is used to join an Active Directory domain, by default
sssd is used. realmd will configure sssd with the following:
[sssd]
services = nss, pam

This services line tells sssd to also start the services for nss and
pam, but these are socket activated:
/lib/systemd/system/sssd-nss.socket
/lib/systemd/system/sssd-pam-priv.socket
/lib/systemd/system/sssd-pam.socket

When realmd finishes the join, and restarts sssd, we get these
warnings in the logs.
For NSS:
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2445]: [sssd] [main] (0x0070):
Misconfiguration found for the nss responder.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2445]: The nss responder has
been configured to be socket-activated but it's still mentioned in the
services' line in /etc/sssd/sssd.conf.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2445]: Please, consider either
adjusting your services' line in /etc/sssd/sssd.conf or disabling the
nss's socket by calling:
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2445]: "systemctl disable
sssd-nss.socket"
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-nss.socket: Control
process exited, code=exited, status=17/n/a
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-nss.socket: Failed with
result 'exit-code'.
Jan 12 18:08:19 sid-realmd systemd[1]: Failed to listen on SSSD NSS
Service responder socket.

For PAM:
Jan 12 18:08:19 sid-realmd systemd[1]: Starting SSSD PAM Service
responder socket...
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2446]: [sssd] [main] (0x0070):
Misconfiguration found for the pam responder.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2446]: The pam responder has
been configured to be socket-activated but it's still mentioned in the
services' line in /etc/sssd/sssd.conf.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2446]: Please, consider either
adjusting your services' line in /etc/sssd/sssd.conf or disabling the
pam's socket by calling:
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2446]: "systemctl disable
sssd-pam.socket"
Jan 12 18:08:19 sid-realmd systemd[1]: Starting SSSD SSH Service
responder socket...
Jan 12 18:08:19 sid-realmd systemd[1]: Starting SSSD Sudo Service
responder socket...
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-pam-priv.socket: Control
process exited, code=exited, status=17/n/a
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-pam-priv.socket: Failed
with result 'exit-code'.
Jan 12 18:08:19 sid-realmd systemd[1]: Failed to listen on SSSD PAM
Service responder private socket.
Jan 12 18:08:19 sid-realmd systemd[1]: Dependency failed for SSSD PAM
Service responder socket.
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-pam.socket: Job
sssd-pam.socket/start failed with result 'dependency'.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2449]: [sssd] [main] (0x0070):
Misconfiguration found for the pam responder.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2449]: The pam responder has
been configured to be socket-activated but it's still mentioned in the
services' line in /etc/sssd/sssd.conf.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2449]: Please, consider either
adjusting your services' line in /etc/sssd/sssd.conf or disabling the
pam's socket by calling:
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-pam.socket: Killing
process 2449 (sssd_check_sock) with signal SIGKILL.
Jan 12 18:08:19 sid-realmd
sssd_check_socket_activated_responders[2449]: "systemctl disable
sssd-pam.socket"
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-pam.socket: Control
process exited, code=exited, status=17/n/a
Jan 12 18:08:19 sid-realmd systemd[1]: sssd-pam.socket: Failed with
result 'exit-code'.
Jan 12 18:08:19 sid-realmd systemd[1]: Closed SSSD PAM Service responder socket.

There are not fatal, and the join process succeeds:
root@sid-realmd:~# kinit Administrator
Password for Administrator@INTERNAL.EXAMPLE.FAKE:

root@sid-realmd:~# realm join -v internal.example.fake
 * Resolving: _ldap._tcp.internal.example.fake
 * Performing LDAP DSE lookup on: 10.0.16.5
 * Successfully discovered: internal.example.fake
 (...)
 * Checking host/SID-REALMD
 *    Added host/SID-REALMD
 * Discovered which keytab salt to use
 * Added the entries to the keytab: SID-REALMD$@INTERNAL.EXAMPLE.FAKE:
FILE:/etc/krb5.keytab
 * Added the entries to the keytab:
host/SID-REALMD@INTERNAL.EXAMPLE.FAKE: FILE:/etc/krb5.keytab
 * Added the entries to the keytab:
RestrictedKrbHost/SID-REALMD@INTERNAL.EXAMPLE.FAKE:
FILE:/etc/krb5.keytab
 ! Failed to update Kerberos configuration, not fatal, please check
manually: Setting attribute standard::type not supported
 * /usr/sbin/update-rc.d sssd enable
 * /usr/sbin/service sssd restart
 * Successfully enrolled machine in realm

But are unnecessary noise in the logs, and can confuse sysadmins on an
already difficult topic (AD authentication and authorization).

In Ubuntu, I created this patch which will not add the "services =
nss, pam" line to sssd.conf:

Description: Don't add the services line to sssd.conf
 In Ubuntu and Debian, the sssd services (like nss, pam, pac, etc) are socket
 activated and should not be listed in the services line, as they will be
 started on demand by systemd.
Author: Andreas Hasenack <andreas@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1880157
Forwarded: not
Last-Update: 2020-09-03
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/service/realm-sssd-config.c
+++ b/service/realm-sssd-config.c
@@ -130,7 +130,6 @@
     gchar **already;
     gboolean ret;
     gchar *section;
-    const gchar *services[] = { "nss", "pam", NULL };
     va_list va;
     gint i;

@@ -155,7 +154,6 @@
     g_strfreev (already);

     /* Setup a default sssd section */
-    realm_ini_config_set_list_diff (config, "sssd", "services", ", ",
services, NULL);
     if (!realm_ini_config_have (config, "sssd", "config_file_version"))
         realm_ini_config_set (config, "sssd", "config_file_version",
"2", NULL);
--- a/tests/test-sssd-config.c
+++ b/tests/test-sssd-config.c
@@ -90,7 +90,7 @@
                  gconstpointer unused)
 {
     const gchar *data = "[domain/one]\nval=1\n[sssd]\ndomains=one";
-    const gchar *check = "[domain/one]\nval=1\n[sssd]\ndomains = one,
two\nconfig_file_version = 2\nservices = nss, pam\n\n[domain/two]\ndos
= 2\n";
+    const gchar *check = "[domain/one]\nval=1\n[sssd]\ndomains = one,
two\nconfig_file_version = 2\n\n[domain/two]\ndos = 2\n";
     GError *error = NULL;
     gchar *output;
     gboolean ret;
@@ -140,7 +140,7 @@
 test_add_domain_only (Test *test,
                       gconstpointer unused)
 {
-    const gchar *check = "\n[sssd]\ndomains =
two\nconfig_file_version = 2\nservices = nss, pam\n\n[domain/two]\ndos
= 2\n";
+    const gchar *check = "\n[sssd]\ndomains =
two\nconfig_file_version = 2\n\n[domain/two]\ndos = 2\n";
     GError *error = NULL;
     gchar *output;
     gboolean ret;


I sent this to the realmd mailing list here:
https://lists.fedorahosted.org/archives/list/sssd-users@lists.fedorahosted.org/thread/JC3N3DBSMHZSA66IPLGAMBSXLCTYXWJR/

But didn't get the discussion I was hoping, only getting responses
against the socket activation mechanism.

I'm submitting it here for your consideration for the debian realmd
package, or maybe at least restart the upstream discussion about the
best way to do this configuration.

Thanks!

#1003620#10
Date:
2022-06-17 18:06:34 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
realmd, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1003620@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jeremy Bicha <jbicha@ubuntu.com> (supplier of updated realmd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Fri, 17 Jun 2022 13:33:21 -0400
Source: realmd
Built-For-Profiles: noudeb
Architecture: source
Version: 0.17.0-2
Distribution: unstable
Urgency: medium
Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Changed-By: Jeremy Bicha <jbicha@ubuntu.com>
Closes: 1003620
Launchpad-Bugs-Fixed: 1961443
Changes:
 realmd (0.17.0-2) unstable; urgency=medium
 .
   * Team upload
 .
   [ Andreas Hasenack ]
   * d/p/03_ldap-discovery-socket-timeout.patch: use a shorter timeout
     for the unbind request sent when finishing up the discovery phase
   * d/p/04_add-computer-name-to-manpage.patch: document the existing
     --computer-name command line option
   * d/p/05_dont-add-services-line.patch: in Ubuntu and Debian, the sssd_*
     services are socket activated and don't need a "services" line in
     sssd.conf (LP #1880157) (Closes: #1003620)
   * d/p/06_samba_415_update.patch, d/rules: update for net ads join
     command from samba 4.15 (LP: #1961443)
 .
   [ Jeremy Bicha ]
   * Build-Depend on debhelper-compat 13
Checksums-Sha1:
 9d9068da8874cfba4a3f4eec6a856661b874ce05 2090 realmd_0.17.0-2.dsc
 0b39515f118a1b1a5a9a8513c4c634a691246fbc 24308 realmd_0.17.0-2.debian.tar.xz
 f17acdb3c4c49d13b945e193829665a35c1ce070 8510 realmd_0.17.0-2_source.buildinfo
Checksums-Sha256:
 7fe16c59aeb4ac9f00e2c4a86a7f0173f9d3a075d33b672ac85330a53070238d 2090 realmd_0.17.0-2.dsc
 4fbc46a6ac95c33a114cd9bcb52a969302594a8929953b70c027a6d9fe1a61e2 24308 realmd_0.17.0-2.debian.tar.xz
 e892d20868c51f8b5c9a4c305c438d89b595115802db3dffdbd1e954afa10f3b 8510 realmd_0.17.0-2_source.buildinfo
Files:
 fcbd4859aa59819acc076d286ad30aaf 2090 admin optional realmd_0.17.0-2.dsc
 e9d99d6a35b33812b8110b5e82a0da27 24308 admin optional realmd_0.17.0-2.debian.tar.xz
 52a1f5c20c827c5db5be4139aa9c1204 8510 admin optional realmd_0.17.0-2_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEETQvhLw5HdtiqzpaW5mx3Wuv+bH0FAmKsvXwACgkQ5mx3Wuv+
bH3tZQ/+I5MUV45wTJewgvNCHh2+6baBscJ1N+xe+eFmRAiKFs/Y7/Ca4+IM7K2K
M+3Y4gmq6tmepAx6843ypbr4wPXuwGm3WSIe4ocP45uXHb6GgK9YBHP3dNlTGBfG
fycxymPeFdGY0IBSQI0sV4BQOCFFnDLcnUboQOtw4RfEJEcc3JzSRhZuTrdNJDwm
Llnf1A5zIuI9QoH/DBqs+jBxYEEQQL77uviOvDwIDCX3zL7z7ytpAuJe9hoWjIKC
B/myYowRi8Y7Px3bRQOzAxyNyTmKmVJ33VklkdtEgBBZTTFnH1titcQ+DP0vDHKc
aQpUVTnDDIeKsG/dKVCXrutUfbjdA4Ot/WuzQb0ZGkv5WwkX2t7tPsFAdBZUntfp
yl6YQJYHhQwcfQxaA8UPCx5w2nWkGD7O9EEc/GthoTJyDneguTeNUqYnaAPPwpIC
yQzfKK0jf4Ar+BzPBm8yRJOfpp+7AfnaLIDXKXY2Jgl7zZ4vYIqmV2WkW5g04ooN
v/rgu5HCR1y4oR764BARfHrmrM5lYUrMQVMHZIZY3gRaXeI8bPx0HS4WbKo8b7IL
QVsmo/M5JxKTTm4b6hKYNLjVUyy5H8crQ8HcnUJ+sWh47j1rTLYr1mEbt8aMmQH3
5H+s3CKahJh5xL0j5dUWnCzHMzEZfL/s43yzvWXOU5/f9vtWJQA=
=UR2F
-----END PGP SIGNATURE-----