It is possible to configure keystone to use one or more LDAP backends for the identity resources as described in the OpenStack Identity documentation. This will result in an LDAP backend per keystone domain.
To configure LDAP backends, set the KeystoneLDAPDomainEnable
flag to
true
. Enabling this will set the domain_specific_drivers_enabled
option
in keystone in the identity
configuration group. By default the domain
configurations are stored in the /etc/keystone/domains directory on the
controller nodes. You can override this directory by setting the
keystone::domain_config_directory
hiera key, and setting that via the
ExtraConfig
parameter in an environment file. For instance, to set this in
the controller nodes, one would do the following:
parameter_defaults:
ControllerExtraConfig:
keystone::domain_config_directory: /etc/another/directory
The LDAP backend configuration should be provided via the
KeystoneLDAPBackendConfigs
parameter in tripleo-heat-templates. It’s a
dictionary mapping the LDAP domain names to options that take the following
keys:
An example of an environment file with LDAP configuration for the keystone
domain called tripleodomain
would look as follows:
parameter_defaults:
KeystoneLDAPDomainEnable: true
KeystoneLDAPBackendConfigs:
tripleodomain:
url: ldap://192.0.2.250
user: cn=openstack,ou=Users,dc=tripleo,dc=example,dc=com
password: Secrete
suffix: dc=tripleo,dc=example,dc=com
user_tree_dn: ou=Users,dc=tripleo,dc=example,dc=com
user_filter: "(memberOf=cn=OSuser,ou=Groups,dc=tripleo,dc=example,dc=com)"
user_objectclass: person
user_id_attribute: cn
user_allow_create: false
user_allow_update: false
user_allow_delete: false
This will create a file in the default domain directory /etc/keystone/domains with the name keystone.tripleodomain.conf. And will use the attributes to create such a configuration.
Please note that both the KeystoneLDAPDomainEnable
flag and the
configuration KeystoneLDAPBackendConfigs
must be set.
One can also specify several domains. For instance:
KeystoneLDAPBackendConfigs:
tripleodomain1:
url: ldap://tripleodomain1.example.com
user: cn=openstack,ou=Users,dc=tripleo,dc=example,dc=com
password: Secrete1
...
tripleodomain2:
url: ldaps://tripleodomain2.example.com
user: cn=openstack,ou=Users,dc=tripleo,dc=example,dc=com
password: Secrete2
...
This will add two domains, called tripleodomain1
and tripleodomain2
,
with their own configurations.
After the overcloud deployment is done, you’ll need to give the admin user a role in the newly created domain.
Source the overcloudrc.v3 file:
source overcloudrc.v3
Grant admin user on your domain:
openstack role add --domain $(openstack domain show tripleodomain -f value -c id)\
--user $(openstack user show admin --domain default -f value -c id) \
$(openstack role show admin -c id -f value)
Test LDAP domain in listing users:
openstack user list --domain tripleodomain
Before configuring the domain, there needs to be a user that will query
FreeIPA. In this case, we’ll create an account called keystone
in FreeIPA,
and we’ll use it’s credentials on our configuration. On the FreeIPA side and
with proper credentials loaded, we’ll do the following:
ipa user-add keystone --cn="keystone user" --first="keystone" \
--last="user" --password
This will create the user and we’ll be prompted to write the password for it.
Configuring FreeIPA as an LDAP backend for a domain can be done by using the following template as a configuration:
parameter_defaults:
KeystoneLDAPDomainEnable: true
KeystoneLDAPBackendConfigs:
freeipadomain:
url: ldaps://$FREEIPA_SERVER
user: uid=keystone,cn=users,cn=accounts,$SUFFIX
password: $SOME_PASSWORD
suffix: $SUFFIX
user_tree_dn: cn=users,cn=accounts,$SUFFIX
user_objectclass: inetOrgPerson
user_id_attribute: uid
user_name_attribute: uid
user_mail_attribute: mail
user_allow_create: false
user_allow_update: false
user_allow_delete: false
group_tree_dn: cn=groups,cn=accounts,$SUFFIX
group_objectclass: groupOfNames
group_id_attribute: cn
group_name_attribute: cn
group_member_attribute: member
group_desc_attribute: description
group_allow_create: false
group_allow_update: false
group_allow_delete: false
user_enabled_attribute: nsAccountLock
user_enabled_default: False
user_enabled_invert: true
$FREEIPA_SERVER will contain the FQDN that points to your FreeIPA server. Remember that it needs to be available from some network (most likely the ctlplane network) in TripleO
You should also make sure that the ldap ports need to be accessible. In this
case, we need port 636 available since we’re using the ldaps
scheme.
However, if you would be using the use_tls
configuration option or if you
are not using TLS at all (not recommended), you might also need port 389.
To use TLS, the FreeIPA server’s certificate must also be trusted by the openldap client libraries. If you’re using novajoin (and TLS everywhere for the overcloud) this is easily achieved since all the nodes in your overcloud are enrolled in FreeIPA. If you’re not using this setup, you should then follow the ‘Getting the overcloud to trust CAs’ section in the Deploying with SSL document.
$SUFFIX will be the domain for your users. Given a domain, the suffix DN can be created withwith the following snippet:
suffix=`echo $DOMAIN | sed -e 's/^/dc=/' -e 's/\./,dc=/g'`
Given the domain example.com
the suffix will be dc=example,dc=com
.
In this configuration, we configure this backend as read-only. So you’ll need to create your OpenStack users on the FreeIPA side.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.