How Keycloak federates FreeIPA users through SSSD
For an organization that already runs FreeIPA or Red Hat Identity Management and wants Keycloak to authenticate against it, the supported path is Keycloak's LDAP user federation pointed at the directory, with SSSD on the Keycloak host handling the lookup and Kerberos providing sign-in. Keycloak reads users and groups over LDAP as it would from any directory, while the Kerberos ticket path lets domain-joined users sign in without retyping a password. The Keycloak host itself must be enrolled as an IdM client, because SSSD and the Kerberos keytab depend on that enrollment.
The integration does not turn FreeIPA into the place where Keycloak's own roles, client scopes or sessions live. FreeIPA supplies the identity record, the password verification through its Kerberos KDC and, if you use it, host and group membership. SSSD on the Keycloak host caches lookups and mediates the connection to the directory, so a failure in name resolution or a stale cache can look like a Keycloak fault. The FreeIPA About page describes the 389 Directory Server, MIT Kerberos KDC and SSSD components this design relies on, and each one needs its own check during planning.
Decide early which system owns each attribute and group. Confirm with your FreeIPA administrators which bind account Keycloak will use, whether LDAPS or StartTLS is enforced, and how DNS resolves the IdM servers from the Keycloak host, since the FreeIPA deployment guidance expects clients to reach at least two DNS servers. Treat the Keycloak host as part of the directory trust boundary: its keytab and bind credentials are as sensitive as the directory secrets they unlock.
What the FreeIPA and SSSD integration needs before work starts
Keycloak reads FreeIPA users through the directory and SSSD on the hosts that need them, so the directory topology, the Keycloak build and the network trust have to be settled before any federation settings are written. The cards below cover the items to confirm with your identity and platform teams before a build starts.
FreeIPA server topology
Plan for at least two to three replicas in each datacenter, following the FreeIPA deployment recommendations. Keep no more than four replication agreements per replica, run dedicated servers without other applications, and place at least one replica per datacenter with PKI or DNS if you use those services. Confirm the current topology with ipa-replica-manage list before Keycloak is pointed at it, since a Keycloak bind to a single unstable server will fail when that server is down.
Keycloak version and database
Choose the Keycloak release and the method you will use for LDAP-based user federation, then confirm that method against your version in the server administration guide, since the supplied facts do not name a release for this integration. Pick a supported production database such as PostgreSQL 14 to 18, not the development file database, and confirm that your database meets the high availability requirement for your chosen architecture.
Keycloak admin guideDNS resolvers on client hosts
Make sure each client host that runs SSSD has at least two DNS servers in its resolv.conf, as the FreeIPA recommendations advise. Keycloak and SSSD both depend on forward and reverse lookups for the FreeIPA hostnames, so test name resolution from the Keycloak host itself and not only from your workstation. A single resolver that fails will stall logins and directory lookups.
TLS and certificate trust
Keycloak's production guide calls for TLS on all communication, so plan LDAPS or StartTLS to the directory and install the FreeIPA certificate authority chain in the Keycloak truststore. Confirm which CA signs your IdM server certificates, since FreeIPA's integrated Dogtag authority issues them by default. Record the certificate expiry date and the renewal owner, because an expired directory certificate will silently stop user lookups.
Keycloak production guideRead-only service account
Create a dedicated bind account in FreeIPA with read access to the user and group entries that Keycloak will import, and no rights to change them. Keep its password in your secrets store and document who rotates it. Test the bind and a sample user search from the Keycloak host before you save the provider, so failures are not mistaken for mapping problems later.
Keycloak host enrolled as an IdM client
Join the Keycloak host to the FreeIPA domain as an IdM client so that SSSD can provide its identity data and Kerberos keytab. Confirm which host principal and keytab you will use for Kerberos sign-in alongside federation, and that the host clock is synchronized with the domain, since Kerberos rejects tickets when clocks drift. Plan the host as dedicated to Keycloak so that its keytab and sign-in path are reviewed on their own.
Configuring the FreeIPA federation in Keycloak step by step
This sequence takes a Keycloak host from no directory access to a working LDAP federation for FreeIPA users, with Kerberos sign-in and group membership managed inside Keycloak after a one-time import.
Prepare the FreeIPA bind account and TLS
The IdM administrator creates a dedicated, read-only service account in FreeIPA for Keycloak to bind with, and confirms the IdM CA certificate and the server hostname that Keycloak will use for LDAPS. Keycloak should connect over TLS, so the Keycloak host must trust the IdM CA. Check: from the Keycloak host, a test bind with the service account over LDAPS (for example, an ldapsearch against the account's own entry) succeeds and returns the entry, and the certificate chain validates without skipping verification.
Enroll the Keycloak host as an IdM client
On the Keycloak host, the platform team installs the FreeIPA client packages and enrolls the host into the IdM domain, which configures SSSD, Kerberos and the host keytab. Confirm that the host's resolv.conf points at IdM DNS servers and that the host can reach the IdM replicas. Check: getent passwd and getent group return known FreeIPA users and groups, and id for a test user lists the expected group memberships. If lookups fail, fix SSSD or DNS before going further, because Keycloak depends on the same name resolution.
Configure the LDAP user federation provider
In the Keycloak admin console, the realm administrator adds an LDAP user federation provider pointing at the IdM LDAPS endpoint, with the service account credentials, the users base DN and the FreeIPA object classes. Map the username, email, first name and last name attributes to the FreeIPA attributes, and check the mapper settings for user and group objects before saving. Check: the provider's connection and authentication tests pass, and a synchronization of users returns the expected count for a test user. Confirm the attribute names with your IdM schema, since they vary with deployment.
Enable Kerberos for negotiated sign-in
The realm administrator enables Kerberos on the same LDAP provider, sets the Kerberos realm, the service principal and the keytab that Keycloak uses to accept negotiated authentication, and configures the browser on client machines to send Kerberos credentials to the Keycloak host. The IdM administrator provisions the HTTP service principal for the Keycloak hostname. Check: obtain a Kerberos ticket for a test user with kinit, then sign in through a browser configured for SPNEGO and confirm the login completes without a password prompt.
Import groups once from FreeIPA
The realm administrator configures the group mapper on the LDAP provider so that FreeIPA groups are imported into Keycloak, and runs the group synchronization a single time for the initial import. Review the imported group names and the membership mapping for a sample of users, and decide which groups should be used for application roles. Check: the Keycloak group tree shows the expected FreeIPA groups, and a test user's Keycloak group membership matches the membership shown by id in the IdM host.
Manage group membership in Keycloak
After the one-time import, the realm administrator switches the group mapper to the mode that keeps imported groups under Keycloak control, so that membership changes for application purposes are made in Keycloak and not in FreeIPA. Document which team owns each group and which changes must still be made in IdM, since mixing ownership creates drift. Check: add a test user to an imported group in Keycloak, sign in to a test client, and confirm the group appears in the token claims as configured. Repeat the sign-in after a removal to confirm the change is applied.
When to run SSSD on the Keycloak host versus a direct LDAP bind
With this option, the Keycloak host runs SSSD, which connects to FreeIPA and presents users and groups to the operating system through NSS and PAM. Keycloak then reads identities through the local system rather than opening its own directory connection. SSSD keeps a local cache of identity data and handles the Kerberos side of sign-in, so the same host can accept a Kerberos ticket for a user. The trade-off is that the Keycloak host becomes part of your identity plumbing, and its configuration, keytabs and cache become things your team must maintain.
- What it reads: SSSD reads from the FreeIPA directory and serves results through the local system, so Keycloak sees what the host sees.
- Failure mode: When SSSD cannot reach FreeIPA, cached entries may still resolve while new users or changed group memberships lag. Check SSSD logs on the host first.
- Kerberos integration: Keytabs and principals live on the host, so their rotation and permissions are operational tasks.
- Operations: Your team owns the SSSD version, cache settings, time synchronization and host enrollment in FreeIPA.
- Scaling: Each Keycloak node that relies on SSSD needs the same enrollment and configuration.
Before you commit, confirm with your platform team which FreeIPA and SSSD versions your distribution supports and where your Keycloak nodes will run.
With a direct LDAP federation provider, Keycloak opens its own connection to the directory, authenticates with a bind account, and imports or queries users itself. Nothing about the operating system changes on the Keycloak host. Keycloak's administration console exposes the provider settings, mappers and sync behavior, so the configuration lives inside the realm. The trade-off is that Keycloak must reach the directory over the network with a service account, and Kerberos sign-in is a separate configuration you must set up deliberately.
- What it reads: Keycloak queries the LDAP tree with the bind account and maps attributes through its user federation mappers.
- Failure mode: When the directory is unreachable, Keycloak reports federation errors in the admin console and server logs, and sign-in for federated users fails.
- Service account: The bind account needs read access to the attributes you map, and its password becomes a secret to rotate.
- Operations: Your team owns LDAP TLS certificates, connection pooling, sync schedules and mapper changes.
- Kerberos: Kerberos sign-in through Keycloak still needs its own keytab and realm settings, so plan it as a separate task.
Confirm in your environment whether your security team accepts a bind account from Keycloak under its policy, and whether LDAP over TLS is enforced on the path between them.
The choice usually depends on where your organization wants identity logic to live and who will troubleshoot it. Running SSSD on the host suits teams that already manage Linux identity through FreeIPA and want the same host behavior for logins, sudo and services. A direct bind suits teams that want Keycloak to be the single place where federation is configured and observed. Neither option is faster by default, and the supplied facts do not establish a performance difference, so measure in your own environment before deciding on that basis.
- Existing Linux estate: If hosts already use SSSD against FreeIPA, the host option fits the current operating model.
- Single point of configuration: If the security team wants all federation settings visible in one admin console, the direct bind is easier to review.
- Kerberos requirements: If Kerberos sign-in is central to the design, weigh the extra host-level setup against the provider's settings.
- Change control: Host changes and realm changes often pass through different approval paths, so count both when you plan.
- Mixed approach: Some teams use SSSD for host logins and a direct bind for Keycloak, which doubles what must be operated.
Ask your FreeIPA administrators and Keycloak operators to write down who owns each failure path before the build starts.
How FreeIPA attributes and groups map into Keycloak
This table compares each FreeIPA identity element with where it lands in Keycloak after federation and how it is maintained afterward. Read it as a checklist for your schema review: rows marked as regenerated by FreeIPA should not be remapped by hand, while rows that depend on your own schema need confirmation before the first sync.
| FreeIPA element | Keycloak target | Maintained by | What to confirm |
|---|---|---|---|
| uid (login name) | Keycloak username, matched to the LDAP provider's username attribute | FreeIPA, read on each import | Confirm the username attribute setting matches the uid values in your directory and that no two accounts share a name |
| Keycloak email field, used for account linking and password reset | FreeIPA, read on sync | Confirm every account has a unique, verified mail value; missing or duplicate values affect login and recovery | |
| givenName and sn | Keycloak first name and last name fields | FreeIPA, read on sync | Confirm these are populated for your user population, since profile screens and audit records depend on them |
| memberOf or group membership | Keycloak groups, imported once and then managed in Keycloak | Keycloak after the initial import, unless you choose a sync mode that overwrites local changes | Confirm which group objects you import and which sync direction your team wants for membership changes |
| Kerberos principal | Used for Kerberos sign-in alongside the LDAP provider, not stored as a standard profile field | FreeIPA regenerates principals and keys | Confirm the realm name, service principal and keytab handling with your FreeIPA administrators before enabling Kerberos |
| Custom schema attributes | Keycloak user attributes, mapped per attribute | Your own schema and mappers | Confirm each custom attribute exists in your FreeIPA schema before creating a mapper for it |
| Attributes FreeIPA regenerates (such as Kerberos keys and certificate serials) | Not mapped as editable Keycloak fields | FreeIPA | Do not write these back from Keycloak; confirm which values your IdM team treats as read-only |
Securing the directory bind, Kerberos and certificate trust
Keycloak reaches FreeIPA through a bind account, a Kerberos keytab and a certificate chain, and each one is a credential or trust decision that can widen access if left loose. The cards below cover the controls to set and the checks to run before the federation goes live and after every FreeIPA update.
Scope the read-only bind account
Keycloak needs a bind identity only to read users and groups it will import or search. Create a dedicated account with read access to the user and group subtrees it needs, and no membership in administrative groups or host and sudo management roles. Test the account by attempting a write with it, which should fail. Record which subtrees the account can see so later changes to directory permissions are reviewed.
Keycloak docsValidate the LDAPS or StartTLS certificate
Every bind and every lookup carries the bind password, so the connection must be encrypted and the server certificate must be checked against a trust store Keycloak controls. Use LDAPS or StartTLS, import the FreeIPA CA chain into the Keycloak truststore, and confirm that hostname validation is on. Do not disable certificate checks to get a connection working, because that accepts any server presenting a certificate.
Manage the Kerberos keytab
Kerberos sign-in in Keycloak depends on a service keytab for the HTTP principal, and that file is a long-lived secret that grants the ability to act as the service. Restrict its file permissions to the Keycloak service account, keep it off shared volumes and out of container images, and record who can read it. Plan rotation as a scheduled change: issue a new key, deploy the keytab, confirm sign-in, then retire the old key. Confirm the rotation steps with your FreeIPA administrators.
Restrict which FreeIPA groups sign in
Federation imports whatever the provider returns unless a filter narrows it, so a broad user filter can make every FreeIPA account able to reach every Keycloak client. Limit the user filter or the imported group set to the populations that should sign in, and decide how disabled or expired FreeIPA accounts are handled. Test with one account from an excluded group to confirm it cannot authenticate, and recheck the filter after group changes in FreeIPA.
Back up the first FreeIPA server
The FreeIPA backup documentation notes that the first server handles certificate renewal and CRL publication by default. If that server is lost or its certificate state is damaged, Keycloak sign-in can fail for reasons that look unrelated, and the certificate trust chain you validated earlier may change. Confirm which server holds these roles, schedule backups, and know that restoring an outdated backup into an active replica topology can break replication, so restores need a planned procedure.
FreeIPA backup guideConfirm the FreeIPA 4.13.4 security fixes
FreeIPA 4.13.4, a stabilization release dated July 9, 2026, fixed two CVEs, including LDAP access control flaws that could let unauthenticated clients obtain credentials, and hardened authentication checks across the API. Confirm that every IdM server and replica your Keycloak bind can reach runs 4.13.4 or later, or a later release your distribution supports, and record the check. Treat the bind account and keytab as exposed until the patch is confirmed, and rotate them if the version was older.
4.13.4 release notesWhy FreeIPA federation fails and how to fix it
This table lists the failures teams most often hit when Keycloak federates users from FreeIPA through SSSD, with the likely cause and the fix for each. Read each row as a checklist to run before you go live and again after any change to DNS, certificates, time sync or the directory.
| Failure | Likely cause | Fix |
|---|---|---|
| SSSD cannot resolve users | Host resolv.conf lists only one DNS server, so lookups fail when that resolver is down | Configure at least two DNS servers in each client's resolv.conf, matching the FreeIPA deployment recommendations, and test lookups with the id command on each host |
| Kerberos sign-in fails with clock skew | Client, KDC and Keycloak hosts drift apart in time, so Kerberos tickets are rejected | Run chrony or another NTP client on every host, confirm all hosts sync to the same time sources, and check the skew before debugging tickets |
| Kerberos sign-in fails with a wrong service principal | The HTTP service principal in the keytab is missing, misnamed or built from a hostname that does not match the browser URL | Create the HTTP principal for the exact Keycloak hostname, regenerate the keytab, and confirm the keytab is readable by the Keycloak service account |
| Keycloak rejects the LDAP or TLS connection | The certificate chain from the FreeIPA CA is not in the truststore Keycloak uses | Import the IdM CA certificate into the Keycloak truststore and test the LDAPS connection from the Keycloak host before saving the provider |
| Groups import twice after a rename | A group was renamed in FreeIPA, and Keycloak imported the new name as a second group while the old one remains | Decide the group source of truth before import, remove or rename the duplicate in Keycloak, and check the mapper and import settings before the next sync |
| Disabled account still signs in | SSSD serves a cached entry after the account was disabled in FreeIPA | Clear or shorten the SSSD cache for the affected user, confirm the account status in FreeIPA, and test a disabled login after each change |
| Keycloak sync errors when the directory is unreachable | Network, DNS or replica outage stops the connection, and sync jobs or logins fail without a fallback | Point the provider at more than one FreeIPA replica where supported, set clear sync and failure behavior, and monitor provider errors in the Keycloak logs |
Questions teams ask before federating FreeIPA into Keycloak
What drives the cost of federating FreeIPA into Keycloak?
The cost depends mostly on how many directories, realms and applications are involved, how clean the FreeIPA data is, and how much of the Kerberos and group design must be settled before build starts. Two parts are paid for: the design and build of the SSSD host prerequisites, the Keycloak user federation provider and the group import, and the testing that proves sign-in works for real users. Most of that is one-time work, while the ongoing cost is operating the Keycloak and FreeIPA servers, patching them and reviewing the mappings when group rules change. Ask any partner for a fixed-scope quote that lists the hosts, realms, applications and test cases it covers, because those items are what move the number up or down. No public figure for this work is supplied here, so treat any number without a written scope with caution.
How long does a FreeIPA to Keycloak federation project take?
Duration depends on the number of Keycloak realms, the state of FreeIPA groups and host access rules, and how many applications need Kerberos or group-based access. A project with one realm, a small set of groups and a single test application is simpler than one that must align several realms or clean up years of duplicate groups. Build time is usually shorter than the time spent agreeing on which FreeIPA groups become Keycloak roles and who owns each mapping. No duration figure is supplied for this topic, so ask a partner for a timeline tied to a written scope and confirm the dependencies, including access to a test FreeIPA replica and DNS changes, before you commit to dates.
What does the work need from our team?
Your team needs to provide access to the FreeIPA deployment, a test environment that mirrors it, the DNS and Kerberos details the hosts depend on, and a named owner who can approve group and role mappings. Identity and directory administrators must confirm which FreeIPA groups are authoritative, and application owners must state which claims and roles each application expects. Security or compliance staff should review how Kerberos sign-in, password federation and MFA interact before cutover. Plan time from the infrastructure team for changes to host resolver settings and for keytab handling, since those steps touch production hosts you control. Ask the partner to list these inputs in the written scope so gaps show up before the build starts.
Can our internal team federate FreeIPA into Keycloak without a partner?
Yes, an internal team with strong Linux, Kerberos and Keycloak skills can do this work, provided it has time to test and the people to own the result afterward. The areas that most often need outside review are the SSSD configuration on each client host, the Kerberos realm and service principal setup, and the rule that imports groups once and then manages them in Keycloak. If your team has not run Keycloak in production or has not operated FreeIPA replicas, a partner can shorten the learning curve and provide a second review. Decide early who will maintain the configuration after go-live, because changes to FreeIPA, SSSD or Keycloak later can break sign-in in ways that are hard to diagnose without that context.
How does Kerberos sign-in differ from password federation?
Password federation sends the username and password the user types to the directory, which checks them against FreeIPA and returns a result to Keycloak. Kerberos sign-in lets a user who already holds a valid ticket from the domain log in without typing a password, through the SPNEGO negotiation that browsers support when they are joined to the domain and configured for the Keycloak host. Kerberos depends on accurate time synchronization, correct DNS names and a properly configured service principal, so failures often look like password problems but come from clock skew or a missing keytab. The two methods can run side by side, but you should test fallback behavior, since a user off the domain network will still need the password path. Confirm the exact browser and Keycloak settings with the Keycloak server administration guide before rollout.
Does Red Hat Identity Management change the work?
Red Hat Identity Management is built on the same upstream FreeIPA project, so the core work of SSSD prerequisites, the directory provider and group import is largely the same. What changes is the support relationship, the packaging, the release schedule and the subscription terms that come with Red Hat products. Keycloak also has a Red Hat build that replaces Red Hat Single Sign-On, so the Keycloak side may differ if you use that distribution. Before you plan, confirm with Red Hat which versions and configurations your subscription covers and which upstream FreeIPA release notes apply to your installed version, because security fixes such as those in the FreeIPA 4.13.4 release may be delivered on a different cadence. Verify the exact package versions in your own environment.
What should we check after go-live to keep federation healthy?
After go-live, you should check that SSSD on each client resolves users and groups, that the Keycloak provider is syncing the expected groups, and that Kerberos tickets are valid for the test accounts. Watch for disabled or expired accounts, changes to FreeIPA group membership that do not reach Keycloak as planned, and clock drift on any host. Backups matter too: FreeIPA's backup guidance warns that restoring an outdated backup into an active replica topology can break replication, so your restore procedure must be tested before you need it. Ask any partner to include a runbook, alerting for the federation provider and a review schedule, because these controls keep the setup stable after the project team leaves.
How a Keycloak login reaches FreeIPA through SSSD and Kerberos
The walk-through starts in the browser, which sends the user to Keycloak's login page. Keycloak checks the user through its LDAP user federation provider, which points at FreeIPA's directory on the IdM server. The SSSD-enabled Keycloak host sits between them and resolves identities for the local system, while the one-time group import runs from the directory into Keycloak's own database. Kerberos sign-in is a separate path to the KDC, so check that both paths agree on the same realm, DNS names and service principals before go-live.
Login and group import paths between Keycloak, SSSD and FreeIPA services.
How DeployOpen scopes, delivers and supports FreeIPA federation
DeployOpen plans, builds, tests, documents and supports Keycloak user federation with FreeIPA and SSSD inside your own infrastructure. Each engagement starts from a written scope that names the FreeIPA topology, the SSSD clients, the Keycloak realm and the sign-in paths that must work, so your team knows what is delivered before work begins.
How we scope
- We confirm the FreeIPA version, replica topology and the DNS domain that Keycloak and the clients will use.
- We list which user attributes, groups and sign-in methods Keycloak must read, import or enforce from the directory.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before any configuration starts.
How we build
- We prepare the host prerequisites, including DNS resolution, time sync and the SSSD configuration on each Keycloak host.
- We configure the LDAP user federation provider, the group import and the Kerberos sign-in path in a test realm first.
- We test failover to a second FreeIPA replica and confirm login still works when the first replica is unreachable.
How we hand over
- We document the provider mappers, the one-time group import steps and the rules your team follows for groups managed in Keycloak.
- We deliver runbooks for password policy changes, account disablement, Kerberos keytab rotation and backup coordination with FreeIPA.
- We walk your identity and platform teams through the configuration and the test evidence they need for their own reviews.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, covering Keycloak and SSSD changes after go-live.
- We retest the federation path after Keycloak upgrades, FreeIPA updates and changes to the client host image.
- Operational questions are handled against the documented runbooks, with your team keeping ownership of the FreeIPA server itself.

