Blame SOURCES/0004-CONFIG-Add-a-new-option-auto_private_groups.patch

ced1f5
From 1deab05ac0820d9be261b55027a90078a758febd Mon Sep 17 00:00:00 2001
ced1f5
From: Jakub Hrozek <jhrozek@redhat.com>
ced1f5
Date: Tue, 3 Oct 2017 12:34:33 +0200
ced1f5
Subject: [PATCH 04/21] CONFIG: Add a new option auto_private_groups
ced1f5
MIME-Version: 1.0
ced1f5
Content-Type: text/plain; charset=UTF-8
ced1f5
Content-Transfer-Encoding: 8bit
ced1f5
ced1f5
The auto_private_groups option is used to configure the domain->mpg flag
ced1f5
which was already set automatically for subdomains, but for some time was
ced1f5
not settable by the admin via the configuration file.
ced1f5
ced1f5
The new option name, instead of the old magic_private_groups, was chosen
ced1f5
purely because this name would hopefully be better understood by admins.
ced1f5
ced1f5
The option doesn't do anything yet, it is just added to all the places a
ced1f5
new option should be added to.
ced1f5
ced1f5
Related:
ced1f5
    https://pagure.io/SSSD/sssd/issue/1872
ced1f5
ced1f5
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
ced1f5
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
ced1f5
(cherry picked from commit d72ac2c58360cd272277b5ddde67bbff53106a74)
ced1f5
---
ced1f5
 src/confdb/confdb.c                  |  8 ++++++++
ced1f5
 src/confdb/confdb.h                  |  1 +
ced1f5
 src/config/SSSDConfig/__init__.py.in |  1 +
ced1f5
 src/config/SSSDConfigTest.py         |  6 ++++--
ced1f5
 src/config/cfg_rules.ini             |  1 +
ced1f5
 src/config/etc/sssd.api.conf         |  1 +
ced1f5
 src/man/sssd.conf.5.xml              | 20 ++++++++++++++++++++
ced1f5
 7 files changed, 36 insertions(+), 2 deletions(-)
ced1f5
ced1f5
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
ced1f5
index fefecc03d554f6eca12efe07990bfae17033bd02..a028224817f12ace2a0c4165d7b9cb0bb80ce5a1 100644
ced1f5
--- a/src/confdb/confdb.c
ced1f5
+++ b/src/confdb/confdb.c
ced1f5
@@ -936,6 +936,14 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
ced1f5
         goto done;
ced1f5
     }
ced1f5
 
