Skip to content

Conversation

@eqvinox
Copy link

@eqvinox eqvinox commented Nov 26, 2025

this is a draft PR, soliciting input on whether/how this is desirable as an SSSD feature

This adds 2 config options to the LDAP provider:

ldap_group_absent_gid_local = <bool>
ldap_group_negative_gid_local = <bool>

If the LDAP result for a group's gid is either absent or negative respectively, the code checks whether the group exists in /etc/group, and if it does uses the gid found there.

The point is getting the ability to assign e.g. audio bluetooth etc. groups to users.

I have tested this, but before adding the config options (no idea if I did that right); the current version is untested. It also needs some search filter adjustments for the "absent" case since those groups are otherwise filtered out before this code is reached at all.

@eqvinox
Copy link
Author

eqvinox commented Nov 26, 2025

Looks like I didn't get the config bits right, but… eh. For the time being, I only care about general feedback, polishing can come later.

@alexey-tikhonov
Copy link
Member

The point is getting the ability to assign e.g. audio bluetooth etc. groups to users.

Could you please describe use case in a greater details?

Currently it's already possible to add "remote" (LDAP) user to /etc/group and use [SUCCESS=merge] syntax in 'nsswitch.conf' to make remote users to be members of local groups.

@eqvinox
Copy link
Author

eqvinox commented Nov 27, 2025

Currently it's already possible to add "remote" (LDAP) user to /etc/group and use [SUCCESS=merge] syntax in 'nsswitch.conf' to make remote users to be members of local groups.

Yes, but you have to do that on every single system, and keep updating it for new/removed users; membership for these "system local" groups can't be provided by LDAP (unless I've seriously missed something somewhere in the docs?)

With this change, I'm doing this:

dn: cn=libvirt,ou=groups,dc=example,dc=org
objectClass: groupOfNames
objectClass: posixGroupAux
cn: libvirt
gidNumber: -1
member: uid=equinox,ou=users,dc=example,dc=org

Which combines with, on the client systems, in /etc/group:

libvirt:x:117:

to get equinox to be added to the existing (package manager created) libvirt group (which on some systems also has a different numeric gid), and have it applied on initgroups() as supplemental gid when logging in.

If there's some other way to do this, I've wasted a whole lot of work and some docs need updating 😆

@alexey-tikhonov
Copy link
Member

man nsswitch.conf

merge       [SUCCESS=merge]  is  used  between two database entries.  When a group is located
in the first of the two group entries, processing will continue on to the next one.  If the group
is also found in the next entry (and the group name and GID are  an  exact  match), the member
list of the second entry will be added to the group object to be returned.

Do I understand correctly that the issue is floating GID?

@eqvinox
Copy link
Author

eqvinox commented Nov 27, 2025 via email

@alexey-tikhonov
Copy link
Member

Is your case similar to this - https://issues.redhat.com/browse/RHEL-109560 ?


DEBUG(SSSDBG_TRACE_FUNC, "GID remap: checking group %s\n", group_name);

FILE *etc_group = fopen("/etc/group", "r");
Copy link
Member

@alexey-tikhonov alexey-tikhonov Nov 27, 2025

Choose a reason for hiding this comment

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

That's definitely not a way to go.

There is sss_load_nss_symbols() helper in 'util/nss_dl_load.c' that can load 'libnss_files.so.2' to query local files.
But this would leave an open question about nss-altfiles, for example.

JFTR: I don't propose you to put more work into this atm. SSSD had "files provider" in the past (now removed), and idea of going back to messing with local NSS objects isn't too appealing...

@eqvinox
Copy link
Author

eqvinox commented Nov 27, 2025 via email

@eqvinox
Copy link
Author

eqvinox commented Nov 27, 2025 via email

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants