We have Active Directory working with sssd for most clients. In some of our HPC environments we use a 10.0.x.x subnet for the compute nodes. They have no direct access to AD but can connect to head nodes which do have access to AD. Is there some way to run sssd in a slave server or proxy mode on the head nodes so compute nodes can still have access to authorisation information from AD?
Cluster Services, ASC
CSIRO Information Management and Technology
Phone: +61 7 3327 4137 | Fax: +61 1 3327 4455
Greg.Lehmann(a)csiro.au | www.csiro.au
Address: 1 Technology Court, Pullenvale, QLD 4069
The information contained in this email may be confidential or privileged. Any unauthorised use or disclosure is prohibited. If you have received this email in error, please delete it immediately and notify the sender by return email. Thank you. To the extent permitted by law, CSIRO does not represent, warrant and/or guarantee that the integrity of this communication has been maintained or that the communication is free of errors, virus, interception or interference.
Please consider the environment before printing this email.
Commit c6872e79e8496fd075e20aec0343ade99cca725c caused that password migration
doesn't work using sssd.
If pre authentication failed then we should send message to backend,
so password migration could be detected.
Patch is attached.
I have created a design page for one of the next major features of SSSD
at https://fedorahosted.org/sssd/wiki/DesignDocs/IPAServerMode . The
basic idea is that if SSSD is running on a FreeIPA server it should help
the FreeIPA server to look up users and groups from trusted domains.
For your convenience the content can be found below as well.
Comments are suggestions are welcome.
== IPA Server Mode ==
* [https://fedorahosted.org/sssd/ticket/1821 RFE Allow using UIDs and GIDs from AD in trust case]
* [https://fedorahosted.org/sssd/ticket/1881 RFE Determine how to map SID to UID/GID based on IdM server configuration]
* more to come
=== Problem Statement ===
FreeIPA is planning to make users and groups from trusted domains available to legacy systems, e.g. systems where only nss_ldap and pam_ldap are available. For this a new directory server plugin ([https://fedorahosted.org/freeipa/ticket/3567]) will accept the LDAP search request from the legacy systems for the trusted users and groups, resolve the requested objects and send the result back to the legacy client.
Since all trusted users and groups are resolvable on the IPA server via the SSSD IPA provider the idea is that the new plugin will just run getpwnam_r(), getgrnam_r() and related calls. The SSSD disk and memory cache will help to answer those request fast without the need of additional caching inside the directory server.
To offer reliable group lookups to legacy systems it must be possible to lookup all the members of a group from a trusted domain and not only show members which already logged in once on the FreeIPA server, which is the current status on IPA clients with a recent version of SSSD. Additionally legacy systems tend to rely on user and group enumerations. Both requirements force an enumeration and caching of all trusted users and groups on the FreeIPA server.
If the legacy systems used an algorithmic mapping scheme based on the RID of the AD object and an offset to find a POSIX ID for the trusted user or group the ''--base-id'' of the ''ipa trust-add'' command can be used to get the same ID mapping. For legacy systems which read the POSIX IDs directly from AD a new idrange type must be introduced on the FreeIPA server ([https://fedorahosted.org/freeipa/ticket/3647]) to indicate that for those trusted users an groups the POSIX ID must be read from AD.
All of the above can basically be solved with the current layout of the FreeIPA server where winbind is doing the lookups against AD and SSSD is using the extdom LDAP plugin to read this data via the directory server. But it was decided to enhance SSSD to do the lookup. Some of the reasons are:
* resources, since SSSD has to run anyway on the FreeIPA server and is capable of the AD user and group lookups, winbind does not have to run anymore
* avoid double caching, to work efficiently winbind has to do some caching on its own and as a result users and groups are cached twice on the FreeIPA server
* configuration, winbind uses a separate configuration file while the IPA provider of SSSD can read e.g. the idranges directly from the FreeIPA server, this minimized to configuration effort and avoids conflicting configuration of different components
=== Overview of the solution ===
First sssd needs to know that it is running on an IPA server and should not look up trusted users and groups with the help of the extdom plugin but do the lookups on its own. For this a new boolean configuration option, e.g. ipa_server_mode, should be introduced ('''SSSD ticket#''') which defaults to ''false'' but is set to ''true'' during ipa-server-install or during updates of the FreeIPA server ([https://fedorahosted.org/freeipa/ticket/3652]) if it is not already set.
Since AD by default requires an authenticate LDAP bind to do searches SSSD needs credentials which are accepted by a trusted AD server. Because if the trust relationship this can even be credentials from the FreeIPA domain if Kerberos is user for authentication. So the easiest way is just to use the local keytab which requires no changes on the SSSD side, because the generic LDAP provider already knows how to handle SASL bind with the local keytab.
But currently AD LDAP server does not accept the Kerberos ticket from a FreeIPA host, because the FreeIPA KDC does not attach a PAC to the TGTs of host/ principals ([https://fedorahosted.org/freeipa/ticket/3651], until this is fixed some dummy credentials, e.g. a keytab for a dummy user, can be used).
Now the AD provider code can be used to lookup up the users and group of the trusted AD domain. Only the ID-mapping logic should be refactored so that the same code can be used in the standalone AD provider where the configuration is read form ssd.conf and as part of the IPA provider where the idrange objects read from the IPA server dictates the mapping. Maybe libsss_idmap can be extended to handle idranges for mappings in AD as well, e.g. a specific error code can be used to indicate to the caller that for this domain no algorithmic mapping is available and the value from the corresponding AD attribute should be use ('''SSSD ticket?''').
A task (or a separate process) must be created to handle enumerations efficiently without having to much impact on parallel running requests ('''SSSD ticket#'''). Maybe we can find a scheme which allows to read only a limited (configurable) number of users with their group memberships at a time. This way the cache might not be complete at once but always consistent with respect to group memberships of the caches users. If eventually all users are read, the task will periodically look for new users and update old entries.
=== Implementation details ===
==== Add ipa_server_mode option ====
A new boolean option ipa_server_mode which defaults to false should be added to the IPA provider. ipa_get_subdom_acct_send() should only be called if ipa_server_mode is false. If ipa_server_mode is true ipa_account_info_handler() should return ENOSYS for subdomain requests. A suitable tevent request will be handled in a different ticket.
==== Enhance libsss_idmap ====
1. Allow algorithmic mapping where the first RID is not 0
Currently it is implicitly assumed that the first POSIX ID of a range is mapped to the RID 0. To support multiple ranges for a single domain a different first RID must handled as well.[[BR]]
2. Add a range type to handle mappings in AD
==== Add plugin to LDAP provider to find new ranges ====
Currently the range management code is in the generic LDAP provider and can be used by the LDAP and AD provider. New ranges are allocated with the help of a hash value of the domain SID.
If the IPA provider cannot find a range for a given domain it cannot allocate a new range on its own but has to look up the idrange objects on the FreeIPA server and use them accordingly. To allow the LDAP, AD and IPA provider to use as much common code as possible I think a plugin interface, similar to the one used to find the DNS site, to find a missing range would be useful. The default plugin will be used by the LDAP and the AD provider and the IPA provider will implement a plugin to read the data from the server.
==== Integrate AD provider lookup code into IPA subdomain user lookup ====
If the ipa_server_mode is selected IPA subdomain user and group lookups should not be done with the help of the extdom plugin but directly against AD with the help of LDAP of GC lookups. For this the IPA provider must be able to call the related functions from the AD provider. Since by default the POSIX attributes are not replicated to the global catalog and supporting them is a requirement, I think it would be sufficient make sure LDAP lookups are working as expected. Additionally FreeIPA currently supports only one trusted domain global catalog lookups for users and groups from the forest or different forests can be added later.
Since the Kerberos hosts keys from the host keytab should be used as credentials to access AD no changes are expected here.
It should be taken care that not accidentally the the AD SRV plugin is loaded, see next section as well.
==== Enhance IPA SRV plugin to do AD site lookups as well ====
>From the AD point of view trusted domains do not belong to a specific site. But recent version of AD return the next_closest_site for host which do not belong to a site. To make sure that SSSD is communication with an AD server which is network-wise reasonably near it would be useful if the IPA SRV plugin can be enhanced to do CLDAP pings and AD site lookups as well. Additionally the plugin must know when to use IPA style and when AD style lookups.
This is a nice to have feature.
==== Implement or Improve enumeration ====
If enumeration is enable SSSD tries to update all users and groups at startup. As a result the startup time where SSSD is basically blocked and cannot serve requests even for data in the cache can be quite long. A new tevent_req task should be created which can read users and groups from the AD domain in smaller chunks so that other request can always slip in between.
The task should make sure all users and groups are read after a while without reading objects twice in a single run. Maybe it is possible to add a special paged-search tevent request which returns after the first page is read to the caller (instead of doing the paging behind the scenes) which the results and a handle which would allow to continue the the search with the next page? If this is a way to go creating this new request would be another development subtask.
Additionally it has to be considered how to handle large groups. But since we have to read all user as well it might be possible to just read the group memberships of the user and build up the groups in the SSSD cache and let the getgrp*() calls only return entries from the cache and never go to the server directly.
=== How to test ===
If the ipa_server_mode is enable on a FreeIPA server which trusts an AD server, ''getent passwd AD\username'' or ''id AD\username'' should return the expected results for users and groups.
''getent group AD\groupname'' should return results depending the state of enumeration. Immediately after startup with an empty cache e.g. the 'Domain User' group should only have a few members if any. After some time more and more members should be displayed until the enumeration is complete and all users and groups are in the SSSD cache.
=== Author(s) ===
Sumit Bose <sbose(a)redhat.com>
Sumit found warning caused by my latest patch set.
../src/providers/dp_ptask.c: In function 'be_ptask_create':
../src/providers/dp_ptask.c:249:41: warning: declaration of 'send'
shadows a global declaration [-Wshadow]
../src/providers/dp_ptask.c:250:41: warning: declaration of 'recv'
shadows a global declaration [-Wshadow]
../src/providers/dp_refresh.c: In function 'be_refresh_add_cb':
../src/providers/dp_refresh.c:148:45: warning: declaration of 'send'
shadows a global declaration [-Wshadow]
../src/providers/dp_refresh.c:149:45: warning: declaration of 'recv'
shadows a global declaration [-Wshadow]
I wasn't able to trigger it even by setting -Wshadow explicitly, maybe
due to newer gcc version. Anyway, here are the patches.