This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Este contenido no está disponible en el idioma seleccionado.
Chapter 14. Configuring LDAP failover
OpenShift Container Platform provides an authentication provider for use with Lightweight Directory Access Protocol (LDAP) setups, but it can connect to only a single LDAP server. During OpenShift Container Platform installation, you can configure the System Security Services Daemon (SSSD) for LDAP failover to ensure access to your cluster if one LDAP server fails.
The setup for this configuration is advanced and requires a separate authentication server, also called an remote basic authentication server, for OpenShift Container Platform to communicate with. You configure this server to pass extra attributes, such as email addresses, to OpenShift Container Platform so it can display them in the web console.
This topic describes how to complete this set up on a dedicated physical or virtual machine (VM), but you can also configure SSSD in containers.
You must complete all sections of this topic.
14.1. Prerequisites for configuring basic remote authentication Copiar enlaceEnlace copiado en el portapapeles!
Before starting setup, you need to know the following information about your LDAP server:
- Whether the directory server is powered by FreeIPA, Active Directory, or another LDAP solution.
- The Uniform Resource Identifier (URI) for the LDAP server, for example, ldap.example.com.
- The location of the CA certificate for the LDAP server.
- Whether the LDAP server corresponds to RFC 2307 or RFC2307bis for user groups.
Prepare the servers:
remote-basic.example.com: A VM to use as the remote basic authentication server.
- Select an operating system that includes SSSD version 1.12.0 for this server such as Red Hat Enterprise Linux 7.0 or later.
openshift.example.com: A new installation of OpenShift Container Platform.
- You must not have an authentication method configured for this cluster.
- Do not start OpenShift Container Platform on this cluster.
14.2. Generating and sharing certificates with the remote basic authentication server Copiar enlaceEnlace copiado en el portapapeles!
Complete the following steps on the first master host listed in the Ansible host inventory file, by default /etc/ansible/hosts.
To ensure that communication between the remote basic authentication server and OpenShift Container Platform is trustworthy, create a set of Transport Layer Security (TLS) certificates to use during the other phases of this set up. Run the following command:
openshift start \ --public-master=https://openshift.example.com:8443 \ --write-config=/etc/origin/
# openshift start \ --public-master=https://openshift.example.com:8443 \ --write-config=/etc/origin/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output inclues the /etc/origin/master/ca.crt and /etc/origin/master/ca.key signing certificates.
Use the signing certificate to generate keys to use on the remote basic authentication server:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- A comma-separated list of all the host names and interface IP addresses that need to access the remote basic authentication server.
NoteThe certificate files that you generate are valid for two years. You can alter this period by changing the
--expire-days
and--signer-expire-days
values, but for security reasons, do not make them greater than 730.ImportantIf you do not list all host names and interface IP addresses that need to access the remote basic authentication server, the HTTPS connection will fail.
Copy the necessary certificates and key to the remote basic authentication server:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
14.3. Configuring SSSD for LDAP failover Copiar enlaceEnlace copiado en el portapapeles!
Complete these steps on the remote basic authentication server.
You can configure the SSSD to retrieve attributes, such as email addresses and display names, and pass them to OpenShift Container Platform to display in the web interface. In the following steps, you configure the SSSD to provide email addresses to OpenShift Container Platform:
Install the required SSSD and the web server components:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set up SSSD to authenticate this VM against the LDAP server. If the LDAP server is a FreeIPA or Active Directory environment, then use realmd to join this machine to the domain.
realm join ldap.example.com
# realm join ldap.example.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more advanced cases, see the System-Level Authentication Guide
- To use SSSD to manage failover situations for LDAP, add more entries to the /etc/sssd/sssd.conf file on the ldap_uri line. Systems that are enrolled with FreeIPA can automatically handle failover by using DNS SRV records.
Modify the [domain/DOMAINNAME] section of the /etc/sssd/sssd.conf file and add this attribute:
[domain/example.com] ... ldap_user_extra_attrs = mail
[domain/example.com] ... ldap_user_extra_attrs = mail
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the correct attribute to retrieve email addresses for your LDAP solution. For IPA, specify
mail
. Other LDAP solutions might use another attribute, such asemail
.
Confirm that the domain parameter in the /etc/sssd/sssd.conf file contains only the domain name listed in the [domain/DOMAINNAME] section.
domains = example.com
domains = example.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Grant Apache permission to retrieve the email attribute. Add the following lines to the [ifp] section of the /etc/sssd/sssd.conf file:
[ifp] user_attributes = +mail allowed_uids = apache, root
[ifp] user_attributes = +mail allowed_uids = apache, root
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To ensure that all of the changes are applied properly, restart SSSD:
systemctl restart sssd.service
$ systemctl restart sssd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Test that the user information can be retrieved properly:
getent passwd <username>
$ getent passwd <username> username:*:12345:12345:Example User:/home/username:/usr/bin/bash
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Confirm that the mail attribute you specified returns an email address from your domain:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Attempt to log into the VM as an LDAP user and confirm that you can log in using LDAP credentials. You can use either the local console or a remote service like SSH to log in.
By default, all users can log into the remote basic authentication server by using their LDAP credentials. You can change this behavior:
- If you use IPA joined systems, configure host-based access control.
- If you use Active Directory joined systems, use a group policy object.
- For other cases, see the SSSD configuration documentation.
14.4. Configuring Apache to use SSSD Copiar enlaceEnlace copiado en el portapapeles!
Create a /etc/pam.d/openshift file that contains the following contents:
auth required pam_sss.so account required pam_sss.so
auth required pam_sss.so account required pam_sss.so
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This configuration enables PAM, the pluggable authentication module, to use pam_sss.so to determine authentication and access control when an authentication request is issued for the openshift stack.
Edit the /etc/httpd/conf.modules.d/55-authnz_pam.conf file and uncomment the following line:
LoadModule authnz_pam_module modules/mod_authnz_pam.so
LoadModule authnz_pam_module modules/mod_authnz_pam.so
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To configure the Apache httpd.conf file for remote basic authentication, create the openshift-remote-basic-auth.conf file in the /etc/httpd/conf.d directory. Use the following template to provide your required settings and values:
ImportantCarefully review the template and customize its contents to fit your environment.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the check_user.php script in the /var/www/html directory. Include the following code:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable Apache to load the module. Modify the /etc/httpd/conf.modules.d/55-lookup_identity.conf file and uncomment the following line:
LoadModule lookup_identity_module modules/mod_lookup_identity.so
LoadModule lookup_identity_module modules/mod_lookup_identity.so
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set an SELinux boolean so that SElinux allows Apache to connect to SSSD over D-BUS:
setsebool -P httpd_dbus_sssd on
# setsebool -P httpd_dbus_sssd on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set a boolean to tell SELinux that it is acceptable for Apache to contact the PAM subsystem:
setsebool -P allow_httpd_mod_auth_pam on
# setsebool -P allow_httpd_mod_auth_pam on
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start Apache:
systemctl start httpd.service
# systemctl start httpd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
14.5. Configuring OpenShift Container Platform to use SSSD as the basic remote authentication server Copiar enlaceEnlace copiado en el portapapeles!
Modify the default configuration of your cluster to use the new identity provider that you created. Complete the following steps on the first master host listed in the Ansible host inventory file.
- Open the /etc/origin/master/master-config.yaml file.
Locate the identityProviders section and replace it with the following code:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart OpenShift Container Platform with the updated configuration:
systemctl restart atomic-openshift-master-api systemctl restart atomic-openshift-master-controllers
# systemctl restart atomic-openshift-master-api # systemctl restart atomic-openshift-master-controllers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Test a login by using the
oc
CLI:oc login https://openshift.example.com:8443
$ oc login https://openshift.example.com:8443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can log in only with valid LDAP credentials.
List the identities and confirm that an email address is displayed for each user name. Run the following command:
oc get identity -o yaml
$ oc get identity -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow