MOC Alliance

Integrating Red Hat Directory Server with Keycloak

adrs/2026-10-16-ldap-and-keycloak

Context

Our user community authenticates exclusively via OIDC and is served well by our Keycloak IdP. On the other hand, as operators we often need to authenticate to devices or services without OIDC support, including:

All of this is currently accomplished using shared accounts, which means there is no record of who logged into a device. If someone leaves or a password is compromised, it means we have to roll out new shared passwords across the entire environment. In order to provide better access control and better audit logs, we would like to be able to use individual accounts for these sorts of activities.

Furthermore, as we start architecting a NIST compliant environment, there are specific requirements around identity and auditing that we need to meet:

Most of the devices and servers that we use have support for authenticating against an LDAP directory. By setting up an LDAP directory and federating the LDAP accounts with Keycloak, we are able to:

Decision

We will use Red Hat Directory Server (which is Red Hat’s commercially supported version of 389 Directory Server) to provide LDAP service. If the MOC does not have a license for RHDS we can fall back to 389ds without any change in functionality.

RHDS will run in EKS alongside Keycloak, but unlike Keycloak the LDAP service will not have a public endpoint. We will provide connectivity from MOC internal networks to AWS by setting up an AWS site-to-site VPN.

We will enable password authentication to Keycloak and the Keycloak self-service portal. This will allow self-management of LDAP passwords via the Keycloak UI.

LDAP will be authoritative for a subset of groups used to control operations access to services. It will be possible to add operations users to non-LDAP groups managed in Keycloak.

All connections to the LDAP service will be encrypted, either through the use of LDAPS (LDAP-over-SSL) or through the use of the StartTLS operation.

Validation

Handling MFA access

NIST SP 800-171 Requirement 3.5.3 requires the use of MFA for all local and network-access to privileged accounts, and for network access to non-privileged accounts. Many of our devices have no native support for MFA. We may be able to implement a compensating control via one of the following solutions:

In either case, operators must first authenticate to the gateway before they are able to access devices such as server BMCs. This solution will need to be validated by a NIST 800 171 subject matter expert.

Organization of the LDAP directory

Purpose DN
Base DN dc=massopen,dc=cloud
User accounts ou=people,dc=massopen,dc=cloud
Groups ou=groups,dc=massopen,dc=cloud

Users

We will represent user accounts with the following object classes:

nsAccount is native to RHDS and includes the nsSshPublicKey attribute, which we will use for storing the public keys of operators in order to configure ssh connections to platforms that support public key authentication.

dn: uid=alice,ou=people,dc=massopen,dc=cloud
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: nsAccount
objectClass: posixAccount
cn: Alice Example
givenName: Alice
sn: Example
mail: alice@example.com
userPassword: {SSHA}hashedpasswordgoeshere
uidNumber: 10000
gidNumber: 10000
homeDirectory: /home/alice
loginShell: /bin/bash

Groups

We will represent groups using the groupOfNames object class:

dn: cn=openshift-admins,ou=groups,dc=massopen,dc=cloud
objectClass: top
objectClass: groupOfNames
cn: OpenShift Administrators
description: Users with cluster-reader + impersonation access in OpenShift
member: uid=alice,ou=people,dc=massopen,dc=cloud

We will use the memberOf plugin to synthesize a memberOf attribute on user account entries for each group of which they are a member. This value is required by some systems (e.g., the Lenovo XClarity 2 BMC) to determine group membership.

Attribute mapping

LDAP attribute Keycloak attribute
uid username
mail email
givenName firstName
sn lastName
nsSshPublicKey sshPublicKey

Backups

We will periodically (e.g., via a CronJob) perform an LDIF export of the directory and save it to an object bucket hosted by Wasabi or Backblaze.

Break glass/emergency authentication

We need a way to log into to servers and devices if the directory service is down.

For every enrolled host or device, we will generate a random administrative password and store it in our secret store. We may want to investigate periodically rotating these static credentials, but the initial plan is simply to have a unique password per device, and some sort of audit event on the secret store that shows us when or if these credentials are accessed.

Consequences

Benefits

Changes

See also