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.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 12. Advanced LDAP Configuration
12.1. Overview Copia collegamentoCollegamento copiato negli appunti!
OpenShift Enterprise Advanced Lightweight Directory Access Protocol (LDAP) Configuration covers the following topics:
12.2. Setting up SSSD for LDAP Failover Copia collegamentoCollegamento copiato negli appunti!
12.2.1. Overview Copia collegamentoCollegamento copiato negli appunti!
OpenShift Enterprise provides an authentication provider for use with Lightweight Directory Access Protocol (LDAP) setups, but it can only connect to a single LDAP server. This can be problematic if that LDAP server becomes unavailable. System Security Services Daemon (SSSD) can be used to solve the issue.
Originally designed to manage local and remote authentication to the host operating system, SSSD can now be configured to provide identity, authentication, and authorization services to web services like OpenShift Enterprise. SSSD provides advantages over the built-in LDAP provider, including the ability to connect to any number of failover LDAP servers, as well as the ability to cache authentication attempts in case it can no longer reach any of those servers.
The setup for this configuration is advanced and requires a separate authentication server (also called an authenticating proxy) for OpenShift Enterprise to communicate with. This topic describes how to do this setup on a dedicated physical or virtual machine (VM), but the concepts are also applicable to a setup in a container.
12.2.2. Prerequisites for Authenticating Proxy Setup Copia collegamentoCollegamento copiato negli appunti!
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 VMs:
- proxy.example.com: A VM to use as the authenticating proxy. This machine must have at least SSSD 1.12.0 available, which means a fairly recent operating system. This topic uses a Red Hat Enterprise Linux 7.2 server for its examples.
- openshift.example.com: A VM to use to run OpenShift Enterprise.
These VMs can be configured to run on the same system, but for the examples used in this topic they are kept separate.
12.2.3. Phase 1: Certificate Generation Copia collegamentoCollegamento copiato negli appunti!
To ensure that communication between the authenticating proxy and OpenShift Enterprise is trustworthy, create a set of Transport Layer Security (TLS) certificates to use during the other phases of this setup. In the OpenShift Enterprise system, start by using the auto-generated certificates created as part of running:
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 Among other things, this generates a /etc/origin/master/ca.{cert|key}. Use this signing certificate to generate keys to use on the authenticating proxy.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantEnsure that any host names and interface IP addresses that need to access the proxy are listed. Otherwise, the HTTPS connection will fail.
Create a new CA to sign this client certificate:
oadm ca create-signer-cert \ --cert='/etc/origin/proxy/proxyca.crt' \ --key='/etc/origin/proxy/proxyca.key' \ --name='openshift-proxy-signer@UNIQUESTRING' \ --serial='/etc/origin/proxy/proxyca.serial.txt'
# oadm ca create-signer-cert \ --cert='/etc/origin/proxy/proxyca.crt' \ --key='/etc/origin/proxy/proxyca.key' \ --name='openshift-proxy-signer@UNIQUESTRING' \
1 --serial='/etc/origin/proxy/proxyca.serial.txt'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Make
UNIQUESTRING
something unique.
Generate the API client certificate that the authenticating proxy will use to prove its identity to OpenShift Enterprise.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This prevents malicious users from impersonating the proxy and sending fake identities.
Copy the certificate and key information to the appropriate file for future steps:
cat /etc/origin/proxy/system\:proxy.crt \ /etc/origin/proxy/system\:proxy.key \ /etc/origin/proxy/system\:proxy.key \ > /etc/origin/proxy/authproxy.pem > /etc/origin/proxy/authproxy.pem
# cat /etc/origin/proxy/system\:proxy.crt \ /etc/origin/proxy/system\:proxy.key \ > /etc/origin/proxy/authproxy.pem
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.2.4. Phase 2: Authenticating Proxy Setup Copia collegamentoCollegamento copiato negli appunti!
This section guides you through the steps to authenticate the proxy setup.
12.2.4.1. Step 1: Copy Certificates Copia collegamentoCollegamento copiato negli appunti!
From openshift.example.com, securely copy the necessary certificates to the proxy machine:
12.2.4.2. Step 2: SSSD Configuration Copia collegamentoCollegamento copiato negli appunti!
- Install a new VM with an operating system that includes 1.12.0 or later so that you can use the mod_identity_lookup module. The examples in this topic use a Red Hat Enterprise Linux 7.2 Server.
Install all of the necessary dependencies:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This gives you the needed SSSD and the web server components.
Edit the /etc/httpd/conf.modules.d/55-authnz_pam.conf file and remove the comment from the following:
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 Set up SSSD to authenticate this VM against the LDAP server. If the LDAP server is a FreeIPA or Active Directory environment, then realmd can be used 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 case, see the System-Level Authentication Guide
If you want to use SSSD to manage failover situations for LDAP, this can be configured by adding additional entries in /etc/sssd/sssd.conf on the ldap_uri line. Systems enrolled with FreeIPA can automatically handle failover using DNS SRV records.
Restart SSSD to ensure that all of the changes are applied properly:
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 - Attempt to log into the VM as an LDAP user and confirm that the authentication is properly set up. This can be done via the local console or a remote service such as SSH.
If you do not want LDAP users to be able to log into this machine, it is recommended to modify /etc/pam.d/system-auth and /etc/pam.d/password-auth to remove the lines containing pam_sss.so.
12.2.4.3. Step 3: Apache Configuration Copia collegamentoCollegamento copiato negli appunti!
You need to set up Apache to communicate with SSSD. Create a PAM stack file for use with Apache. To do so:
Create the /etc/pam.d/openshift file and add 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.
Configure the Apache httpd.conf. The steps in this section focus on setting up the challenge authentication, which is useful for logging in with
oc login
and similar automated tools.NoteConfiguring Form-Based Authentication explains how to set up a graphical login using SSSD as well, but it requires the rest of this setup as a prerequisite.
Create the new file openshift-proxy.conf in /etc/httpd/conf.d (substituting the correct host names where indicated):
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteConfiguring Form-Based Authentication explains how to add the login-proxy block to support form authentication.
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 up Apache:
systemctl start httpd.service
# systemctl start httpd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.2.5. Phase 3: OpenShift Enterprise Configuration Copia collegamentoCollegamento copiato negli appunti!
This section describes how to set up an OpenShift Enterprise server from scratch in an "all in one" configuration. Master and Node Configuration provides more information on alternate configurations.
Modify the default configuration to use the new identity provider just created. To do so:
- Modify the /etc/origin/master/master-config.yaml file.
Scan through it and locate the identityProviders section and replace it with:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteConfiguring Form-Based Authentication explains how to add the login URL to support web logins.
Configuring Extended LDAP Attributes explains how to add the email and full-name attributes. Note that the full-name attributes are only stored to the database on the first login.
Start OpenShift Enterprise with the updated configuration:
openshift start \ --public-master=https://openshift.example.com:8443 \ --master-config=/etc/origin/master/master-config.yaml \ --node-config=/etc/origin/node-node1.example.com/node-config.yaml
# openshift start \ --public-master=https://openshift.example.com:8443 \ --master-config=/etc/origin/master/master-config.yaml \ --node-config=/etc/origin/node-node1.example.com/node-config.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Test logins:
oc login https://openshift.example.com:8443
oc login https://openshift.example.com:8443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow It should now be possible to log in with only valid LDAP credentials.
12.3. Configuring Form-Based Authentication Copia collegamentoCollegamento copiato negli appunti!
12.3.1. Overview Copia collegamentoCollegamento copiato negli appunti!
This topic builds upon Setting up SSSD for LDAP Failover and describes how to set up form-based authentication for signing into the OpenShift Enterprise web console.
12.3.2. Prepare a Login Page Copia collegamentoCollegamento copiato negli appunti!
The OpenShift Enterprise upstream repositories have a template for forms. Copy that to your authenticating proxy on proxy.example.com:
curl -o /var/www/html/login.html \ https://raw.githubusercontent.com/openshift/openshift-extras/master/misc/form_auth/login.html
# curl -o /var/www/html/login.html \
https://raw.githubusercontent.com/openshift/openshift-extras/master/misc/form_auth/login.html
Modify this .html file to change the logo icon and "Welcome" content for your environment.
12.3.3. Install Another Apache Module Copia collegamentoCollegamento copiato negli appunti!
To intercept form-based authentication, install an Apache module:
yum -y install mod_intercept_form_submit
# yum -y install mod_intercept_form_submit
12.3.4. Apache Configuration Copia collegamentoCollegamento copiato negli appunti!
- Modify /etc/httpd/conf.modules.d/55-intercept_form_submit.conf and uncomment the LoadModule line.
Add a new section to your openshift-proxy.conf file inside the
<VirtualHost *:443>
block.Copy to Clipboard Copied! Toggle word wrap Toggle overflow This tells Apache to listen for POST requests on the /login-proxy/oauth/authorize and to pass the user name and password over to the openshift PAM service.
- Restart the service and move back over to the OpenShift Enterprise configuration.
12.3.5. OpenShift Enterprise Configuration Copia collegamentoCollegamento copiato negli appunti!
In the master-config.yaml file, update the identityProviders section:
Restart OpenShift Enterprise with the updated configuration.
NoteYou should be able to browse to https://openshift.example.com:8443 and use your LDAP credentials to sign in via the login form.
12.4. Configuring Extended LDAP Attributes Copia collegamentoCollegamento copiato negli appunti!
12.4.1. Overview Copia collegamentoCollegamento copiato negli appunti!
This topic builds upon Setting up SSSD for LDAP Failover and Configuring Form-Based Authentication and focuses on configuring extended Lightweight Directory Access Protocol (LDAP) attributes.
12.4.2. Prerequisites Copia collegamentoCollegamento copiato negli appunti!
- SSSD 1.12.0 or later. This is available on Red Hat Enterprise Linux 7.0 and later.
mod_lookup_identity 0.9.4 or later.
- The required version is not yet available on any version of Red Hat Enterprise Linux. However, compatible packages (RPMs) are available from upstream until they arrive in Red Hat Enterprise Linux.
12.4.3. Configuring SSSD Copia collegamentoCollegamento copiato negli appunti!
You need to ask System Security Services Daemon (SSSD) to look up attributes in LDAP that it normally does not care about for simple system-login use-cases. In the case of OpenShift Enterprise, there is only one such attribute: email. So, you need to:
Modify the [domain/DOMAINNAME] section of /etc/sssd/sssd.conf on the authenticating proxy and add this attribute:
[domain/example.com] ... ldap_user_extra_attrs = mail
[domain/example.com] ... ldap_user_extra_attrs = mail
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Tell SSSD that it is acceptable for this attribute to be retrieved by Apache. Add the following two lines to the [ifp] section of /etc/sssd/sssd.conf:
[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 Restart SSSD:
systemctl restart sssd.service
# systemctl restart sssd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Test this configuration.
12.4.4. Configuring Apache Copia collegamentoCollegamento copiato negli appunti!
Now that SSSD is set up and successfully serving extended attributes, configure the web server to ask for them and to insert them in the correct places.
Enable the module to be loaded by Apache. To do so, modify /etc/httpd/conf.modules.d/55-lookup_identity.conf and uncomment the 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 Edit /etc/httpd/conf.d/openshift-proxy.conf and add the following lines inside the <ProxyMatch /oauth/authorize> section:
Restart Apache to pick up the changes:
systemctl restart httpd.service
# systemctl restart httpd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.4.5. Configuring OpenShift Enterprise Copia collegamentoCollegamento copiato negli appunti!
Tell OpenShift Enterprise where to find these new attributes during login. To do so:
Edit the /etc/origin/master/master-config.yaml file and add the following lines to the identityProviders section:
Launch OpenShift Enterprise with this updated configuration and log in to the web as a new user.
You should see their full name appear in the upper-right of the screen. You can also verify with
oc get identities -o yaml
that both email addresses and full names are available.
12.4.6. Debugging Notes Copia collegamentoCollegamento copiato negli appunti!
Currently, OpenShift Enterprise only saves these attributes to the user at the time of the first login and does not update them again after that. So, while you are testing (and only while testing), run oc delete users,identities --all
to clear the identities out so you can log in again.