pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0005-net-groupmap-force-using-empty-config.patch

6d47df
From 7f8858f8632d77497765bab79922f1762ce46d50 Mon Sep 17 00:00:00 2001
6d47df
From: Alexander Bokovoy <abokovoy@redhat.com>
6d47df
Date: Tue, 16 Oct 2018 17:54:09 +0300
6d47df
Subject: [PATCH] net groupmap: force using empty config when mapping Guests
6d47df
6d47df
When we define a group mapping for BUILTIN\Guests to 'nobody' group in
6d47df
we run 'net groupmap add ...' with a default /etc/samba/smb.conf which
6d47df
is now configured to use ipasam passdb module. We authenticate to LDAP
6d47df
with GSSAPI in ipasam passdb module initialization.
6d47df
6d47df
If GSSAPI authentication failed (KDC is offline, for example, during
6d47df
server upgrade), 'net groupmap add' crashes after ~10 attempts to
6d47df
re-authenticate. This is intended behavior in smbd/winbindd as they
6d47df
cannot work anymore. However, for the command line tools there are
6d47df
plenty of operations where passdb module is not needed.
6d47df
6d47df
Additionally, GSSAPI authentication uses the default ccache in the
6d47df
environment and a key from /etc/samba/samba.keytab keytab. This means
6d47df
that if you'd run 'net *' as root, it will replace whatever Kerberos
6d47df
tickets you have with a TGT for cifs/`hostname` and a service ticket to
6d47df
ldap/`hostname` of IPA master.
6d47df
6d47df
Apply a simple solution to avoid using /etc/samba/smb.conf when we
6d47df
set up the group mapping by specifying '-s /dev/null' in 'net groupmap'
6d47df
call.
6d47df
6d47df
For upgrade code this is enough as in
6d47df
a678336b8b36cdbea2512e79c09e475fdc249569 we enforce use of empty
6d47df
credentials cache during upgrade to prevent tripping on individual
6d47df
ccaches from KEYRING: or KCM: cache collections.
6d47df
6d47df
Related: https://pagure.io/freeipa/issue/7705
6d47df
(cherry picked from commit e48f5a4d64d95c4c5cb5f8ede39cae5c7c1e512c)
6d47df
---
6d47df
 ipaserver/install/adtrustinstance.py | 4 ++--
6d47df
 1 file changed, 2 insertions(+), 2 deletions(-)
6d47df
6d47df
diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
6d47df
index da16748cf..3a751ccb2 100644
6d47df
--- a/ipaserver/install/adtrustinstance.py
6d47df
+++ b/ipaserver/install/adtrustinstance.py
6d47df
@@ -114,8 +114,8 @@ def make_netbios_name(s):
6d47df
 
6d47df
 def map_Guests_to_nobody():
6d47df
     env = {'LC_ALL': 'C'}
6d47df
-    args = [paths.NET, 'groupmap', 'add', 'sid=S-1-5-32-546',
6d47df
-            'unixgroup=nobody', 'type=builtin']
6d47df
+    args = [paths.NET, '-s', '/dev/null', 'groupmap', 'add',
6d47df
+            'sid=S-1-5-32-546', 'unixgroup=nobody', 'type=builtin']
6d47df
 
6d47df
     logger.debug("Map BUILTIN\\Guests to a group 'nobody'")
6d47df
     ipautil.run(args, env=env, raiseonerr=False, capture_error=True)
6d47df
-- 
6d47df
2.17.2
6d47df