keycloak-scim/server_admin/topics/user-federation/sssd.adoc

154 lines
6.8 KiB
Text
Raw Normal View History

2016-09-08 00:11:28 +00:00
[[_sssd]]
2017-02-16 21:23:12 +00:00
=== SSSD and FreeIPA Identity Management Integration
2016-09-08 00:11:28 +00:00
{project_name} also comes with a built-in https://fedoraproject.org/wiki/Features/SSSD[SSSD] (System Security Services Daemon) plugin. SSSD is part of the latest Fedora or Red Hat Enterprise Linux and provides access to multiple identity and authentication providers. It provides benefits such as failover and offline support. To see configuration options and for more information see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/sssd[the Red Hat Enterprise Linux Identity Management documentation].
2016-09-08 00:11:28 +00:00
SSSD also integrates with the http://www.freeipa.org/page/Main_Page[FreeIPA identity management (IdM)] server, providing authentication and access control. For {project_name}, we benefit from this integration authenticating against http://tldp.org/HOWTO/User-Authentication-HOWTO/x115.html[PAM] services and retrieving user data from SSSD. For more information about using Red Hat Identity Management in Linux environments, see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/linux_domain_identity_authentication_and_policy_guide/index[the Red Hat Enterprise Linux Identity Management documentation].
2016-09-08 00:11:28 +00:00
2017-08-28 12:50:14 +00:00
image:{project_images}/keycloak-sssd-freeipa-integration-overview.png[]
2016-09-08 00:11:28 +00:00
2017-08-28 12:50:14 +00:00
Most of the communication between {project_name} and SSSD occurs through read-only D-Bus interfaces. For this reason, the only way to provision and update users is to use the FreeIPA/IdM administration interface. By default, like the LDAP federation provider, it is set up only to import username, email, first name, and last name.
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
[NOTE]
2017-08-28 12:50:14 +00:00
Groups and roles are automatically registered, but not synchronized, so any changes made by the {project_name} administrator directly in {project_name} is not synchronized with SSSD.
2017-02-16 21:23:12 +00:00
Information on how to configure the FreeIPA/IdM server follows.
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
==== FreeIPA/IdM Server
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
As a matter of simplicity, a https://www.freeipa.org/page/Docker[FreeIPA Docker image] already available is used. To set up a server, see the https://www.freeipa.org/page/Quick_Start_Guide[FreeIPA documentation].
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
Running a FreeIPA server with Docker requires this command:
2016-09-08 00:11:28 +00:00
docker run --name freeipa-server-container -it \
-h server.freeipa.local -e PASSWORD=YOUR_PASSWORD \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /var/lib/ipa-data:/data:Z adelton/freeipa-server
2017-02-16 21:23:12 +00:00
The parameter `-h` with `server.freeipa.local` represents the FreeIPA/IdM server hostname. Be sure to change `YOUR_PASSWORD` to a password of your choosing.
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
After the container starts, change `/etc/hosts` to:
2016-09-08 00:11:28 +00:00
x.x.x.x server.freeipa.local
2017-02-16 21:23:12 +00:00
If you do not make this change, you must set up a DNS server.
2016-09-08 00:11:28 +00:00
2017-08-28 12:50:14 +00:00
So that the SSSD federation provider is started and running on {project_name} you must enroll your Linux machine in the IPA domain:
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
ipa-client-install --mkhomedir -p admin -w password
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
To ensure that everything is working as expected, on the client machine, run:
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
kinit admin
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
You should be prompted for the password. After that, you can add users to the IPA server using this command:
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
$ ipa user-add john --first=John --last=Smith --email=john@smith.com --phone=042424242 --street="Testing street" \ --city="Testing city" --state="Testing State" --postalcode=0000000000
2016-09-08 00:11:28 +00:00
==== SSSD and D-Bus
2017-02-16 21:23:12 +00:00
As mentioned previously, the federation provider obtains the data from SSSD using D-BUS and authentication occurs using http://tldp.org/HOWTO/User-Authentication-HOWTO/x115.html[PAM].
First, you have to install the sssd-dbus RPM, which allows information from SSSD to be transmitted over the system bus.
$ sudo yum install sssd-dbus
2017-08-28 12:50:14 +00:00
ifeval::[{project_community}==true]
2017-02-16 21:23:12 +00:00
You must run the provisioning script available from the Keycloak distribution:
2016-09-08 00:11:28 +00:00
$ bin/federation-sssd-setup.sh
2017-08-28 12:50:14 +00:00
endif::[]
2017-08-28 12:50:14 +00:00
ifeval::[{project_product}==true]
2017-03-31 19:11:05 +00:00
You must run this provisioning script:
2017-03-31 19:11:05 +00:00
[source]
----
2017-03-31 19:11:05 +00:00
$ .../bin/federation-sssd-setup.sh
----
2017-03-31 19:11:05 +00:00
2017-08-28 12:50:14 +00:00
endif::[]
2017-02-16 21:23:12 +00:00
This script makes the necessary changes to `/etc/sssd/sssd.conf`:
2016-09-08 00:11:28 +00:00
[domain/your-hostname.local]
...
ldap_user_extra_attrs = mail:mail, sn:sn, givenname:givenname, telephoneNumber:telephoneNumber
...
[sssd]
services = nss, sudo, pam, ssh, ifp
...
[ifp]
allowed_uids = root, yourOSUsername
user_attributes = +mail, +telephoneNumber, +givenname, +sn
2017-02-16 21:23:12 +00:00
Also, a `keycloak` file is included under `/etc/pam.d/`:
2016-09-08 00:11:28 +00:00
auth required pam_sss.so
account required pam_sss.so
2017-02-16 21:23:12 +00:00
Ensure everything is working as expected by running `dbus-send`:
2016-09-08 00:11:28 +00:00
sudo dbus-send --print-reply --system --dest=org.freedesktop.sssd.infopipe /org/freedesktop/sssd/infopipe org.freedesktop.sssd.infopipe.GetUserGroups string:john
2017-08-28 12:50:14 +00:00
You should be able to see the user's group. If this command returns a timeout or an error, it means that the federation provider will also not be able to retrieve anything on {project_name}.
2016-09-08 00:11:28 +00:00
2017-02-16 21:23:12 +00:00
Most of the time this occurs because the machine was not enrolled in the FreeIPA IdM server or you do not have permission to access the SSSD service.
2016-09-08 00:11:28 +00:00
2017-08-28 12:50:14 +00:00
If you do not have permission, ensure that the user running {project_name} is included in the `/etc/sssd/sssd.conf` file in the following section:
2016-09-08 00:11:28 +00:00
[ifp]
allowed_uids = root, your_username
2017-02-16 21:23:12 +00:00
==== Enabling the SSSD Federation Provider
2016-09-08 00:11:28 +00:00
2017-08-28 12:50:14 +00:00
{project_name} uses DBus-Java to communicate at a low level with D-Bus, which depends on the http://www.matthew.ath.cx/projects/java/[Unix Sockets Library].
2016-12-01 16:15:24 +00:00
2017-08-28 12:50:14 +00:00
ifeval::[{project_community}==true]
2016-12-01 16:15:24 +00:00
2017-02-16 21:23:12 +00:00
An RPM for this library can be found in https://github.com/keycloak/libunix-dbus-java/releases[this repository]. Before installing it, be sure to check the RPM signature:
$ rpm -K libunix-dbus-java-0.8.0-1.fc24.x86_64.rpm
libunix-dbus-java-0.8.0-1.fc24.x86_64.rpm:
Header V4 RSA/SHA256 Signature, key ID 84dc9914: OK
Header SHA1 digest: OK (d17bb7ebaa7a5304c1856ee4357c8ba4ec9c0b89)
V4 RSA/SHA256 Signature, key ID 84dc9914: OK
MD5 digest: OK (770c2e68d052cb4a4473e1e9fd8818cf)
$ sudo yum install libunix-dbus-java-0.8.0-1.fc24.x86_64.rpm
2017-08-28 12:50:14 +00:00
endif::[]
2016-12-01 16:15:24 +00:00
2017-08-28 12:50:14 +00:00
ifeval::[{project_product}==true]
2017-02-16 21:23:12 +00:00
2017-02-23 15:14:18 +00:00
Before enabling the SSSD Federation provider, you must install the RPM for this library:
2017-02-16 21:23:12 +00:00
2017-05-09 14:00:45 +00:00
$ sudo yum install rh-sso7-libunix-dbus-java
2017-02-16 21:23:12 +00:00
2017-08-28 12:50:14 +00:00
endif::[]
2017-02-16 21:23:12 +00:00
2017-08-28 12:50:14 +00:00
For authentication with PAM {project_name} uses JNA. Be sure you have this package installed:
2016-12-19 11:07:05 +00:00
$ sudo yum install jna
Use `sssctl user-checks` command to validate your setup:
$ sudo sssctl user-checks admin -s keycloak
2017-02-16 21:23:12 +00:00
=== Configuring a Federated SSSD Store
After installation, you need to configure a federated SSSD store.
To configure a federated SSSD store, complete the following steps:
. Navigate to the Administration Console.
. From the left menu, select *User Federation.*
. From the *Add Provider* dropdown list, select *sssd.* The sssd configuration page opens.
. Click *Save*.
2017-08-28 12:50:14 +00:00
Now you can authenticate against {project_name} using FreeIPA/IdM credentials.
2016-09-08 00:11:28 +00:00