|
|
2fc102 |
From a15ab6146ebba795e3b58d5f32cf7a1d8653c082 Mon Sep 17 00:00:00 2001
|
|
|
2fc102 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
2fc102 |
Date: Fri, 28 Feb 2014 10:05:34 +0100
|
|
|
2fc102 |
Subject: [PATCH 103/104] SUDO: AD provider
|
|
|
2fc102 |
MIME-Version: 1.0
|
|
|
2fc102 |
Content-Type: text/plain; charset=UTF-8
|
|
|
2fc102 |
Content-Transfer-Encoding: 8bit
|
|
|
2fc102 |
|
|
|
2fc102 |
This patch adds the sudo target to the AD provider. The main reason is
|
|
|
2fc102 |
to cover different default settings in the LDAP and AD provider. E.g.
|
|
|
2fc102 |
the default for ldap_id_mapping is True in the AD provider and False
|
|
|
2fc102 |
in the LDAP provider. If ldap_id_mapping was not set explicitly in the
|
|
|
2fc102 |
config file both components worked with different setting.
|
|
|
2fc102 |
|
|
|
2fc102 |
Fixes https://fedorahosted.org/sssd/ticket/2256
|
|
|
2fc102 |
|
|
|
2fc102 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
2fc102 |
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
|
|
|
2fc102 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
2fc102 |
(cherry picked from commit 61804568ce5ede3b1a699cda17c033dd6c23f0e3)
|
|
|
2fc102 |
---
|
|
|
2fc102 |
Makefile.am | 5 ++++
|
|
|
2fc102 |
src/config/SSSDConfigTest.py | 2 +-
|
|
|
2fc102 |
src/config/etc/sssd.api.d/sssd-ad.conf | 21 ++++++++++++++
|
|
|
2fc102 |
src/man/sssd-ad.5.xml | 6 ++--
|
|
|
2fc102 |
src/man/sssd.conf.5.xml | 15 ++++++++--
|
|
|
2fc102 |
src/providers/ad/ad_common.h | 4 +++
|
|
|
2fc102 |
src/providers/ad/ad_init.c | 25 +++++++++++++++++
|
|
|
2fc102 |
src/providers/ad/ad_sudo.c | 51 ++++++++++++++++++++++++++++++++++
|
|
|
2fc102 |
8 files changed, 122 insertions(+), 7 deletions(-)
|
|
|
2fc102 |
create mode 100644 src/providers/ad/ad_sudo.c
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
2fc102 |
index 879054c2fb96f937fbd58ca0757d703cdea218d8..b37c04067d34569ad357327b7d463cc5b052f065 100644
|
|
|
2fc102 |
--- a/Makefile.am
|
|
|
2fc102 |
+++ b/Makefile.am
|
|
|
2fc102 |
@@ -1803,6 +1803,11 @@ libsss_ad_la_SOURCES = \
|
|
|
2fc102 |
src/util/sss_krb5.c \
|
|
|
2fc102 |
src/util/sss_ldap.c
|
|
|
2fc102 |
|
|
|
2fc102 |
+if BUILD_SUDO
|
|
|
2fc102 |
+libsss_ad_la_SOURCES += \
|
|
|
2fc102 |
+ src/providers/ad/ad_sudo.c
|
|
|
2fc102 |
+endif
|
|
|
2fc102 |
+
|
|
|
2fc102 |
libsss_ad_la_CFLAGS = \
|
|
|
2fc102 |
$(AM_CFLAGS) \
|
|
|
2fc102 |
$(LDAP_CFLAGS) \
|
|
|
2fc102 |
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
|
|
|
2fc102 |
index e6cf663ec86396a3d50dcbc14d4cf4d1157b0d5d..98b2fee63d519201047b0c576295863d59b0a37a 100755
|
|
|
2fc102 |
--- a/src/config/SSSDConfigTest.py
|
|
|
2fc102 |
+++ b/src/config/SSSDConfigTest.py
|
|
|
2fc102 |
@@ -730,7 +730,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
|
|
|
2fc102 |
control_provider_dict = {
|
|
|
2fc102 |
'ipa': ['id', 'auth', 'access', 'chpass', 'sudo', 'autofs',
|
|
|
2fc102 |
'session', 'hostid', 'subdomains'],
|
|
|
2fc102 |
- 'ad': ['id', 'auth', 'access', 'chpass', 'subdomains'],
|
|
|
2fc102 |
+ 'ad': ['id', 'auth', 'access', 'chpass', 'sudo', 'subdomains'],
|
|
|
2fc102 |
'local': ['id', 'auth', 'chpass'],
|
|
|
2fc102 |
'ldap': ['id', 'auth', 'access', 'chpass', 'sudo', 'autofs'],
|
|
|
2fc102 |
'krb5': ['auth', 'access', 'chpass'],
|
|
|
2fc102 |
diff --git a/src/config/etc/sssd.api.d/sssd-ad.conf b/src/config/etc/sssd.api.d/sssd-ad.conf
|
|
|
2fc102 |
index 6b136f2ec88614092cf1ceb4e2cea79db064d468..aa20ca0bb5b70818525d61a1480a6b56bd8c4e48 100644
|
|
|
2fc102 |
--- a/src/config/etc/sssd.api.d/sssd-ad.conf
|
|
|
2fc102 |
+++ b/src/config/etc/sssd.api.d/sssd-ad.conf
|
|
|
2fc102 |
@@ -132,3 +132,24 @@ krb5_kpasswd = str, None, false
|
|
|
2fc102 |
krb5_backup_kpasswd = str, None, false
|
|
|
2fc102 |
|
|
|
2fc102 |
[provider/ad/subdomains]
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+[provider/ad/sudo]
|
|
|
2fc102 |
+ldap_sudo_search_base = str, None, false
|
|
|
2fc102 |
+ldap_sudo_full_refresh_interval = int, None, false
|
|
|
2fc102 |
+ldap_sudo_smart_refresh_interval = int, None, false
|
|
|
2fc102 |
+ldap_sudo_use_host_filter = bool, None, false
|
|
|
2fc102 |
+ldap_sudo_hostnames = str, None, false
|
|
|
2fc102 |
+ldap_sudo_ip = str, None, false
|
|
|
2fc102 |
+ldap_sudo_include_netgroups = bool, None, false
|
|
|
2fc102 |
+ldap_sudo_include_regexp = bool, None, false
|
|
|
2fc102 |
+ldap_sudorule_object_class = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_name = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_command = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_host = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_user = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_option = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_runasuser = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_runasgroup = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_notbefore = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_notafter = str, None, false
|
|
|
2fc102 |
+ldap_sudorule_order = str, None, false
|
|
|
2fc102 |
diff --git a/src/man/sssd-ad.5.xml b/src/man/sssd-ad.5.xml
|
|
|
2fc102 |
index 38cc31278cf87c98ca9e53cf91fda7b141bff78d..8cd94d4aeaf553ecb54e0e4c866be5fb7a44fa8e 100644
|
|
|
2fc102 |
--- a/src/man/sssd-ad.5.xml
|
|
|
2fc102 |
+++ b/src/man/sssd-ad.5.xml
|
|
|
2fc102 |
@@ -60,9 +60,9 @@
|
|
|
2fc102 |
</para>
|
|
|
2fc102 |
<para>
|
|
|
2fc102 |
However, it is neither necessary nor recommended to set these
|
|
|
2fc102 |
- options. The AD provider can also be used as an access and chpass
|
|
|
2fc102 |
- provider. No configuration of the access provider is required on
|
|
|
2fc102 |
- the client side.
|
|
|
2fc102 |
+ options. The AD provider can also be used as an access, chpass and
|
|
|
2fc102 |
+ sudo provider. No configuration of the access provider is required
|
|
|
2fc102 |
+ on the client side.
|
|
|
2fc102 |
</para>
|
|
|
2fc102 |
<para>
|
|
|
2fc102 |
By default, the AD provider will map UID and GID values from the
|
|
|
2fc102 |
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
|
|
|
2fc102 |
index 5d861c73cfeb41920619d95e5c1e5c1975dcc45b..29b08d53d2568f2fce47b37ea0b88c9dc233c12e 100644
|
|
|
2fc102 |
--- a/src/man/sssd.conf.5.xml
|
|
|
2fc102 |
+++ b/src/man/sssd.conf.5.xml
|
|
|
2fc102 |
@@ -1450,14 +1450,23 @@ fallback_homedir = /home/%u
|
|
|
2fc102 |
<citerefentry>
|
|
|
2fc102 |
<refentrytitle>sssd-ldap</refentrytitle>
|
|
|
2fc102 |
<manvolnum>5</manvolnum>
|
|
|
2fc102 |
- </citerefentry> for more information on configuring LDAP.
|
|
|
2fc102 |
+ </citerefentry> for more information on configuring
|
|
|
2fc102 |
+ LDAP.
|
|
|
2fc102 |
+ </para>
|
|
|
2fc102 |
+ <para>
|
|
|
2fc102 |
+ <quote>ipa</quote> the same as <quote>ldap</quote>
|
|
|
2fc102 |
+ but with IPA default settings.
|
|
|
2fc102 |
+ </para>
|
|
|
2fc102 |
+ <para>
|
|
|
2fc102 |
+ <quote>ad</quote> the same as <quote>ldap</quote>
|
|
|
2fc102 |
+ but with AD default settings.
|
|
|
2fc102 |
</para>
|
|
|
2fc102 |
<para>
|
|
|
2fc102 |
<quote>none</quote> disables SUDO explicitly.
|
|
|
2fc102 |
</para>
|
|
|
2fc102 |
<para>
|
|
|
2fc102 |
- Default: The value of <quote>id_provider</quote> is used if it
|
|
|
2fc102 |
- is set.
|
|
|
2fc102 |
+ Default: The value of <quote>id_provider</quote> is
|
|
|
2fc102 |
+ used if it is set.
|
|
|
2fc102 |
</para>
|
|
|
2fc102 |
</listitem>
|
|
|
2fc102 |
</varlistentry>
|
|
|
2fc102 |
diff --git a/src/providers/ad/ad_common.h b/src/providers/ad/ad_common.h
|
|
|
2fc102 |
index d370cef69124c127f41d7c4cbaa25713363e7752..bc11e54b0c4903c876f23bfea3ef573f06ba8c69 100644
|
|
|
2fc102 |
--- a/src/providers/ad/ad_common.h
|
|
|
2fc102 |
+++ b/src/providers/ad/ad_common.h
|
|
|
2fc102 |
@@ -128,4 +128,8 @@ errno_t ad_dyndns_init(struct be_ctx *be_ctx,
|
|
|
2fc102 |
struct ad_options *ctx);
|
|
|
2fc102 |
void ad_dyndns_timer(void *pvt);
|
|
|
2fc102 |
|
|
|
2fc102 |
+int ad_sudo_init(struct be_ctx *be_ctx,
|
|
|
2fc102 |
+ struct ad_id_ctx *id_ctx,
|
|
|
2fc102 |
+ struct bet_ops **ops,
|
|
|
2fc102 |
+ void **pvt_data);
|
|
|
2fc102 |
#endif /* AD_COMMON_H_ */
|
|
|
2fc102 |
diff --git a/src/providers/ad/ad_init.c b/src/providers/ad/ad_init.c
|
|
|
2fc102 |
index eff6d990d131e3aba124d252d001dd39e78b45cf..500d807e9c44e92089d31c81f3b22c9606c476e5 100644
|
|
|
2fc102 |
--- a/src/providers/ad/ad_init.c
|
|
|
2fc102 |
+++ b/src/providers/ad/ad_init.c
|
|
|
2fc102 |
@@ -467,3 +467,28 @@ int sssm_ad_subdomains_init(struct be_ctx *bectx,
|
|
|
2fc102 |
|
|
|
2fc102 |
return EOK;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+int sssm_ad_sudo_init(struct be_ctx *bectx,
|
|
|
2fc102 |
+ struct bet_ops **ops,
|
|
|
2fc102 |
+ void **pvt_data)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+#ifdef BUILD_SUDO
|
|
|
2fc102 |
+ struct ad_id_ctx *id_ctx;
|
|
|
2fc102 |
+ int ret;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("Initializing AD sudo handler\n"));
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ret = sssm_ad_id_init(bectx, ops, (void **) &id_ctx);
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
+ DEBUG(SSSDBG_CRIT_FAILURE, ("sssm_ad_id_init failed.\n"));
|
|
|
2fc102 |
+ return ret;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ return ad_sudo_init(bectx, id_ctx, ops, pvt_data);
|
|
|
2fc102 |
+#else
|
|
|
2fc102 |
+ DEBUG(SSSDBG_MINOR_FAILURE, ("Sudo init handler called but SSSD is "
|
|
|
2fc102 |
+ "built without sudo support, ignoring\n"));
|
|
|
2fc102 |
+ return EOK;
|
|
|
2fc102 |
+#endif
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
diff --git a/src/providers/ad/ad_sudo.c b/src/providers/ad/ad_sudo.c
|
|
|
2fc102 |
new file mode 100644
|
|
|
2fc102 |
index 0000000000000000000000000000000000000000..b85c95c5c2f44e116a75bc24e073c067806621dd
|
|
|
2fc102 |
--- /dev/null
|
|
|
2fc102 |
+++ b/src/providers/ad/ad_sudo.c
|
|
|
2fc102 |
@@ -0,0 +1,51 @@
|
|
|
2fc102 |
+/*
|
|
|
2fc102 |
+ SSSD
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ AD SUDO Provider Initialization functions
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ Authors:
|
|
|
2fc102 |
+ Sumit Bose <sbose@redhat.com>
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ Copyright (C) 2014 Red Hat
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
2fc102 |
+ it under the terms of the GNU General Public License as published by
|
|
|
2fc102 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
2fc102 |
+ (at your option) any later version.
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ This program is distributed in the hope that it will be useful,
|
|
|
2fc102 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2fc102 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
2fc102 |
+ GNU General Public License for more details.
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ You should have received a copy of the GNU General Public License
|
|
|
2fc102 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2fc102 |
+*/
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+#include "providers/ad/ad_common.h"
|
|
|
2fc102 |
+#include "providers/ldap/sdap_sudo.h"
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+int ad_sudo_init(struct be_ctx *be_ctx,
|
|
|
2fc102 |
+ struct ad_id_ctx *id_ctx,
|
|
|
2fc102 |
+ struct bet_ops **ops,
|
|
|
2fc102 |
+ void **pvt_data)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ int ret;
|
|
|
2fc102 |
+ struct ad_options *ad_options;
|
|
|
2fc102 |
+ struct sdap_options *ldap_options;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("Initializing sudo AD back end\n"));
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ret = sdap_sudo_init(be_ctx, id_ctx->sdap_id_ctx, ops, pvt_data);
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
+ DEBUG(SSSDBG_OP_FAILURE, ("Cannot initialize LDAP SUDO [%d]: %s\n",
|
|
|
2fc102 |
+ ret, strerror(ret)));
|
|
|
2fc102 |
+ return ret;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ad_options = id_ctx->ad_options;
|
|
|
2fc102 |
+ ldap_options = id_ctx->sdap_id_ctx->opts;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ad_options->id->sudorule_map = ldap_options->sudorule_map;
|
|
|
2fc102 |
+ return EOK;
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
--
|
|
|
2fc102 |
1.8.5.3
|
|
|
2fc102 |
|