Federate with Identity Service
Federate with Identity Service using Red Hat Single Sign-On
Abstract
Making open source more inclusive Copy linkLink copied to clipboard!
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message. :leveloffset: +0
Providing feedback on Red Hat documentation Copy linkLink copied to clipboard!
We appreciate your input on our documentation. Tell us how we can make it better.
Using the Direct Documentation Feedback (DDF) function
Use the Add Feedback DDF function for direct comments on specific sentences, paragraphs, or code blocks.
- View the documentation in the Multi-page HTML format.
- Ensure that you see the Feedback button in the upper right corner of the document.
- Highlight the part of text that you want to comment on.
- Click Add Feedback.
- Complete the Add Feedback field with your comments.
- Optional: Add your email address so that the documentation team can contact you for clarification on your issue.
- Click Submit.
Chapter 1. Introduction Copy linkLink copied to clipboard!
Red Hat does not support federation at this time. This feature should only be used for testing, and should not be deployed in a production environment.
To configure federation in a high availability Red Hat OpenStack Platform director environment, you must configure the following:
- Red Hat Identity Management
- Red Hat single sign-on (RH-SSO)
- The Red Hat OpenStack Platform overcloud
1.1. Overview Copy linkLink copied to clipboard!
Federated authentication is a method of providing authentication across disparate services. This authentication solution relies on an identity provider (IdP), a service provider (SP), and is based on the Security Assertion Markup Language (SAML).
When OpenStack is the service provider in a federated authentication solution, members of the Red Hat Identity Management (IdM) group openstack-users are mapped into OpenStack Keystone group federated_users with the Member role for project access. Consequently, you are able to grant users access to OpenStack by adding those users to the IdM group openstack-users.
1.2. Prerequisites Copy linkLink copied to clipboard!
You will need the following completed before deploying federated authentication:
You have deployed Red Hat OpenStack Platform director and the overcloud with the following properties:
- You can use SSH to connect to both Red Hat OpenStack Platform director, and each of the overcloud nodes.
- All nodes have a fully qualified domain name (FQDN).
- TLS encryption is used for all external communications.
- HAProxy terminates TLS front-end connections, and servers running behind HAProxy do not use TLS.
- An RH-SSO server is present, and you either have administrative privileges on the server, or the RH-SSO administrator has created a realm for you and given you administrative privileges on that realm. Because federated IdPs are external by definition, the RH-SSO server is assumed to be external to the Red Hat OpenStack Platform director overcloud. For more information, see Installing and configuring RH-SSO and Creating a realm and user.
- An IdM server is present, and also external to the Red Hat OpenStack Platform director overcloud where users and groups are managed. RH-SSO uses IdM as its User Federation backing store.
- You follow the examples described in the Keystone Federation Configuration Guide.
-
On the
undercloud-0node, you install the helper files into the home directory of thestackuser, and work in thestackuser home directory. -
On the
controller-0node, you install the helper files into the home directory of theheat-adminuser, and work in theheat-adminuser home directory. -
If
mod_auth_mellonwas previously installed on your controller nodes, you must reinstall it as the Puppet Apache class will remove any Apache configuration files not under Puppet’s control.
Only the Red Hat OpenStack overcloud has federation enabled. The director is not federated.
1.3. Accessing the Red Hat OpenStack Platform nodes Copy linkLink copied to clipboard!
By default, you must login to Red Hat OpenStack Platform director to access the overcloud nodes.
Use SSH to connect to Red Hat OpenStack director:
ssh undercloud-0
# ssh undercloud-0Copy to Clipboard Copied! Toggle word wrap Toggle overflow Become the
stackuser:su - stack
$ su - stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow Source the
stackrcconfiguration to enable the required OpenStack environment variables:source stackrc
$ source stackrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow After you source
stackrc, you can issue commands using theopenstackcommand line tool, which operates against Red Hat OpenStack Platform director. To directly access one of the overcloud nodes, retrieve the ip address by usingopenstack server listand then using SSH to connect:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.4. Overview of technologies Copy linkLink copied to clipboard!
The following technologies are a part of Red Hat OpenStack Platform.
1.4.1. High availability Copy linkLink copied to clipboard!
Red Hat OpenStack Platform director distributes redundant copies of various OpenStack services across the overcloud deployment. These redundant services are deployed on the overcloud controller nodes, with director naming these nodes controller-0, controller-1, controller-2, and so on, depending on how many controller nodes Red Hat OpenStack Platform director has configured.
The IP addresses of the Controller nodes are not externally visible because the services running on the Controller nodes are HAProxy back-end servers. There is one publicly visible IP address for the set of controller nodes; this is HAProxy’s front end. When a request arrives for a service on the public IP address, HAProxy selects a back-end server to service the request.
The overcloud is organized as a high availability cluster. Pacemaker manages the cluster, performs health checks, and can failover to another cluster resource if the resource stops functioning. You use Pacemaker to start and stop these resources.
For more information about high availability, see the High Availability Deployment and Usage guide.
1.4.1.1. Managing Pacemaker Services Copy linkLink copied to clipboard!
Do not use the podman command on a Controller node to manage contained services that Pacemaker manages. Use the Pacemaker pcs command:
sudo pcs resource restart haproxy-bundle
sudo pcs resource restart haproxy-bundle
To determine the resource name, use the Pacemaker status command:
1.4.2. HAProxy Overview Copy linkLink copied to clipboard!
HAProxy serves a similar role to Pacemaker. It performs health checks on the back-end servers and forwards requests to functioning back-end servers. There is a cop of HAProxy running on all Controller nodes.
Although there are N copies of HAProxy running, only one is actually fielding requests at any given time; this active HAProxy instance is managed by Pacemaker. This approach prevents conflicts from occurring, and allows multiple copies of HAProxy to coordinate the distribution of requests across multiple back-ends. If Pacemaker detects that HAProxy has failed, it reassigns the front-end IP address to a different HAProxy instance. This HAProxy instance then becomes the controlling HAProxy instance.
1.5. Using a conifguration script Copy linkLink copied to clipboard!
To configure federated authentication, you will need to run long and complex commands. To make that task easier and to allow for repeatability, the commands are saved to a shell script called configure-federation. You can execute a specific step if you pass the name of the step to configure-federation. To view the list of possible commands, use the help option (-h or --help).
For more information on the contents of the script, see Chapter 6, The configure-federation file.
To view the commands that are executed after variable substitution, use the following options:
- -n
- This option provides a dry-run mode that writes its operations to stdout without making changes on the system.
- -v
- This option provides a verbose mode that writes its operations to stdout before executing. This is useful for logging.
1.6. Using a proxy or SSL terminator Copy linkLink copied to clipboard!
Consider the following key features for environments behind a proxy.
A back-end server might have a different hostname, listen on different port, or use a different protocol than what a client sees on the front side of the proxy.
Problems can occur when a server generates a self-referential URL, for example if the server redirects the client to a different URL on the same server. The URL that the server generates must match the public address and port as seen by the client.
Authentication protocols such as HTTP and HTTPS are sensitive to the host, port, and protocol, because they often need to ensure a request was targeted for a specific server, port and on a secure transport. Proxies can interfere with this information.
- A proxy transforms a request received on its public front-end before dispatching it to a non-public server in the back-end.
Responses from the non-public back-end server sometimes need adjustment so that it appears as if the response came from the public front-end of the proxy.
There are various approaches to solving this problem. Because SAML is sensitive to host, port, and protocol information, and because you are configuring SAML behind a high availability proxy (HAProxy), you must deal with these issues or your configuration will likely fail.
Chapter 2. Configuring Red Hat Identity management Copy linkLink copied to clipboard!
You can configure Red Hat OpenStack Platform with federated user management with the following features:
- Red Hat Identity Management (IdM) is external to Red Hat OpenStack Platform
- Red Hat IdM is the source of all user and group information
- Red Hat Single Signon (RH-SSO) is configured to use Red Hat IdM for user Federation
2.1. Creating the IdM service account for RH-SSO Copy linkLink copied to clipboard!
If you use anonomous binds, some information that is essential for Red Hat Single Sign-On (RH-SSO) is withheld for security reasons. As a result, you need provide the appropriate privileges for RH-SSO in the forma a dedicated account to query the IdM LDAP server for this information:
You can use the configure-federation script to perform the above step: $ ./configure-federation create-ipa-service-account
2.2. Creating a test user Copy linkLink copied to clipboard!
Create a user account in IdM for testing:
Procedure
Create a user
jdoein IdM:$ipa user-add --first John --last Doe --email jdoe@example.com jdoe
$ipa user-add --first John --last Doe --email jdoe@example.com jdoeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Assign a password to the user:
$ipa passwd jdoe
$ipa passwd jdoeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Creating an IdM group for OpenStack users Copy linkLink copied to clipboard!
You must have an IdM group openstack-users to map to the Keystone group federated_users. Map the test user to this group.
Create the openstack-users group in Red Hat Identity Management (IdM):
Procedure
Ensure that the
openstack-usersgroup does not exist:ipa group-show openstack-users
$ ipa group-show openstack-users ipa: ERROR: openstack-users: group not foundCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the openstack-users group to IdM:
ipa group-add openstack-users
ipa group-add openstack-usersCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the test users to the
openstack-usersgroup:ipa group-add-member --users jdoe openstack-users
ipa group-add-member --users jdoe openstack-usersCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the
openstack-usersgroup exists and has the test user as a member:ipa group-show openstack-users
$ ipa group-show openstack-users Group name: openstack-users GID: 331400001 Member users: jdoeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 3. Configuring Red Hat Single Sign-On Copy linkLink copied to clipboard!
Red Hat Single Sign-On (RH-SSO) supports multi-tenancy, and uses realms to allow for separation between tenants. As a result RH-SSO operations always occur within the context of a realm. You can either create the realm manually, or with the keycloak-httpd-client-install tool if you have administrative privileges on the RH-SSO server.
Prerequisites
You must have a fully installed RH-SSO server. For more information on installing RH-SSO, see Server installation and configuration guide.
You need definitions for the following variables as they appear below:
| <_RH_RHSSO_URL_> | The Red Hat Single Sign-On URL |
| <_FED_RHSSO_REALM_> | Identifies the RH-SSO realm in use |
3.1. Configuring the RH-SSO realm Copy linkLink copied to clipboard!
When the Red Hat Single Sign-On (RH-SSO) realm is available, use the RH-SSO web console to configure the realm for user federation against IdM:
Procedure
- From the drop-down list in the uppper left corner, select your RH-SSO realm.
-
From the
Configurepanel, selectUser Federation. -
From the
Add providerdrop-down list in theUser Federationpanel, selectldap. Provide values for the following parameters. Substitute all site-specific values with values relevant to your environment.
Expand Property Value Console Display Name
Red Hat IDM
Edit Mode
READ_ONLY
Sync Registrations
Off
Vendor
Red Hat Directory Server
Username LDAP attribute
uid
RDN LDAP attribute
uid
UUID LDAP attribute
ipaUniqueID
User Object Classes
inetOrgPerson, organizationalPerson
Connection URL
LDAPS://<_FED_IPA_HOST_>
Users DN
cn=users,cn=accounts,<_FED_IPA_BASE_DN_>
Authentication Type
simple
Bind DN
uid=rhsso,cn=sysaccounts,cn=etc,<_FED_IPA_BASE_DN_>
Bind Credential
<_FED_IPA_RHSSO_SERVICE_PASSWD_>
- Use the Test connection and Test authentication buttons to ensure that user federation is working.
-
Click
Saveto save the new user federation provider. -
Click the
Mapperstab at the top of the Red Hat IdM user federation page you created. - Create a mapper to retrieve the user group information. A user’s group membership returns the SAM assertion. Use group membership later to provide authorization in OpenStack.
-
Click
Createin the Mappers page. On the
Add user federation mapperpage, selectgroup-ldap-mapperfrom the Mapper Type drop-down list, and name itGroup Mapper. Provide values for the following parameters. Substitute all site-specific values with values relevant to your environment.Expand Property Value LDAP Groups DN
cn=groups,cn=accounts„<_FED_IPA_BASE_DN_>
Group Name LDAP Attribute
cn
Group Object Classes
groupOfNames
Membership LDAP Attribute
member
Membership Attribute Type
DN
Mode
READ_ONLY
User Groups Retrieve Strategy
GET_GROUPS_FROM_USER_MEMBEROF_ATTRIBUTE
-
Click
Save.
3.2. Adding user attrubutes using SAML assertion Copy linkLink copied to clipboard!
Security Assertion Markup Language (SAML) is an open standard that allows the communication of user attributes and authorization credentials between the identity provider (IdP) and a service provider (SP).
You can configure Red Hat Single Sign-On (RH-SSO) to return the attribues that you require in the assertion. When the OpenStack Identity service receives the SAML assertion, it maps those attributes onto OpenStack users. The process of mapping IdP attributes into Identity Service data is called Federated Mapping. For more information, see Section 4.20, “Create the Mapping File and Upload to Keystone”.
Use the following process to add attributes to SAML:
Procedure
- In the RH-SSO administration web console, select <_FED_RHSSO_REALM_> from the drop-down list in the upper left corner.
-
Select
Clientsfrom theConfigurepanel. -
Select the service provider client that keycloak-httpd-client-install configured. You can identify the client with the SAML
EntityId. - Select the mappers tab from the horizontal list of tabs.
-
In the Mappers panel, select
CreateorAdd Builtinto add a protocol mapper to the client.
You can add additional attributes, but you only need the list of groups for which the user is a member. Group membership is how you authorize the user.
3.3. Adding group information to the SAML assertion Copy linkLink copied to clipboard!
Procedure
-
Click the
Createbutton in the Mappers Panel. -
In the
Create Protocol Mapperpanel, select Group list from the Mapper tpe drop-down list. -
Enter Group List as a name in the
Namefield. Enter groups as the name of the SAML attribute in the Group attribute
Namefield.NoteThis is the name of the attribute as it appears in the SAML assertion. When the keystone mapper searches for names in the
Remotesection of the mapping declaration, it searches for the SAML attrubute name. When you add an attribute in RH-SSO to be passed in the assertion, specify the SAML attribute name. You define the name in the RH-SSO protocol mapper.-
In the SAML Attribute NameFormat parameter, select
Basic. -
In the Single Group Attribute toggle box, select
On. -
Click
Save.
When you run the keycloak-httpd-client-install tool, the process adds a group mapper.
Chapter 4. Configuring Red Hat OpenStack Platform for Federation Copy linkLink copied to clipboard!
The following nodes require an assigned Fully-Qualified Domain Name (FQDN):
- The host running the Dashboard (horizon).
-
The host running the Identity Service (keystone), referenced in this guide as
$FED_KEYSTONE_HOST. Note that more than one host will run a service in a high-availability environment, so the IP address is not a host address but rather the IP address bound to the service. - The host running RH-SSO.
- The host running IdM.
The Red Hat OpenStack Platform director deployment does not configure DNS or assign FQDNs to the nodes, however, the authentication protocols (and TLS) require the use of FQDNs.
4.1. Retrieving the IP address Copy linkLink copied to clipboard!
In Red Hat OpenStack Platform, there is one common public IP address for all OpenStack services, separated by port number. To determine the public IP address of the overcloud services, use the openstack endpoint list command:
4.2. Setting the host variables and naming the host Copy linkLink copied to clipboard!
You must determine the IP address and port to use. In this example, the IP address is 10.0.0.101 and the port is 13000.
Confirm this value in overcloudrc:
export OS_AUTH_URL=https://10.0.0.101:13000/v2.0
export OS_AUTH_URL=https://10.0.0.101:13000/v2.0Copy to Clipboard Copied! Toggle word wrap Toggle overflow Assign the IP address a fully qualified domain name (FQDN), and write it to the
/etc/hostsfile. This example uses overcloud.localdomain:10.0.0.101 overcloud.localdomain # FQDN of the external VIP
10.0.0.101 overcloud.localdomain # FQDN of the external VIPCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAlthough Red Hat OpenStack Platform director configures the hosts files on the overcloud nodes, you might need to add the host entry on any external hosts that participate.
Set the $FED_KEYSTONE_HOST and $FED_KEYSTONE_HTTPS_PORT in the fed_variables file. This example uses the same values:
FED_KEYSTONE_HOST="overcloud.localdomain" FED_KEYSTONE_HTTPS_PORT=13000
FED_KEYSTONE_HOST="overcloud.localdomain" FED_KEYSTONE_HTTPS_PORT=13000Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Because Mellon runs on the Apache server that hosts Identity service (keystone), the Mellon host:port and keystone host:port values must match.
If you run the hostname command on one of the Controller nodes, is output is similar to controller-0.localdomain. This is an internal cluster name, not its public name. Use the public IP address instead.
4.3. Installing helper files Copy linkLink copied to clipboard!
You must install the helper files as part of the configuration.
-
Copy the
configure-federationandfed_variablesfiles that you created as part of Section 1.5, “Using a conifguration script” into thestackhome directory onundercloud-0.
4.4. Setting your deployment variables Copy linkLink copied to clipboard!
The file fed_variables contains variables specific to your federation deployment. These variables are referenced in this guide as well as in the configure-federation helper script. Each site-specific federation variable is prefixed with FED_. Ensure that every FED_ variable in fed_variables is provided a value.
4.5. Copying the helper files Copy linkLink copied to clipboard!
You must have the configuration file and variable files on controller-0 to continue.
-
Copy the configure-federation and the edited fed_variables from the
~/stackhome directory onundercloud-0to the~/heat-adminhome directory oncontroller-0:
scp configure-federation fed_variables heat-admin@controller-0:/home/heat-admin
$ scp configure-federation fed_variables heat-admin@controller-0:/home/heat-admin
You can use the configure-federation script to perform the above step: $ ./configure-federation copy-helper-to-controller
4.6. Initializing the working environments Copy linkLink copied to clipboard!
On the undercloud node, as the
stackuser, create thefed_deploymentdirectory. This location is the file stash:su - stack mkdir fed_deployment
$ su - stack $ mkdir fed_deploymentCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use the
configure-federationscript to perform the previous step:./configure-federation initialize
$ ./configure-federation initializeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use SSH to connect to
controller-0, and create the~/fed_deploymentdirectory as thehead-adminuser. This location is the file stash:ssh heat-admin@controller-0 mkdir fed_deployment
$ ssh heat-admin@controller-0 $ mkdir fed_deploymentCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use the
configure-federationscript to perform the previous step. From thecontroller-0node:./configure-federation initialize
$ ./configure-federation initializeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
4.7. Installing mod_auth_mellon Copy linkLink copied to clipboard!
You must install the mod_auth_mellon on each controller in your environment.
On each controller, run the following:
ssh heat-admin@controller-n # replace n with controller number sudo dnf install mod_auth_mellon
$ ssh heat-admin@controller-n # replace n with controller number $ sudo dnf install mod_auth_mellonCopy to Clipboard Copied! Toggle word wrap Toggle overflow
4.8. Adding the RH-SSO FQDN to each Controller Copy linkLink copied to clipboard!
Ensure that every controller is reachable by its fully-qualified domain name (FQDN).
The mellon service runs on each Controller node and connects to the RH-SSO IdP. If the FQDN of the RH-SSO IdP is not resolvable through DNS, manually add the FQDN to the
/etc/hostsfile on all controller nodes after theHeat Hostssection:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.9. Installing and configuring Mellon on the Controller node Copy linkLink copied to clipboard!
The keycloak-httpd-client-install tool performs many of the steps needed to configure mod_auth_mellon and have it authenticate against the RH-SSO IdP. Run the keycloak-httpd-client-install tool on the node where mellon runs. In this example, mellon runs on the overcloud controllers protecting the Identity service (keystone).
Red Hat OpenStack Platform is a high availability deployment with multiple overcloud Controller nodes, each running identical copies. As a result, you must replicate the mellon configuration on each Controller node. To do this, install and configure mellon on controller-0, and collect the configuration files that the keycloak-httpd-client-install tool created into a tar file. Use Object Storage (swift) to copy the archive to each Controller and unarchive the files there.
Run the RH-SSO client installation:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use the configure-federation script to perform the above step:
$ ./configure-federation client-install
After the client RPM installation, you should see output similar to this:
4.10. Editing the Mellon configuration Copy linkLink copied to clipboard!
During the IdP-assertion-to-Keystone mapping phase, your groups must be in a semicolon separated list. Use the following procedure to configure mellon so that when it receives multiple values for an attribute, it combines them into a semicolon-separated single value.
Procedure
-
Open the
v3_mellon_keycloak_openstack.confconfiguration file for editing:
vi /var/lib/config-data/puppet-generated/keystone/etc/httpd/conf.d/v3_mellon_keycloak_openstack.conf
$ vi /var/lib/config-data/puppet-generated/keystone/etc/httpd/conf.d/v3_mellon_keycloak_openstack.conf
Add the
MellonMergeEnvVarsparameter to the <Location /v3> block:<Location /v3> ... MellonMergeEnvVars On ";" </Location><Location /v3> ... MellonMergeEnvVars On ";" </Location>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.11. Creating an archive of the generated configuration files Copy linkLink copied to clipboard!
To replicate the mellon configuration on all Controller nodes, create an archive of the files to install on each Controller node. Store the archive in the ~/fed_deployment subdirectory.
Create the compressed archive:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the previous step:
./configure-federation create-sp-archive
$ ./configure-federation create-sp-archive
4.12. Retrieving the Mellon configuration archive Copy linkLink copied to clipboard!
On the
undercloud-0node, retrieve the archive you created and extract the files so that you can access the data as needed in subsequent steps.scp heat-admin@controller-0:/home/heat-admin/fed_deployment/rhsso_config.tar.gz ~/fed_deployment tar -C fed_deployment -xvf fed_deployment/rhsso_config.tar.gz
$ scp heat-admin@controller-0:/home/heat-admin/fed_deployment/rhsso_config.tar.gz ~/fed_deployment $ tar -C fed_deployment -xvf fed_deployment/rhsso_config.tar.gzCopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above step: $ ./configure-federation fetch-sp-archive
4.13. Preventing Puppet from deleting unmanaged HTTPD files Copy linkLink copied to clipboard!
By default, the Puppet Apache module purges any files in Apache configuration directories that it does not manage. This prevents Apache from operating against the configuration that Puppet enforces. However, this conflicts with the manual configuration of mellon in the HTTPD configuration directories. The Apache Puppet apache::purge_configs flag is enabled by default, which directs Puppet to delete files that belong to the mod_auth_mellon RPM. Puppet also deletes the configuration files that keycloak-httpd-client-install generates. Until Puppet controls the mellon files, disable the apache::purge_configs flag.
Disabling the apache::purge_configs flag opens the Controller nodes to vulnerabilities. Re-enable it when Puppet adds support managing mellon.
To override the apache::purge_configs flag, create a Puppet file that contains the override, and add the override file to the list of Puppet files you use when you run the overcloud_deploy.sh script.
Create the
fed_deployment/puppet_override_apache.yamlenvironment file and add the following content:parameter_defaults: ControllerExtraConfig: apache::purge_configs: falseparameter_defaults: ControllerExtraConfig: apache::purge_configs: falseCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add
puppet_override_apache.yamlas the last environment file in the overcloud_deploy.sh script:... -e /home/stack/fed_deployment/puppet_override_apache.yaml \ --log-file overcloud_deployment_14.log &> overcloud_install.log
... -e /home/stack/fed_deployment/puppet_override_apache.yaml \ --log-file overcloud_deployment_14.log &> overcloud_install.logCopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above step: $ ./configure-federation puppet-override-apache
4.14. Configuring Identity service (keystone) for federation Copy linkLink copied to clipboard!
Keystone domains require extra configuration. However if the keystone Puppet module is enabled, it can perform this extra configuration step.
In on of the Puppet YAML files, add the following:
keystone::using_domain_config: true
keystone::using_domain_config: trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Set the following values in /etc/keystone/keystone.conf to enable federation.
auth:methods-
A list of allowed authentication methods. By default the list is:
['external', 'password', 'token', 'oauth1']. You must enable SAML by using themappedmethod. Additionally, theexternalmethod must be excluded. Set the value to the following:password,token,oauth1,mapped. federation:trusted_dashboard-
A list of trusted dashboard hosts. Before accepting a Single Sign-On request to return a token, the origin host must be a member of this list. You can use use this configuration option multiple times for different values. You must set this to use web-based SSO flows. For this deployment the value is:
https://$FED_KEYSTONE_HOST/dashboard/auth/websso/The host is $FED_KEYSTONE_HOST because Red Hat OpenStack Platform director co-locates both keystone and horizon on the same host. If horizon runs on a different host to keystone, you must adjust accordingly. federation:sso_callback_template- The absolute path to an HTML file that is used as a Single Sign-On callback handler This page redirects the user from the Identity service back to a trusted dashboard host by form encoding a token in a POST request. The default value is sufficient for most deployments.
federation:remote_id_attributeThe value that is used to obtain the entity ID of the Identity provider. For
mod_auth_mellon, useMellon_IDP. Set this value in the mellon configuration file using the Mellon IDP directive.Create the fed_deployment/puppet_override_keystone.yaml file with the following content:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Append the created environment file at the end of the
overcloud_deploy.shscript.... -e /home/stack/fed_deployment/puppet_override_keystone.yaml \ --log-file overcloud_deployment_14.log &> overcloud_install.log
... -e /home/stack/fed_deployment/puppet_override_keystone.yaml \ --log-file overcloud_deployment_14.log &> overcloud_install.logCopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above step: $ ./configure-federation puppet-override-keystone
4.15. Deploying the Mellon configuration archive Copy linkLink copied to clipboard!
Use Object Storage (swift) artifacts to install the mellon configuration files on each Controller node.
source ~/stackrc upload-swift-artifacts -f fed_deployment/rhsso_config.tar.gz
$ source ~/stackrc $ upload-swift-artifacts -f fed_deployment/rhsso_config.tar.gzCopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above step: `./configure-federation deploy-mellon-configuration `
4.16. Redeploying the overcloud Copy linkLink copied to clipboard!
To apply the changes from the Puppet YAML configuration files and Object Storage artifacts, run the deploy command:
./overcloud_deploy.sh
./overcloud_deploy.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Important: When you make additional changes to the Controller nodes by re-running Puppet, the overcloud_deploy.sh script might overwrite previous configurations. Do not apply the Puppet configuration after this procedure to avoid losing manual edits that you make to the configuration files on the overcloud Controller nodes.
4.17. Use proxy persistence for the Identity service (keystone) on each Controller Copy linkLink copied to clipboard!
When mod_auth_mellon establishes a session, it cannot share its state information across multiple servers. Because the high number of redirections used by SAML involves state information, the same server must process all transactions. Therefore, you must configure HAProxy to direct each client’s requests to the same server each time.
There are two way that HAProxy can bind a client to the same server:
- Affinity
- Use affinity when information from a layer below the application layer is used to pin a client request to a single server.
- Persistence
- Use persistence when the application layer information binds a client to a single server sticky session. Persistence is much more accurate than affinity. Use the following procedure to implement persistence.
The HAProxy cookie directive names a cookie and its parameters for persistence. The HAProxy server directive has a cookie option that sets the value of the cookie to the name of the server. If an incoming request does not have a cookie identifying the back-end server, then HAProxy selects a server based on its configured balancing algorithm.
Procedure
To enable persistence in the
keystone_publicblock of the/var/lib/config-data/puppet-generated/haproxy/etc/haproxy/haproxy.cfgconfiguration file, add the following line:cookie SERVERID insert indirect nocache
cookie SERVERID insert indirect nocacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow This setting states that
SERVERIDis the name of the persistence cookie.Edit each
serverline and addcookie <server-name>as an additional option:server controller-0 cookie controller-0 server controller-1 cookie controller-1
server controller-0 cookie controller-0 server controller-1 cookie controller-1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.18. Creating federated resources Copy linkLink copied to clipboard!
Create the Identity service (keystone) targets, users, and groups for consumption by the identity provider (IdP).
Procedure
Source the
overcloudrcfile on the undercloud as the stack user, and run the following commands:openstack domain create federated_domain openstack project create --domain federated_domain federated_project openstack group create federated_users --domain federated_domain openstack role add --group federated_users --group-domain federated_domain --domain federated_domain _member_ openstack role add --group federated_users --group-domain federated_domain --project federated_project _member_
$ openstack domain create federated_domain $ openstack project create --domain federated_domain federated_project $ openstack group create federated_users --domain federated_domain $ openstack role add --group federated_users --group-domain federated_domain --domain federated_domain _member_ $ openstack role add --group federated_users --group-domain federated_domain --project federated_project _member_Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above step: $ ./configure-federation create-federated-resources
4.19. Creating the Identity provider in Red Hat OpenStack Platform Copy linkLink copied to clipboard!
The IdP must be registered in the Identity service (keystone), which creates a binding between the entityID in the SAML assertion and the name of the IdP in the Identity service.
Procedure
-
Locate the
entityIDof the RH-SSO IdP, which is located in the IdP metadata. The IdP metadata is stored in the/var/lib/config-data/puppet-generated/keystone/etc/httpd/saml2/v3_keycloak_$FED_RHSSO_REALM_idp_metadata.xmlfile. You can also find the IdP metadata in thefed_deployment/var/lib/config-data/puppet-generated/keystone/etc/httpd/saml2/v3_keycloak_$FED_RHSSO_REALM_idp_metadata.xmlfile. -
Note the value of the entityID attribute, which is in the IdP metadata file within the
<EntityDescriptor>element. Assign the$FED_IDP_ENTITY_IDvariable this value. Name your IdP
rhsso, which is assigned to the variable$FED_OPENSTACK_IDP_NAME:openstack identity provider create --remote-id $FED_IDP_ENTITY_ID $FED_OPENSTACK_IDP_NAME
$ openstack identity provider create --remote-id $FED_IDP_ENTITY_ID $FED_OPENSTACK_IDP_NAMECopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above step: $ ./configure-federation openstack-create-idp
4.20. Create the Mapping File and Upload to Keystone Copy linkLink copied to clipboard!
Keystone performs a mapping to match the IdP’s SAML assertion into a format that keystone can understand. The mapping is performed by keystone’s mapping engine and is based on a set of mapping rules that are bound to the IdP.
These are the mapping rules used in this example (as described in the introduction):
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
This mapping file contains only one rule. Rules are divided into two parts: local and remote. The mapping engine works by iterating over the list of rules until one matches, and then executing it. A rule is considered a match only if all the conditions in the remote part of the rule match. In this example the remote conditions specify:
-
The assertion must contain a value called
MELLON_NAME_ID. -
The assertion must contain a values called
MELLON_groupsand at least one of the groups in the group list must beopenstack-users.
If the rule matches, then:
-
The keystone
username will be assigned the value fromMELLON_NAME_ID. -
The user will be assigned to the keystone group
federated_usersin thefederated_domaindomain.
In summary, if the IdP successfully authenticates the user, and the IdP asserts that user belongs to the group openstack-users, then keystone will allow that user to access OpenStack with the privileges bound to the federated_users group in keystone.
4.20.1. Create the mapping Copy linkLink copied to clipboard!
To create the mapping in keystone, create a file containing the mapping rules and then upload it into keystone, giving it a reference name. Create the mapping file in the
fed_deploymentdirectory (for example, infed_deployment/mapping_${FED_OPENSTACK_IDP_NAME}_saml2.json), and assign the name$FED_OPENSTACK_MAPPING_NAMEto the mapping rules. For example:openstack mapping create --rules fed_deployment/mapping_rhsso_saml2.json $FED_OPENSTACK_MAPPING_NAME
$ openstack mapping create --rules fed_deployment/mapping_rhsso_saml2.json $FED_OPENSTACK_MAPPING_NAMECopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above procedure as two steps:
./configure-federation create-mapping ./configure-federation openstack-create-mapping
$ ./configure-federation create-mapping
$ ./configure-federation openstack-create-mapping
-
create-mapping- creates the mapping file. -
openstack-create-mapping- performs the upload of the file.
4.21. Create a Keystone Federation Protocol Copy linkLink copied to clipboard!
Keystone uses the
Mappedprotocol to bind an IdP to a mapping. To establish this binding:openstack federation protocol create \ --identity-provider $FED_OPENSTACK_IDP_NAME \ --mapping $FED_OPENSTACK_MAPPING_NAME \ mapped"
$ openstack federation protocol create \ --identity-provider $FED_OPENSTACK_IDP_NAME \ --mapping $FED_OPENSTACK_MAPPING_NAME \ mapped"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the configure-federation script to perform the above step: $ ./configure-federation openstack-create-protocol
4.22. Fully-Qualify the Keystone Settings Copy linkLink copied to clipboard!
On each controller node, edit
/var/lib/config-data/puppet-generated/keystone/etc/httpd/conf.d/10-keystone_wsgi_main.confto confirm that theServerNamedirective inside theVirtualHostblock includes the HTTPS scheme, the public hostname, and the public port. You must also enable theUseCanonicalNamedirective. For example:<VirtualHost> ServerName https:$FED_KEYSTONE_HOST:$FED_KEYSTONE_HTTPS_PORT UseCanonicalName On ... </VirtualHost>
<VirtualHost> ServerName https:$FED_KEYSTONE_HOST:$FED_KEYSTONE_HTTPS_PORT UseCanonicalName On ... </VirtualHost>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Be sure to substitute the $FED_ variables with the values specific to your deployment.
4.23. Configure Horizon to Use Federation Copy linkLink copied to clipboard!
On each controller node, edit
/var/lib/config-data/puppet-generated/horizon/etc/openstack-dashboard/local_settingsand make sure the following configuration values are set:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Be sure to substitute the $FED_ variables with the values specific to your deployment.
4.24. Configure Horizon to Use the X-Forwarded-Proto HTTP Header Copy linkLink copied to clipboard!
On each controller node, edit
/var/lib/config-data/puppet-generated/horizon/etc/openstack-dashboard/local_settingsand uncomment the line:#SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')#SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You must restart a container for configuration changes to take effect.
Chapter 5. Troubleshooting Copy linkLink copied to clipboard!
5.1. Test the Keystone Mapping Rules Copy linkLink copied to clipboard!
It is recommended you verify that your mapping rules work as expected. The keystone-manage command line tool allows you to exercise a set of mapping rules (read from a file) against assertion data which is also read from a file. For example:
The file
mapping_rules.jsonhas this content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The file
assertion_data.txthas this content:MELLON_NAME_ID: 'G-90eb44bc-06dc-4a90-aa6e-fb2aa5d5b0de MELLON_groups: openstack-users;ipausers
MELLON_NAME_ID: 'G-90eb44bc-06dc-4a90-aa6e-fb2aa5d5b0de MELLON_groups: openstack-users;ipausersCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you then run this command:
keystone-manage mapping_engine --rules mapping_rules.json --input assertion_data.txt
$ keystone-manage mapping_engine --rules mapping_rules.json --input assertion_data.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow You should get this mapped result:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can also include the --engine-debug command line argument, which will output diagnostic information describing how the mapping rules are being evaluated.
5.2. Determine the Actual Assertion Values Received by Keystone Copy linkLink copied to clipboard!
The mapped assertion values that keystone will use are passed as CGI environment variables. To retrieve a dump of those environment variables:
Create the following test script in
/var/www/cgi-bin/keystone/testwith the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
/var/lib/config-data/puppet-generated/keystone/etc/httpd/conf.d/10-keystone_wsgi_main.conffile setting it to run thetestscript by temporarily modifying theWSGIScriptAliasdirective:WSGIScriptAlias "/v3/auth/OS-FEDERATION/websso/mapped" "/var/www/cgi-bin/keystone/test"
WSGIScriptAlias "/v3/auth/OS-FEDERATION/websso/mapped" "/var/www/cgi-bin/keystone/test"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the container:
podman restart keystone
podman restart keystoneCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Attempt to login, and review the information that the script dumps out. When finished, remember to restore the
WSGIScriptAliasdirective, and restart the HTTPD service again.
5.3. Review the SAML messages exchanged between the SP and IdP Copy linkLink copied to clipboard!
The SAMLTracer Firefox add-on is a useful tool for capturing and displaying the SAML messages exchanged between the SP and the IdP.
-
Install
SAMLTracerfrom this URL: https://addons.mozilla.org/en-US/firefox/addon/saml-tracer/ -
Enable
SAMLTracerfrom the Firefox menu. ASAMLTracerpop-up window will appear in which all browser requests are displayed. If a request is detected as a SAML message a specialSAMLicon is added to the request. - Initiate a SSO login from the Firefox browser.
-
In the
SAMLTracerwindow find the firstSAMLmessage and click on it. Use theSAMLtab in the window to see the decoded SAML message (note, the tool is not capable of decrypting encrypted content in the body of the message, if you need to see encrypted content you must disable encryption in the metadata). The first SAML message should be anAuthnRequestsent by the SP to the IdP. The second SAML message should be the assertion response sent by the IdP. Since the SAML HTTP-Redirect profile is being used the Assertion response will be wrapped in a POST. Click on theSAMLtab to see the contents of the assertion.