|
|
bac598 |
From d63172f1277c5ed166a22f04d144bf85ded4757c Mon Sep 17 00:00:00 2001
|
|
|
bac598 |
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
|
|
|
bac598 |
Date: Fri, 9 Oct 2020 13:03:54 +0200
|
|
|
bac598 |
Subject: [PATCH 25/27] pam: add pam_gssapi_services option
|
|
|
bac598 |
|
|
|
bac598 |
:config: Added `pam_gssapi_services` to list PAM services
|
|
|
bac598 |
that can authenticate using GSSAPI
|
|
|
bac598 |
|
|
|
bac598 |
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
|
|
|
bac598 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
bac598 |
---
|
|
|
bac598 |
src/confdb/confdb.c | 12 +++++++++++
|
|
|
bac598 |
src/confdb/confdb.h | 4 ++++
|
|
|
bac598 |
src/config/SSSDConfig/sssdoptions.py | 1 +
|
|
|
bac598 |
src/config/SSSDConfigTest.py | 6 ++++--
|
|
|
bac598 |
src/config/cfg_rules.ini | 3 +++
|
|
|
bac598 |
src/config/etc/sssd.api.conf | 2 ++
|
|
|
bac598 |
src/db/sysdb_subdomains.c | 13 ++++++++++++
|
|
|
bac598 |
src/man/sssd.conf.5.xml | 30 ++++++++++++++++++++++++++++
|
|
|
bac598 |
src/responder/pam/pamsrv.c | 21 +++++++++++++++++++
|
|
|
bac598 |
src/responder/pam/pamsrv.h | 3 +++
|
|
|
bac598 |
10 files changed, 93 insertions(+), 2 deletions(-)
|
|
|
bac598 |
|
|
|
bac598 |
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
|
|
|
bac598 |
index f981ddf1e..7f1956d6d 100644
|
|
|
bac598 |
--- a/src/confdb/confdb.c
|
|
|
bac598 |
+++ b/src/confdb/confdb.c
|
|
|
bac598 |
@@ -1581,6 +1581,18 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
|
|
|
bac598 |
}
|
|
|
bac598 |
}
|
|
|
bac598 |
|
|
|
bac598 |
+ tmp = ldb_msg_find_attr_as_string(res->msgs[0], CONFDB_PAM_GSSAPI_SERVICES,
|
|
|
bac598 |
+ "-");
|
|
|
bac598 |
+ if (tmp != NULL) {
|
|
|
bac598 |
+ ret = split_on_separator(domain, tmp, ',', true, true,
|
|
|
bac598 |
+ &domain->gssapi_services, NULL);
|
|
|
bac598 |
+ if (ret != 0) {
|
|
|
bac598 |
+ DEBUG(SSSDBG_FATAL_FAILURE,
|
|
|
bac598 |
+ "Cannot parse %s\n", CONFDB_PAM_GSSAPI_SERVICES);
|
|
|
bac598 |
+ goto done;
|
|
|
bac598 |
+ }
|
|
|
bac598 |
+ }
|
|
|
bac598 |
+
|
|
|
bac598 |
domain->has_views = false;
|
|
|
bac598 |
domain->view_name = NULL;
|
|
|
bac598 |
|
|
|
bac598 |
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
|
|
|
bac598 |
index 54e3f7380..7a3bc8bb5 100644
|
|
|
bac598 |
--- a/src/confdb/confdb.h
|
|
|
bac598 |
+++ b/src/confdb/confdb.h
|
|
|
bac598 |
@@ -144,6 +144,7 @@
|
|
|
bac598 |
#define CONFDB_PAM_P11_ALLOWED_SERVICES "pam_p11_allowed_services"
|
|
|
bac598 |
#define CONFDB_PAM_P11_URI "p11_uri"
|
|
|
bac598 |
#define CONFDB_PAM_INITGROUPS_SCHEME "pam_initgroups_scheme"
|
|
|
bac598 |
+#define CONFDB_PAM_GSSAPI_SERVICES "pam_gssapi_services"
|
|
|
bac598 |
|
|
|
bac598 |
/* SUDO */
|
|
|
bac598 |
#define CONFDB_SUDO_CONF_ENTRY "config/sudo"
|
|
|
bac598 |
@@ -431,6 +432,9 @@ struct sss_domain_info {
|
|
|
bac598 |
|
|
|
bac598 |
/* Keytab used by this domain. */
|
|
|
bac598 |
const char *krb5_keytab;
|
|
|
bac598 |
+
|
|
|
bac598 |
+ /* List of PAM services that are allowed to authenticate with GSSAPI. */
|
|
|
bac598 |
+ char **gssapi_services;
|
|
|
bac598 |
};
|
|
|
bac598 |
|
|
|
bac598 |
/**
|
|
|
bac598 |
diff --git a/src/config/SSSDConfig/sssdoptions.py b/src/config/SSSDConfig/sssdoptions.py
|
|
|
bac598 |
index de96db6f4..f59fe8d9f 100644
|
|
|
bac598 |
--- a/src/config/SSSDConfig/sssdoptions.py
|
|
|
bac598 |
+++ b/src/config/SSSDConfig/sssdoptions.py
|
|
|
bac598 |
@@ -104,6 +104,7 @@ class SSSDOptions(object):
|
|
|
bac598 |
'p11_wait_for_card_timeout': _('Additional timeout to wait for a card if requested'),
|
|
|
bac598 |
'p11_uri': _('PKCS#11 URI to restrict the selection of devices for Smartcard authentication'),
|
|
|
bac598 |
'pam_initgroups_scheme' : _('When shall the PAM responder force an initgroups request'),
|
|
|
bac598 |
+ 'pam_gssapi_services' : _('List of PAM services that are allowed to authenticate with GSSAPI.'),
|
|
|
bac598 |
|
|
|
bac598 |
# [sudo]
|
|
|
bac598 |
'sudo_timed': _('Whether to evaluate the time-based attributes in sudo rules'),
|
|
|
bac598 |
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
|
|
|
bac598 |
index 323be5ed3..21fffe1b6 100755
|
|
|
bac598 |
--- a/src/config/SSSDConfigTest.py
|
|
|
bac598 |
+++ b/src/config/SSSDConfigTest.py
|
|
|
bac598 |
@@ -653,7 +653,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
|
|
|
bac598 |
'full_name_format',
|
|
|
bac598 |
're_expression',
|
|
|
bac598 |
'cached_auth_timeout',
|
|
|
bac598 |
- 'auto_private_groups']
|
|
|
bac598 |
+ 'auto_private_groups',
|
|
|
bac598 |
+ 'pam_gssapi_services']
|
|
|
bac598 |
|
|
|
bac598 |
self.assertTrue(type(options) == dict,
|
|
|
bac598 |
"Options should be a dictionary")
|
|
|
bac598 |
@@ -1030,7 +1031,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
|
|
|
bac598 |
'full_name_format',
|
|
|
bac598 |
're_expression',
|
|
|
bac598 |
'cached_auth_timeout',
|
|
|
bac598 |
- 'auto_private_groups']
|
|
|
bac598 |
+ 'auto_private_groups',
|
|
|
bac598 |
+ 'pam_gssapi_services']
|
|
|
bac598 |
|
|
|
bac598 |
self.assertTrue(type(options) == dict,
|
|
|
bac598 |
"Options should be a dictionary")
|
|
|
bac598 |
diff --git a/src/config/cfg_rules.ini b/src/config/cfg_rules.ini
|
|
|
bac598 |
index 773afd8bb..c6dfd5648 100644
|
|
|
bac598 |
--- a/src/config/cfg_rules.ini
|
|
|
bac598 |
+++ b/src/config/cfg_rules.ini
|
|
|
bac598 |
@@ -139,6 +139,7 @@ option = pam_p11_allowed_services
|
|
|
bac598 |
option = p11_wait_for_card_timeout
|
|
|
bac598 |
option = p11_uri
|
|
|
bac598 |
option = pam_initgroups_scheme
|
|
|
bac598 |
+option = pam_gssapi_services
|
|
|
bac598 |
|
|
|
bac598 |
[rule/allowed_sudo_options]
|
|
|
bac598 |
validator = ini_allowed_options
|
|
|
bac598 |
@@ -437,6 +438,7 @@ option = wildcard_limit
|
|
|
bac598 |
option = full_name_format
|
|
|
bac598 |
option = re_expression
|
|
|
bac598 |
option = auto_private_groups
|
|
|
bac598 |
+option = pam_gssapi_services
|
|
|
bac598 |
|
|
|
bac598 |
#Entry cache timeouts
|
|
|
bac598 |
option = entry_cache_user_timeout
|
|
|
bac598 |
@@ -831,6 +833,7 @@ option = ad_backup_server
|
|
|
bac598 |
option = ad_site
|
|
|
bac598 |
option = use_fully_qualified_names
|
|
|
bac598 |
option = auto_private_groups
|
|
|
bac598 |
+option = pam_gssapi_services
|
|
|
bac598 |
|
|
|
bac598 |
[rule/sssd_checks]
|
|
|
bac598 |
validator = sssd_checks
|
|
|
bac598 |
diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf
|
|
|
bac598 |
index 623160ffd..f46f3c46d 100644
|
|
|
bac598 |
--- a/src/config/etc/sssd.api.conf
|
|
|
bac598 |
+++ b/src/config/etc/sssd.api.conf
|
|
|
bac598 |
@@ -80,6 +80,7 @@ pam_p11_allowed_services = str, None, false
|
|
|
bac598 |
p11_wait_for_card_timeout = int, None, false
|
|
|
bac598 |
p11_uri = str, None, false
|
|
|
bac598 |
pam_initgroups_scheme = str, None, false
|
|
|
bac598 |
+pam_gssapi_services = str, None, false
|
|
|
bac598 |
|
|
|
bac598 |
[sudo]
|
|
|
bac598 |
# sudo service
|
|
|
bac598 |
@@ -199,6 +200,7 @@ cached_auth_timeout = int, None, false
|
|
|
bac598 |
full_name_format = str, None, false
|
|
|
bac598 |
re_expression = str, None, false
|
|
|
bac598 |
auto_private_groups = str, None, false
|
|
|
bac598 |
+pam_gssapi_services = str, None, false
|
|
|
bac598 |
|
|
|
bac598 |
#Entry cache timeouts
|
|
|
bac598 |
entry_cache_user_timeout = int, None, false
|
|
|
bac598 |
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
|
|
|
bac598 |
index 5b42f9bdc..bfc6df0f5 100644
|
|
|
bac598 |
--- a/src/db/sysdb_subdomains.c
|
|
|
bac598 |
+++ b/src/db/sysdb_subdomains.c
|
|
|
bac598 |
@@ -184,6 +184,8 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
dom->homedir_substr = parent->homedir_substr;
|
|
|
bac598 |
dom->override_gid = parent->override_gid;
|
|
|
bac598 |
|
|
|
bac598 |
+ dom->gssapi_services = parent->gssapi_services;
|
|
|
bac598 |
+
|
|
|
bac598 |
if (parent->sysdb == NULL) {
|
|
|
bac598 |
DEBUG(SSSDBG_OP_FAILURE, "Missing sysdb context in parent domain.\n");
|
|
|
bac598 |
goto fail;
|
|
|
bac598 |
@@ -241,6 +243,17 @@ check_subdom_config_file(struct confdb_ctx *confdb,
|
|
|
bac598 |
sd_conf_path, CONFDB_DOMAIN_FQ,
|
|
|
bac598 |
subdomain->fqnames ? "TRUE" : "FALSE");
|
|
|
bac598 |
|
|
|
bac598 |
+ /* allow to set pam_gssapi_services */
|
|
|
bac598 |
+ ret = confdb_get_string_as_list(confdb, subdomain, sd_conf_path,
|
|
|
bac598 |
+ CONFDB_PAM_GSSAPI_SERVICES,
|
|
|
bac598 |
+ &subdomain->gssapi_services);
|
|
|
bac598 |
+ if (ret != EOK && ret != ENOENT) {
|
|
|
bac598 |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
bac598 |
+ "Failed to get %s option for the subdomain: %s\n",
|
|
|
bac598 |
+ CONFDB_PAM_GSSAPI_SERVICES, subdomain->name);
|
|
|
bac598 |
+ goto done;
|
|
|
bac598 |
+ }
|
|
|
bac598 |
+
|
|
|
bac598 |
ret = EOK;
|
|
|
bac598 |
done:
|
|
|
bac598 |
talloc_free(tmp_ctx);
|
|
|
bac598 |
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
|
|
|
bac598 |
index d247400bf..db9dd4677 100644
|
|
|
bac598 |
--- a/src/man/sssd.conf.5.xml
|
|
|
bac598 |
+++ b/src/man/sssd.conf.5.xml
|
|
|
bac598 |
@@ -1706,6 +1706,35 @@ p11_uri = library-description=OpenSC%20smartcard%20framework;slot-id=2
|
|
|
bac598 |
</para>
|
|
|
bac598 |
</listitem>
|
|
|
bac598 |
</varlistentry>
|
|
|
bac598 |
+ <varlistentry>
|
|
|
bac598 |
+ <term>pam_gssapi_services</term>
|
|
|
bac598 |
+ <listitem>
|
|
|
bac598 |
+ <para>
|
|
|
bac598 |
+ Comma separated list of PAM services that are
|
|
|
bac598 |
+ allowed to try GSSAPI authentication using
|
|
|
bac598 |
+ pam_sss_gss.so module.
|
|
|
bac598 |
+ </para>
|
|
|
bac598 |
+ <para>
|
|
|
bac598 |
+ To disable GSSAPI authentication, set this option
|
|
|
bac598 |
+ to <quote>-</quote> (dash).
|
|
|
bac598 |
+ </para>
|
|
|
bac598 |
+ <para>
|
|
|
bac598 |
+ Note: This option can also be set per-domain which
|
|
|
bac598 |
+ overwrites the value in [pam] section. It can also
|
|
|
bac598 |
+ be set for trusted domain which overwrites the value
|
|
|
bac598 |
+ in the domain section.
|
|
|
bac598 |
+ </para>
|
|
|
bac598 |
+ <para>
|
|
|
bac598 |
+ Example:
|
|
|
bac598 |
+ <programlisting>
|
|
|
bac598 |
+pam_gssapi_services = sudo, sudo-i
|
|
|
bac598 |
+ </programlisting>
|
|
|
bac598 |
+ </para>
|
|
|
bac598 |
+ <para>
|
|
|
bac598 |
+ Default: - (GSSAPI authentication is disabled)
|
|
|
bac598 |
+ </para>
|
|
|
bac598 |
+ </listitem>
|
|
|
bac598 |
+ </varlistentry>
|
|
|
bac598 |
</variablelist>
|
|
|
bac598 |
</refsect2>
|
|
|
bac598 |
|
|
|
bac598 |
@@ -3780,6 +3809,7 @@ ldap_user_extra_attrs = phone:telephoneNumber
|
|
|
bac598 |
<para>ad_backup_server,</para>
|
|
|
bac598 |
<para>ad_site,</para>
|
|
|
bac598 |
<para>use_fully_qualified_names</para>
|
|
|
bac598 |
+ <para>pam_gssapi_services</para>
|
|
|
bac598 |
<para>
|
|
|
bac598 |
For more details about these options see their individual description
|
|
|
bac598 |
in the manual page.
|
|
|
bac598 |
diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c
|
|
|
bac598 |
index 1f1ee608b..0492569c7 100644
|
|
|
bac598 |
--- a/src/responder/pam/pamsrv.c
|
|
|
bac598 |
+++ b/src/responder/pam/pamsrv.c
|
|
|
bac598 |
@@ -327,6 +327,27 @@ static int pam_process_init(TALLOC_CTX *mem_ctx,
|
|
|
bac598 |
}
|
|
|
bac598 |
}
|
|
|
bac598 |
|
|
|
bac598 |
+ ret = confdb_get_string(pctx->rctx->cdb, pctx, CONFDB_PAM_CONF_ENTRY,
|
|
|
bac598 |
+ CONFDB_PAM_GSSAPI_SERVICES, "-", &tmpstr);
|
|
|
bac598 |
+ if (ret != EOK) {
|
|
|
bac598 |
+ DEBUG(SSSDBG_FATAL_FAILURE,
|
|
|
bac598 |
+ "Failed to determine gssapi services.\n");
|
|
|
bac598 |
+ goto done;
|
|
|
bac598 |
+ }
|
|
|
bac598 |
+ DEBUG(SSSDBG_TRACE_INTERNAL, "Found value [%s] for option [%s].\n", tmpstr,
|
|
|
bac598 |
+ CONFDB_PAM_GSSAPI_SERVICES);
|
|
|
bac598 |
+
|
|
|
bac598 |
+ if (tmpstr != NULL) {
|
|
|
bac598 |
+ ret = split_on_separator(pctx, tmpstr, ',', true, true,
|
|
|
bac598 |
+ &pctx->gssapi_services, NULL);
|
|
|
bac598 |
+ if (ret != EOK) {
|
|
|
bac598 |
+ DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
bac598 |
+ "split_on_separator() failed [%d]: [%s].\n", ret,
|
|
|
bac598 |
+ sss_strerror(ret));
|
|
|
bac598 |
+ goto done;
|
|
|
bac598 |
+ }
|
|
|
bac598 |
+ }
|
|
|
bac598 |
+
|
|
|
bac598 |
/* The responder is initialized. Now tell it to the monitor. */
|
|
|
bac598 |
ret = sss_monitor_service_init(rctx, rctx->ev, SSS_BUS_PAM,
|
|
|
bac598 |
SSS_PAM_SBUS_SERVICE_NAME,
|
|
|
bac598 |
diff --git a/src/responder/pam/pamsrv.h b/src/responder/pam/pamsrv.h
|
|
|
bac598 |
index 24d307a14..730dee288 100644
|
|
|
bac598 |
--- a/src/responder/pam/pamsrv.h
|
|
|
bac598 |
+++ b/src/responder/pam/pamsrv.h
|
|
|
bac598 |
@@ -62,6 +62,9 @@ struct pam_ctx {
|
|
|
bac598 |
int num_prompting_config_sections;
|
|
|
bac598 |
|
|
|
bac598 |
enum pam_initgroups_scheme initgroups_scheme;
|
|
|
bac598 |
+
|
|
|
bac598 |
+ /* List of PAM services that are allowed to authenticate with GSSAPI. */
|
|
|
bac598 |
+ char **gssapi_services;
|
|
|
bac598 |
};
|
|
|
bac598 |
|
|
|
bac598 |
struct pam_auth_req {
|
|
|
bac598 |
--
|
|
|
bac598 |
2.21.3
|
|
|
bac598 |
|