Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldap: make sure realm is set #7690

Closed
wants to merge 2 commits into from
Closed

Conversation

sumit-bose
Copy link
Contributor

No description provided.

@alexey-tikhonov
Copy link
Member

@alexey-tikhonov
Copy link
Member

@sumit-bose, I think this can be moved out of draft?

@alexey-tikhonov alexey-tikhonov self-assigned this Nov 12, 2024
@madhuriupadhye madhuriupadhye force-pushed the ldap_realm_fix branch 2 times, most recently from ec5f63f to 444db02 Compare November 15, 2024 15:20
In general the canonical principal will be only set in the cache after a
successful authentication because in general it is not know what the
canonical principal might be.

For Active Directory it is known that the canonical principal is build
with the sAMAccountName attribute and the Kerberos realm which is used
in the patch "AD: Construct UPN from the sAMAccountName" (7a27e53). If
'id_provider = ldap' is used to access Active Directory the realm might
not be set in the internal domain data and as a result a wrong principal
might be created. This patch makes sure the realm is set before creating
the canonical principal.
Copy link

@danlavu danlavu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test looks good, thank you Sumit.

@sumit-bose
Copy link
Contributor Author

Test looks good, thank you Sumit.

Hi,

please note, tests were written by Madhuri.

bye,
Sumit

assert client.auth.parametrize(method).password("user1", "Secret123"), "User user1 failed login!"

log_str = client.fs.read("/var/log/sssd/krb5_child.log")
assert hasattr(provider.host, "domain"), "Host does not have 'domain' attribute!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this? This is not a step/result.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for the following error,

tests/test_ad.py:70: error: "BaseHost" has no attribute "domain"  [attr-defined]
Found 1 error in 1 file (checked 1 source file)

But added a comment at end of line,

assert f"UPN [user1@{provider.host.domain}]" in log_str, f"'UPN [user1@{provider.host.domain}]' not in logs!" # type: ignore

Copy link
Contributor

@jakub-vavra-cz jakub-vavra-cz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments for the test

client.sssd.nss["override_homedir"] = "/home/%u"

if isinstance(provider, AD):
dns_parameter = "ad.test"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem handle dynamic domain/AD in idmci it can be ad-tb2f.test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

With AD/Samba check the authentication of user
by replacing id_provider = ldap

Signed-off-by: Madhuri Upadhye <[email protected]>
Copy link
Contributor

@jakub-vavra-cz jakub-vavra-cz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@alexey-tikhonov
Copy link
Member

Pushed PR: #7690

  • master
    • ef53531 - Test: Add the test when we replace id_provider
    • 8c86abd - ldap: make sure realm is set
  • sssd-2-10
    • 46ec31c - Test: Add the test when we replace id_provider
    • 9c87e6e - ldap: make sure realm is set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants