diff options
| author | Christian Heimes <cheimes@redhat.com> | 2018-11-06 13:57:14 +0100 |
|---|---|---|
| committer | Christian Heimes <cheimes@redhat.com> | 2018-11-07 16:28:35 +0100 |
| commit | 8b0f3595fd94a31a0e2d5a83dc74a430c973325b (patch) | |
| tree | 5c3197a2f72ac9e2e6a726c41a927bce12ece44e /ipaclient | |
| parent | 324da5c379847fbb92e6eb71433a2aec9898cde9 (diff) | |
| download | freeipa-8b0f3595fd94a31a0e2d5a83dc74a430c973325b.tar.gz freeipa-8b0f3595fd94a31a0e2d5a83dc74a430c973325b.tar.xz freeipa-8b0f3595fd94a31a0e2d5a83dc74a430c973325b.zip | |
Allow ipaapi user to access SSSD's info pipe
For smart card authentication, ipaapi must be able to access to sss-ifp.
During installation and upgrade, the ipaapi user is now added to
[ifp]allowed_uids.
The commit also fixes two related issues:
* The server upgrade code now enables ifp service in sssd.conf. The
existing code modified sssd.conf but never wrote the changes to disk.
* sssd_enable_service() no longer fails after it has detected an
unrecognized service.
Fixes: https://pagure.io/freeipa/issue/7751
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Diffstat (limited to 'ipaclient')
| -rw-r--r-- | ipaclient/install/client.py | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index fe1590157..fe3f0bb2b 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -33,6 +33,7 @@ from configparser import RawConfigParser from urllib.parse import urlparse, urlunparse from ipalib import api, errors, x509 +from ipalib.constants import IPAAPI_USER from ipalib.install import certmonger, certstore, service, sysrestore from ipalib.install import hostname as hostname_ from ipalib.install.kinit import kinit_keytab, kinit_password @@ -912,7 +913,7 @@ def configure_sssd_conf( domain = sssdconfig.new_domain(cli_domain) if options.on_master: - sssd_enable_service(sssdconfig, 'ifp') + sssd_enable_ifp(sssdconfig) if ( (options.conf_ssh and os.path.isfile(paths.SSH_CONFIG)) or @@ -1016,21 +1017,47 @@ def configure_sssd_conf( return 0 -def sssd_enable_service(sssdconfig, service): +def sssd_enable_service(sssdconfig, name): try: - sssdconfig.new_service(service) + sssdconfig.new_service(name) except SSSDConfig.ServiceAlreadyExists: pass except SSSDConfig.ServiceNotRecognizedError: logger.error( - "Unable to activate the %s service in SSSD config.", service) + "Unable to activate the '%s' service in SSSD config.", name) logger.info( "Please make sure you have SSSD built with %s support " - "installed.", service) + "installed.", name) logger.info( - "Configure %s support manually in /etc/sssd/sssd.conf.", service) + "Configure %s support manually in /etc/sssd/sssd.conf.", name) + return None - sssdconfig.activate_service(service) + sssdconfig.activate_service(name) + return sssdconfig.get_service(name) + + +def sssd_enable_ifp(sssdconfig): + """Enable and configure libsss_simpleifp plugin + """ + service = sssd_enable_service(sssdconfig, 'ifp') + if service is None: + # unrecognized service + return + + try: + uids = service.get_option('allowed_uids') + except SSSDConfig.NoOptionError: + uids = set() + else: + uids = {s.strip() for s in uids.split(',') if s.strip()} + # SSSD supports numeric and string UIDs + # ensure that root is allowed to access IFP, might be 0 or root + if uids.isdisjoint({'0', 'root'}): + uids.add('root') + # allow IPA API to access IFP + uids.add(IPAAPI_USER) + service.set_option('allowed_uids', ', '.join(sorted(uids))) + sssdconfig.save_service(service) def change_ssh_config(filename, changes, sections): |
