|
|
bb7cd1 |
From 75a8d8e7996c35fd9bef504f2f4d3e308b7553c8 Mon Sep 17 00:00:00 2001
|
|
|
bb7cd1 |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
bb7cd1 |
Date: Wed, 22 Mar 2017 12:53:17 +0100
|
|
|
bb7cd1 |
Subject: [PATCH 61/72] CONFDB: Introduce SSSD domain type to distinguish POSIX
|
|
|
bb7cd1 |
and application domains
|
|
|
bb7cd1 |
MIME-Version: 1.0
|
|
|
bb7cd1 |
Content-Type: text/plain; charset=UTF-8
|
|
|
bb7cd1 |
Content-Transfer-Encoding: 8bit
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Related to:
|
|
|
bb7cd1 |
https://pagure.io/SSSD/sssd/issue/3310
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Adds a new option that allows to distinguish domains that do contain
|
|
|
bb7cd1 |
POSIX users and groups and those that don't. The POSIX domains are the
|
|
|
bb7cd1 |
default. The non-POSIX domains are selected by selecting an
|
|
|
bb7cd1 |
"application" type domain.
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
bb7cd1 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
bb7cd1 |
---
|
|
|
bb7cd1 |
src/confdb/confdb.c | 18 +++++++++++++++++-
|
|
|
bb7cd1 |
src/confdb/confdb.h | 15 +++++++++++++++
|
|
|
bb7cd1 |
src/config/SSSDConfig/__init__.py.in | 1 +
|
|
|
bb7cd1 |
src/config/SSSDConfigTest.py | 2 ++
|
|
|
bb7cd1 |
src/config/cfg_rules.ini | 1 +
|
|
|
bb7cd1 |
src/config/etc/sssd.api.conf | 1 +
|
|
|
bb7cd1 |
src/man/sssd.conf.5.xml | 33 +++++++++++++++++++++++++++++++++
|
|
|
bb7cd1 |
src/util/domain_info_utils.c | 14 ++++++++++++++
|
|
|
bb7cd1 |
src/util/util.h | 1 +
|
|
|
bb7cd1 |
9 files changed, 85 insertions(+), 1 deletion(-)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
|
|
|
bb7cd1 |
index d82fd98ee02928b3c20df014528bd869ec946f92..70a1eb7b2c7e83dfa9d217a15c7d3d4c8580b891 100644
|
|
|
bb7cd1 |
--- a/src/confdb/confdb.c
|
|
|
bb7cd1 |
+++ b/src/confdb/confdb.c
|
|
|
bb7cd1 |
@@ -1367,6 +1367,22 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+ domain->type = DOM_TYPE_POSIX;
|
|
|
bb7cd1 |
+ tmp = ldb_msg_find_attr_as_string(res->msgs[0],
|
|
|
bb7cd1 |
+ CONFDB_DOMAIN_TYPE,
|
|
|
bb7cd1 |
+ CONFDB_DOMAIN_TYPE_POSIX);
|
|
|
bb7cd1 |
+ if (tmp != NULL) {
|
|
|
bb7cd1 |
+ if (strcasecmp(tmp, CONFDB_DOMAIN_TYPE_POSIX) == 0) {
|
|
|
bb7cd1 |
+ domain->type = DOM_TYPE_POSIX;
|
|
|
bb7cd1 |
+ } else if (strcasecmp(tmp, CONFDB_DOMAIN_TYPE_APP) == 0) {
|
|
|
bb7cd1 |
+ domain->type = DOM_TYPE_APPLICATION;
|
|
|
bb7cd1 |
+ } else {
|
|
|
bb7cd1 |
+ DEBUG(SSSDBG_FATAL_FAILURE,
|
|
|
bb7cd1 |
+ "Invalid value %s for [%s]\n", tmp, CONFDB_DOMAIN_TYPE);
|
|
|
bb7cd1 |
+ goto done;
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
ret = get_entry_as_uint32(res->msgs[0], &domain->subdomain_refresh_interval,
|
|
|
bb7cd1 |
CONFDB_DOMAIN_SUBDOMAIN_REFRESH, 14400);
|
|
|
bb7cd1 |
if (ret != EOK || domain->subdomain_refresh_interval == 0) {
|
|
|
bb7cd1 |
@@ -1444,7 +1460,7 @@ int confdb_get_domains(struct confdb_ctx *cdb,
|
|
|
bb7cd1 |
if (ret) {
|
|
|
bb7cd1 |
DEBUG(SSSDBG_FATAL_FAILURE,
|
|
|
bb7cd1 |
"Error (%d [%s]) retrieving domain [%s], skipping!\n",
|
|
|
bb7cd1 |
- ret, sss_strerror(ret), domlist[i]);
|
|
|
bb7cd1 |
+ ret, sss_strerror(ret), domlist[i]);
|
|
|
bb7cd1 |
continue;
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
|
|
|
bb7cd1 |
index 56a603652d6c8256735e7f8b125300ff7b254645..a4046610f3cdbdb832de8924bf4397fb0018f2db 100644
|
|
|
bb7cd1 |
--- a/src/confdb/confdb.h
|
|
|
bb7cd1 |
+++ b/src/confdb/confdb.h
|
|
|
bb7cd1 |
@@ -209,6 +209,9 @@
|
|
|
bb7cd1 |
#define CONFDB_DOMAIN_OFFLINE_TIMEOUT "offline_timeout"
|
|
|
bb7cd1 |
#define CONFDB_DOMAIN_SUBDOMAIN_INHERIT "subdomain_inherit"
|
|
|
bb7cd1 |
#define CONFDB_DOMAIN_CACHED_AUTH_TIMEOUT "cached_auth_timeout"
|
|
|
bb7cd1 |
+#define CONFDB_DOMAIN_TYPE "domain_type"
|
|
|
bb7cd1 |
+#define CONFDB_DOMAIN_TYPE_POSIX "posix"
|
|
|
bb7cd1 |
+#define CONFDB_DOMAIN_TYPE_APP "application"
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
/* Local Provider */
|
|
|
bb7cd1 |
#define CONFDB_LOCAL_DEFAULT_SHELL "default_shell"
|
|
|
bb7cd1 |
@@ -261,11 +264,23 @@ enum sss_domain_state {
|
|
|
bb7cd1 |
DOM_INCONSISTENT,
|
|
|
bb7cd1 |
};
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+/** Whether the domain only supports looking up POSIX entries */
|
|
|
bb7cd1 |
+enum sss_domain_type {
|
|
|
bb7cd1 |
+ /** This is the default domain type. It resolves only entries
|
|
|
bb7cd1 |
+ * with the full POSIX set of attributes
|
|
|
bb7cd1 |
+ */
|
|
|
bb7cd1 |
+ DOM_TYPE_POSIX,
|
|
|
bb7cd1 |
+ /** In this mode, entries are typically resolved only by name */
|
|
|
bb7cd1 |
+ DOM_TYPE_APPLICATION,
|
|
|
bb7cd1 |
+};
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
/**
|
|
|
bb7cd1 |
* Data structure storing all of the basic features
|
|
|
bb7cd1 |
* of a domain.
|
|
|
bb7cd1 |
*/
|
|
|
bb7cd1 |
struct sss_domain_info {
|
|
|
bb7cd1 |
+ enum sss_domain_type type;
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
char *name;
|
|
|
bb7cd1 |
char *conn_name;
|
|
|
bb7cd1 |
char *provider;
|
|
|
bb7cd1 |
diff --git a/src/config/SSSDConfig/__init__.py.in b/src/config/SSSDConfig/__init__.py.in
|
|
|
bb7cd1 |
index e7fb7673d393d4f12910f355d3edf33f4390c1f1..806611b6076048c08ce08c772dbd3cea5fdd656c 100644
|
|
|
bb7cd1 |
--- a/src/config/SSSDConfig/__init__.py.in
|
|
|
bb7cd1 |
+++ b/src/config/SSSDConfig/__init__.py.in
|
|
|
bb7cd1 |
@@ -148,6 +148,7 @@ option_strings = {
|
|
|
bb7cd1 |
'selinux_provider' : _('SELinux provider'),
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
# [domain]
|
|
|
bb7cd1 |
+ 'domain_type' : _('Whether the domain is usable by the OS or by applications'),
|
|
|
bb7cd1 |
'min_id' : _('Minimum user ID'),
|
|
|
bb7cd1 |
'max_id' : _('Maximum user ID'),
|
|
|
bb7cd1 |
'enumerate' : _('Enable enumerating all users/groups'),
|
|
|
bb7cd1 |
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
|
|
|
bb7cd1 |
index 6899bf8ae04bf210546c8cbdba8235f094e23dc0..9b3175962c697e314b3d5d94c2bc5beda537b66e 100755
|
|
|
bb7cd1 |
--- a/src/config/SSSDConfigTest.py
|
|
|
bb7cd1 |
+++ b/src/config/SSSDConfigTest.py
|
|
|
bb7cd1 |
@@ -510,6 +510,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
|
|
|
bb7cd1 |
'debug',
|
|
|
bb7cd1 |
'debug_level',
|
|
|
bb7cd1 |
'debug_timestamps',
|
|
|
bb7cd1 |
+ 'domain_type',
|
|
|
bb7cd1 |
'min_id',
|
|
|
bb7cd1 |
'max_id',
|
|
|
bb7cd1 |
'timeout',
|
|
|
bb7cd1 |
@@ -878,6 +879,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
|
|
|
bb7cd1 |
'debug',
|
|
|
bb7cd1 |
'debug_level',
|
|
|
bb7cd1 |
'debug_timestamps',
|
|
|
bb7cd1 |
+ 'domain_type',
|
|
|
bb7cd1 |
'min_id',
|
|
|
bb7cd1 |
'max_id',
|
|
|
bb7cd1 |
'timeout',
|
|
|
bb7cd1 |
diff --git a/src/config/cfg_rules.ini b/src/config/cfg_rules.ini
|
|
|
bb7cd1 |
index 41efcea552a82c5492a0d21a8d0797ee42cdc8c7..3c857236eaa55b313d176bc4bb479918163b60d5 100644
|
|
|
bb7cd1 |
--- a/src/config/cfg_rules.ini
|
|
|
bb7cd1 |
+++ b/src/config/cfg_rules.ini
|
|
|
bb7cd1 |
@@ -311,6 +311,7 @@ option = subdomains_provider
|
|
|
bb7cd1 |
option = selinux_provider
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
# Options available to all domains
|
|
|
bb7cd1 |
+option = domain_type
|
|
|
bb7cd1 |
option = min_id
|
|
|
bb7cd1 |
option = max_id
|
|
|
bb7cd1 |
option = timeout
|
|
|
bb7cd1 |
diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf
|
|
|
bb7cd1 |
index 6965028e1ca748f8b6677d9fc1faa66d5c307a0c..a38b24208f89e4502e41625c540ea9958d5bbffe 100644
|
|
|
bb7cd1 |
--- a/src/config/etc/sssd.api.conf
|
|
|
bb7cd1 |
+++ b/src/config/etc/sssd.api.conf
|
|
|
bb7cd1 |
@@ -129,6 +129,7 @@ selinux_provider = str, None, false
|
|
|
bb7cd1 |
[domain]
|
|
|
bb7cd1 |
# Options available to all domains
|
|
|
bb7cd1 |
description = str, None, false
|
|
|
bb7cd1 |
+domain_type = str, None, false
|
|
|
bb7cd1 |
debug = int, None, false
|
|
|
bb7cd1 |
debug_level = int, None, false
|
|
|
bb7cd1 |
debug_timestamps = bool, None, false
|
|
|
bb7cd1 |
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
|
|
|
bb7cd1 |
index 4fe13b85d511fb6a2ccc9b4de956710b05bc898c..9abcff84a95ea1b27e36845e830cc125fdc89f90 100644
|
|
|
bb7cd1 |
--- a/src/man/sssd.conf.5.xml
|
|
|
bb7cd1 |
+++ b/src/man/sssd.conf.5.xml
|
|
|
bb7cd1 |
@@ -1512,6 +1512,39 @@ pam_account_locked_message = Account locked, please contact help desk.
|
|
|
bb7cd1 |
<quote>[domain/<replaceable>NAME</replaceable>]</quote>
|
|
|
bb7cd1 |
<variablelist>
|
|
|
bb7cd1 |
<varlistentry>
|
|
|
bb7cd1 |
+ <term>domain_type (string)</term>
|
|
|
bb7cd1 |
+ <listitem>
|
|
|
bb7cd1 |
+ <para>
|
|
|
bb7cd1 |
+ Specifies whether the domain is meant to be used
|
|
|
bb7cd1 |
+ by POSIX-aware clients such as the Name Service Switch
|
|
|
bb7cd1 |
+ or by applications that do not need POSIX data to be
|
|
|
bb7cd1 |
+ present or generated. Only objects from POSIX domains
|
|
|
bb7cd1 |
+ are available to the operating system interfaces and
|
|
|
bb7cd1 |
+ utilities.
|
|
|
bb7cd1 |
+ </para>
|
|
|
bb7cd1 |
+ <para>
|
|
|
bb7cd1 |
+ Allowed values for this option are <quote>posix</quote>
|
|
|
bb7cd1 |
+ and <quote>application</quote>.
|
|
|
bb7cd1 |
+ </para>
|
|
|
bb7cd1 |
+ <para>
|
|
|
bb7cd1 |
+ POSIX domains are reachable by all services. Application
|
|
|
bb7cd1 |
+ domains are only reachable from the InfoPipe responder (see
|
|
|
bb7cd1 |
+ <citerefentry>
|
|
|
bb7cd1 |
+ <refentrytitle>sssd-ifp</refentrytitle>
|
|
|
bb7cd1 |
+ <manvolnum>5</manvolnum>
|
|
|
bb7cd1 |
+ </citerefentry>) and the PAM responder.
|
|
|
bb7cd1 |
+ </para>
|
|
|
bb7cd1 |
+ <para>
|
|
|
bb7cd1 |
+ NOTE: The application domains are currently well tested with
|
|
|
bb7cd1 |
+ <quote>id_provider=ldap</quote> only.
|
|
|
bb7cd1 |
+ </para>
|
|
|
bb7cd1 |
+ <para>
|
|
|
bb7cd1 |
+ Default: posix
|
|
|
bb7cd1 |
+ </para>
|
|
|
bb7cd1 |
+ </listitem>
|
|
|
bb7cd1 |
+ </varlistentry>
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+ <varlistentry>
|
|
|
bb7cd1 |
<term>min_id,max_id (integer)</term>
|
|
|
bb7cd1 |
<listitem>
|
|
|
bb7cd1 |
<para>
|
|
|
bb7cd1 |
diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c
|
|
|
bb7cd1 |
index a7f118842aa8ba870143b2f2b425a3e3c0ea5a78..2af7852f03f89b61f5b9fd8a244e98fb27b7e6a2 100644
|
|
|
bb7cd1 |
--- a/src/util/domain_info_utils.c
|
|
|
bb7cd1 |
+++ b/src/util/domain_info_utils.c
|
|
|
bb7cd1 |
@@ -885,3 +885,17 @@ char *subdomain_create_conf_path(TALLOC_CTX *mem_ctx,
|
|
|
bb7cd1 |
subdomain->parent->name,
|
|
|
bb7cd1 |
subdomain->name);
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
+const char *sss_domain_type_str(struct sss_domain_info *dom)
|
|
|
bb7cd1 |
+{
|
|
|
bb7cd1 |
+ if (dom == NULL) {
|
|
|
bb7cd1 |
+ return "BUG: Invalid domain";
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+ switch (dom->type) {
|
|
|
bb7cd1 |
+ case DOM_TYPE_POSIX:
|
|
|
bb7cd1 |
+ return "POSIX";
|
|
|
bb7cd1 |
+ case DOM_TYPE_APPLICATION:
|
|
|
bb7cd1 |
+ return "Application";
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+ return "Unknown";
|
|
|
bb7cd1 |
+}
|
|
|
bb7cd1 |
diff --git a/src/util/util.h b/src/util/util.h
|
|
|
bb7cd1 |
index 2170c5fb7cffda3910d2b58e33ec7abe3ec4a7d4..436550f5078cc173b8ed8cb58836d366f813146b 100644
|
|
|
bb7cd1 |
--- a/src/util/util.h
|
|
|
bb7cd1 |
+++ b/src/util/util.h
|
|
|
bb7cd1 |
@@ -539,6 +539,7 @@ enum sss_domain_state sss_domain_get_state(struct sss_domain_info *dom);
|
|
|
bb7cd1 |
void sss_domain_set_state(struct sss_domain_info *dom,
|
|
|
bb7cd1 |
enum sss_domain_state state);
|
|
|
bb7cd1 |
bool is_email_from_domain(const char *email, struct sss_domain_info *dom);
|
|
|
bb7cd1 |
+const char *sss_domain_type_str(struct sss_domain_info *dom);
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
struct sss_domain_info*
|
|
|
bb7cd1 |
sss_get_domain_by_sid_ldap_fallback(struct sss_domain_info *domain,
|
|
|
bb7cd1 |
--
|
|
|
bb7cd1 |
2.9.3
|
|
|
bb7cd1 |
|