Skip to content

Test: HBAC affecting AD-users ipa-group membership#8074

Closed
shridhargadekar wants to merge 3 commits intoSSSD:masterfrom
shridhargadekar:sssd_hbac_member
Closed

Test: HBAC affecting AD-users ipa-group membership#8074
shridhargadekar wants to merge 3 commits intoSSSD:masterfrom
shridhargadekar:sssd_hbac_member

Conversation

@shridhargadekar
Copy link
Contributor

In a IPA-AD trust environment, AD-user has membership of a external-ipa group. This external-ipa-group is member of IPA-posix group. When a HBAC rule is added and is the ipa-posix member is added as member for that rule, AD-user misses that IPA-group-membership

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a new system test to reproduce a bug where an AD user's IPA group membership is lost after an HBAC rule is applied. My review identifies a critical error that would prevent the test from running, as well as opportunities to improve the test's robustness and clarity. Specifically, I've pointed out an undefined variable, suggested replacing a fixed time.sleep with a more reliable polling mechanism to avoid flaky tests, and provided a revised docstring to correct several inconsistencies and accurately describe the test's behavior.

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.

  1. Minor tweaks.
  2. Q: Is the fix needed also for 10.0 (sssd-2-10)?
  3. Shouldn't the test pass on some fedora that is not affected by the regression?

@alexey-tikhonov
Copy link
Member

  • Q: Is the fix needed also for 10.0 (sssd-2-10)?

Product patch causing a regression was backported everywhere:
#7921 (comment)

  • Shouldn't the test pass on some fedora that is not affected by the regression?

All supported Fedora version are sssd-2.11.11 based that is affected.

@shridhargadekar shridhargadekar force-pushed the sssd_hbac_member branch 4 times, most recently from c1fd489 to 654403b Compare August 25, 2025 10:27
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

@shridhargadekar, could you please rebase?

Recently add_ad_user_to_cached_groups() was modified to better handle
adding and removing group memberships of users from trusted domains in
groups of the local IPA domain. Before the change group members were
only added and with the change a removal was possible as well. This
caused an issues with an in-out parameter which contains the full list
of IPA group memberships at input and the list of group missing in the
cache as output. Since add_ad_user_to_cached_groups() is called twice,
the second time after the missing groups were read from the IPA server,
this caused and unexpected removal of group memberships since the second
call to add_ad_user_to_cached_groups() was done with the list of
missing groups and not with the full list.

With this patch a dedicated list is used for the missing groups to avoid
the described issues.

Resolves: SSSD#7921
The ipa_add_trusted_memberships_send() request will use
groups_get_send() to lookup missing groups. groups_get_send() can
currently only lookup "proper" groups which besides other items means
that the group name must be stored under the LDAP attribute given by the
'ldap_group_name' option. So currently it does not make sense to try to
lookup other objects where the RDN attribute name is different than this
value because those will always be treated as missing in the cache and
always trigger an LDAP search which will fail. This will typically
happen for iPAAssociation objects which are used to connect users and
hosts with HBAC and sudo rules. If in future a more generic search is
used this filter can be removed.
trusted.user(ad_user_name).add()
aduser_fqn = trusted.fqn(ad_user_name)

ipa.host.conn.exec(["ipa", "trust-find"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi,

why is this command needed?

bye,
Sumit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi,
These commands are not related to the test case. During the local containerized testing with pytest .... the aduser would not be detected. While troubleshooting the issue, I noticed that in the local environment, the AD-user was fetched after I execute ipa trust-find. It could be local environment thing.
I could drop it.

Thanks,

@shridhargadekar shridhargadekar force-pushed the sssd_hbac_member branch 3 times, most recently from b2ab728 to 5614704 Compare September 12, 2025 19:15
@shridhargadekar shridhargadekar force-pushed the sssd_hbac_member branch 2 times, most recently from 3b5b095 to fb26104 Compare September 22, 2025 09:36
In a IPA-AD trust environment, AD-user has membership of a
external-ipa group. This external-ipa-group is member of IPA-posix
group. When a HBAC rule is added and is the ipa-posix member is
added as member for that rule, AD-user misses that IPA-group-membership
@alexey-tikhonov
Copy link
Member

Included in #8094

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.

4 participants