8000 Support kerberos realm filter on LDAP provider · Issue #9422 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Support kerberos realm filter on LDAP provider #9422

Closed

Description

@bonky42

TL;DR: Support a configuration on LDAP provider which would specify which Kerberos realm(s) are handled by given LDAP provider.

Original description follows

Describe the bug

KEYCLOAK-7009

Keycloak supported multiple kerberos realms with [KEYCLOAK-3842](https://issues.redhat.com/browse/KEYCLOAK-3842), but it does not work with the following situations.

Closing reason

Closing as duplicate of [KEYCLOAK-6225](https://issues.redhat.com/browse/KEYCLOAK-6225) . Although the "Steps to reproduce" are really nice and will help when we start work on [KEYCLOAK-6225](https://issues.redhat.com/browse/KEYCLOAK-6225) (which is not clear when it will be).

KEYCLOAK-6225

In a scenario where multiple User Storage providers are configured, and you have 2 LDAP providers configured against Kerberos realm (assuming both use same keytab file). Keycloak ideally should look up after the user being authenticated in each one (following priority order) until find it.

For example, in a scenario where we have two providers: LDAP A and LDAP B, if the user couldn't be found in the first one, Keycloak would look up in LDAP B.

Today, if the user couldn't be found in the first one, the authentication flow stops and return an authentication error to the client.

Closing reason

Issue is being closed as out of date due to lack of work on this issue.

I made a PR a while ago after asking on the mailing list, I can update it if you want.

Version

15.1.1

Expected behavior

User should be logged in on the correct ldap

Improvement plan:

I think Keycloak should search the ldap which is extracted from the user principal.
(I think active directory has a lot of configuration such as global catalog, so the inprovement plan should be discussed much here.)

Actual behavior

(1)
I found user002 and user003 can not do the desktop single sign on.
Keycloak judges error when "Kerberos authenticatin is succeded" and "Keycloak cannot find the user information from the ldap provider".

server.log

2018-03-16 17:39:47,233 WARN [org.keycloak.storage.ldap.LDAPStorageProvider] (default task-13) Kerberos/SPNEGO authentication succeeded with username [user002], but couldn't find or create user with federation provider [aaa.com]

(2)
When the ccc.com\user001 logged in to the windows domain, desktop sso succeed but the Keycloak get the wrong user information ( aaa.com\user001 ).
Keycloak got the user principal ( user001@ccc.com ) but Keycloak extract just "user001" and search the user information without using "ccc.com".

How to Reproduce?

Situation:

  • I have the multiple kerberos realms active directory environment attached.
  • I want to implemet a desktop single sign on using "ldap provider".

Active Directory setting:

  • Domain Controller : AAA.COM

    ktpass -out keycloak.HTTP.keytab.aaa -princ HTTP/keycloak.example.com@AAA.COM -ptype KRB5_NT_PRINCIPAL -mapuser keycloak -pass P@ssw0rd

  • Domain Controller : CCC.COM

    ktpass -out keycloak.HTTP.keytab.ccc -princ HTTP/keycloak.example.com@CCC.COM -ptype KRB5_NT_PRINCIPAL -mapuser keycloak -pass P@ssw0rd

Keycloak setting:

Keycloak User Federation:

1. aaa.com (priority:0)

key value
Username LDAP attribute sAMAccountName
Connection URL ldap://aaa.com
Allow Kerberos authentication ON
Kerberos Realm AAA.COM
Server Principal HTTP/keycloak.example.com@AAA.COM
KeyTab /opt/keytab/keycloak.HTTP.keytab.aaa

2. bbb.com (priority:10)

key value
Username LDAP attribute sAMAccountName
Connection URL ldap://bbb.com
Allow Kerberos authentication ON
Kerberos Realm BBB.COM
Server Principal HTTP/keycloak.example.com@AAA.COM
KeyTab /opt/keytab/keycloak.HTTP.keytab.aaa

3. ccc.com (priority:20)

key value
Username LDAP attribute sAMAccountName
Connection URL ldap://ccc.com
Allow Kerberos authentication ON
Kerberos Realm CCC.COM
Server Principal HTTP/keycloak.example.com@CCC.COM
KeyTab /opt/keytab/keycloak.HTTP.keytab.ccc

_thumb_12433272

Anything else?

No response

Activity

  1. changed the title [-]KEYCLOAK-7009 LDAP provider does not work with the multiple kerberos realms environment[/-] [+]LDAP provider does not work with the multiple kerberos realms environment[/+] on Jan 27, 2022
  2. added
    area/ldapLDAP/Active Directory federation — user sync, group/attribute mapping
    on Jan 27, 2022
  3. wkruse commented on Oct 14, 2022

    @wkruse

    Related #9290.

  4. self-assigned this
    on Nov 7, 2022
  5. changed the title [-]LDAP provider does not work with the multiple kerberos realms environment[/-] [+]Support kerberos realm filter on LDAP provider[/+] on Feb 17, 2023
  6. added
    kind/enhancementCategorizes a PR related to an enhancement
    and removed
    kind/bugCategorizes a PR related to a bug
    on Feb 17, 2023
  7. hmlnarik commented on Feb 17, 2023

    @hmlnarik
    Contributor

    Changing to enhancement since this is an ask to implement a non-existent functionality

  8. removed their assignment
    on Feb 17, 2023
  9. mposolda commented on Apr 3, 2023

    @mposolda
    Contributor

    Related issue #14665 .

    @hmlnarik Can we close that other issue as duplicate or does it worth to keep both issues opened?

  10. ahus1 commented on Aug 17, 2023

    @ahus1
    Member

    I'd suggest to keep both issues around - filtering by realm might be simpler to support.

    #22352 might be related, has a good reproducer, still the PR attached to it might need some rework.

  11. self-assigned this
    on Aug 17, 2023
  12. 1 remaining item

  13. linked a pull request that will close this issue22352 kerberos fallback #22531on Aug 18, 2023
  14. modified the milestones: 23.0.0, 22.0.2 on Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/ldapLDAP/Active Directory federation — user sync, group/attribute mappingkind/enhancementCategorizes a PR related to an enhancement

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0