ced1f5
+    ret = get_entry_as_bool(res->msgs[0], &domain->mpg,
ced1f5
+                            CONFDB_DOMAIN_AUTO_UPG, 0);
ced1f5
+    if (ret != EOK) {
ced1f5
+        DEBUG(SSSDBG_FATAL_FAILURE,
ced1f5
+              "Invalid value for %s\n", CONFDB_DOMAIN_AUTO_UPG);
ced1f5
+        goto done;
ced1f5
+    }
ced1f5
+
ced1f5
     if (strcasecmp(domain->provider, "local") == 0) {
ced1f5
         /* If this is the local provider, we need to ensure that
ced1f5
          * no other provider was specified for other types, since
ced1f5
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
ced1f5
index bcea99ae49a3fa5f0393ce6b2c215b5b2d4bc3fc..2539b906993edbceb38aac9265e04deed69cf2e4 100644
ced1f5
--- a/src/confdb/confdb.h
ced1f5
+++ b/src/confdb/confdb.h
ced1f5
@@ -198,6 +198,7 @@
ced1f5
 #define CONFDB_DEFAULT_CACHE_CREDS_MIN_FF_LENGTH 8
ced1f5
 #define CONFDB_DOMAIN_LEGACY_PASS "store_legacy_passwords"
ced1f5
 #define CONFDB_DOMAIN_MPG "magic_private_groups"
ced1f5
+#define CONFDB_DOMAIN_AUTO_UPG "auto_private_groups"
ced1f5
 #define CONFDB_DOMAIN_FQ "use_fully_qualified_names"
ced1f5
 #define CONFDB_DOMAIN_ENTRY_CACHE_TIMEOUT "entry_cache_timeout"
ced1f5
 #define CONFDB_DOMAIN_ACCOUNT_CACHE_EXPIRATION "account_cache_expiration"
ced1f5
diff --git a/src/config/SSSDConfig/__init__.py.in b/src/config/SSSDConfig/__init__.py.in
ced1f5
index d99b718e09283d113f73639e0f94e7f1cec55f68..d2bb709d69c8790558b5c06a7e405463b508c189 100644
ced1f5
--- a/src/config/SSSDConfig/__init__.py.in
ced1f5
+++ b/src/config/SSSDConfig/__init__.py.in
ced1f5
@@ -195,6 +195,7 @@ option_strings = {
ced1f5
     'cached_auth_timeout' : _('How long can cached credentials be used for cached authentication'),
ced1f5
     'full_name_format' : _('Printf-compatible format for displaying fully-qualified names'),
ced1f5
     're_expression' : _('Regex to parse username and domain'),
ced1f5
+    'auto_private_groups' : _('Whether to automatically create private groups for users'),
ced1f5
 
ced1f5
     # [provider/ipa]
ced1f5
     'ipa_domain' : _('IPA domain'),
ced1f5
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
ced1f5
index 4a583bdd3124dc05a116d2e6bd48afb92aa0b54d..87d1f6e6410dfeafc77d578cf0b950dc71a1f0a2 100755
ced1f5
--- a/src/config/SSSDConfigTest.py
ced1f5
+++ b/src/config/SSSDConfigTest.py
ced1f5
@@ -624,7 +624,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
ced1f5
             'subdomain_homedir',
ced1f5
             'full_name_format',
ced1f5
             're_expression',
ced1f5
-            'cached_auth_timeout']
ced1f5
+            'cached_auth_timeout',
ced1f5
+            'auto_private_groups']
ced1f5
 
ced1f5
         self.assertTrue(type(options) == dict,
ced1f5
                         "Options should be a dictionary")
ced1f5
@@ -994,7 +995,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
ced1f5
             'subdomain_homedir',
ced1f5
             'full_name_format',
ced1f5
             're_expression',
ced1f5
-            'cached_auth_timeout']
ced1f5
+            'cached_auth_timeout',
ced1f5
+            'auto_private_groups']
ced1f5
 
ced1f5
         self.assertTrue(type(options) == dict,
ced1f5
                         "Options should be a dictionary")
ced1f5
diff --git a/src/config/cfg_rules.ini b/src/config/cfg_rules.ini
ced1f5
index e49e8d43f4aead14d833866110784fd62382cc2b..4e70bf7b6f0fa7421a0c35bd4279830265bf3470 100644
ced1f5
--- a/src/config/cfg_rules.ini
ced1f5
+++ b/src/config/cfg_rules.ini
ced1f5
@@ -382,6 +382,7 @@ option = cached_auth_timeout
ced1f5
 option = wildcard_limit
ced1f5
 option = full_name_format
ced1f5
 option = re_expression
ced1f5
+option = auto_private_groups
ced1f5
 
ced1f5
 #Entry cache timeouts
ced1f5
 option = entry_cache_user_timeout
ced1f5
diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf
ced1f5
index 7f2b8977b7e67fcfc20df49056cda8ebe6da0be8..2be2e3e685ba3abd9a4a419f93332a89ff774262 100644
ced1f5
--- a/src/config/etc/sssd.api.conf
ced1f5
+++ b/src/config/etc/sssd.api.conf
ced1f5
@@ -185,6 +185,7 @@ subdomain_homedir = str, None, false
ced1f5
 cached_auth_timeout = int, None, false
ced1f5
 full_name_format = str, None, false
ced1f5
 re_expression = str, None, false
ced1f5
+auto_private_groups = str, None, false
ced1f5
 
ced1f5
 #Entry cache timeouts
ced1f5
 entry_cache_user_timeout = int, None, false
ced1f5
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
ced1f5
index 7443f718319e292842c670aaf47cfc537545d021..47da07c33bdcfbf2fa94ff932492e9ea4bbfe846 100644
ced1f5
--- a/src/man/sssd.conf.5.xml
ced1f5
+++ b/src/man/sssd.conf.5.xml
ced1f5
@@ -2823,6 +2823,26 @@ subdomain_inherit = ldap_purge_cache_timeout
ced1f5
                         </para>
ced1f5
                     </listitem>
ced1f5
                 </varlistentry>
ced1f5
+                <varlistentry>
ced1f5
+                    <term>auto_private_groups (string)</term>
ced1f5
+                    <listitem>
ced1f5
+                        <para>
ced1f5
+                            If this option is enabled, SSSD will automatically
ced1f5
+                            create user private groups based on user's
ced1f5
+                            UID number. The GID number is ignored in this case.
ced1f5
+                        </para>
ced1f5
+                        <para>
ced1f5
+                            NOTE: Because the GID number and the user private group
ced1f5
+                            are inferred frm the UID number, it is not supported
ced1f5
+                            to have multiple entries with the same UID or GID number
ced1f5
+                            with this option. In other words, enabling this option
ced1f5
+                            enforces uniqueness across the ID space.
ced1f5
+                        </para>
ced1f5
+                        <para>
ced1f5
+                            Default: False
ced1f5
+                        </para>
ced1f5
+                    </listitem>
ced1f5
+                </varlistentry>
ced1f5
             </variablelist>
ced1f5
         </para>
ced1f5
 
ced1f5
-- 
ced1f5
2.13.5
ced1f5