Chapter 4. Configuring Red Hat OpenStack Platform for Federation
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.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Assign the IP address a fully qualified domain name (FQDN), and write it to the
/etc/hosts
file. 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 VIP
Copy 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=13000
Copy 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-federation
andfed_variables
files that you created as part of Section 1.5, “Using a conifguration script” into thestack
home 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
~/stack
home directory onundercloud-0
to the~/heat-admin
home 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
stack
user, create thefed_deployment
directory. This location is the file stash:su - stack mkdir fed_deployment
$ su - stack $ mkdir fed_deployment
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use the
configure-federation
script to perform the previous step:./configure-federation initialize
$ ./configure-federation initialize
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use SSH to connect to
controller-0
, and create the~/fed_deployment
directory as thehead-admin
user. This location is the file stash:ssh heat-admin@controller-0 mkdir fed_deployment
$ ssh heat-admin@controller-0 $ mkdir fed_deployment
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use the
configure-federation
script to perform the previous step. From thecontroller-0
node:./configure-federation initialize
$ ./configure-federation initialize
Copy 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_mellon
Copy 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/hosts
file on all controller nodes after theHeat Hosts
section: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.conf
configuration 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
MellonMergeEnvVars
parameter 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-0
node, 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.gz
Copy 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.yaml
environment file and add the following content:parameter_defaults: ControllerExtraConfig: apache::purge_configs: false
parameter_defaults: ControllerExtraConfig: apache::purge_configs: false
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add
puppet_override_apache.yaml
as 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.log
Copy 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: true
Copy 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 themapped
method. Additionally, theexternal
method 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_attribute
The 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.sh
script.... -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.log
Copy 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.gz
Copy 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.sh
Copy 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_public
block of the/var/lib/config-data/puppet-generated/haproxy/etc/haproxy/haproxy.cfg
configuration file, add the following line:cookie SERVERID insert indirect nocache
cookie SERVERID insert indirect nocache
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This setting states that
SERVERID
is the name of the persistence cookie.Edit each
server
line 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-1
Copy 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
overcloudrc
file 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
entityID
of 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.xml
file. 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.xml
file. -
Note the value of the entityID attribute, which is in the IdP metadata file within the
<EntityDescriptor>
element. Assign the$FED_IDP_ENTITY_ID
variable 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_NAME
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-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_groups
and at least one of the groups in the group list must beopenstack-users
.
If the rule matches, then:
-
The keystone
user
name will be assigned the value fromMELLON_NAME_ID
. -
The user will be assigned to the keystone group
federated_users
in thefederated_domain
domain.
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_deployment
directory (for example, infed_deployment/mapping_${FED_OPENSTACK_IDP_NAME}_saml2.json
), and assign the name$FED_OPENSTACK_MAPPING_NAME
to 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_NAME
Copy 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
Mapped
protocol 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.conf
to confirm that theServerName
directive inside theVirtualHost
block includes the HTTPS scheme, the public hostname, and the public port. You must also enable theUseCanonicalName
directive. 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_settings
and 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_settings
and 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.