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

Support subid resources in ipa provider #5197

Closed
abbra opened this issue Jun 8, 2020 · 15 comments
Closed

Support subid resources in ipa provider #5197

abbra opened this issue Jun 8, 2020 · 15 comments
Assignees
Labels
Closed: Fixed Issue was closed as fixed.

Comments

@abbra
Copy link
Contributor

abbra commented Jun 8, 2020

For containerized environments it is helpful to enable centrally-managed allocation and distribution of ID sub-ranges for users/groups to use in podman and runc.

As discussed in shadow-maint/shadow#154, shadow-maint/shadow@0a7888b adds a new interface, libsubid. This interface will be extended to allow pluggable backends.

The purpose of this ticket is to track any work related to libsubid integration.
Corresponding FreeIPA ticket is https://pagure.io/freeipa/issue/8361

@alexey-tikhonov alexey-tikhonov self-assigned this Jun 9, 2020
@lukasheinrich
Copy link

just adding here that his is of interest for deploying containers at CERN. We have successfully tested the state-file based approach which works well, but to deploy this at scale a dynamic solution is needed

@cloudbustinguk
Copy link

Seconding @lukasheinrich's interest, but from the Paul Scherrer Institute also in Switzerland.

@cjreyn
Copy link

cjreyn commented Aug 11, 2020

Diamond Light Source also interested in this. Our current solution of building a subuid/subgid list through a cron job querying LDAP is less than ideal!

@alexey-tikhonov
Copy link
Member

As discussed in shadow-maint/shadow#154, shadow-maint/shadow@0a7888b adds a new interface, libsubid. This interface will be extended to allow pluggable backends.

Just to makes things clear: this ^^ (support of pluggable backends) wasn't implemented in shadow-utils so far.

Moreover, that's not the only thing that should be done there.
For example, newgidmap/newuidmap should be reworked to make use of this new (pluggable) API instead of files-backed lib/subordinateio (which could be used as a basis for "files" plugin).

Without this SSSD changes doesn't make sense.

Another thing, I don't think it is really realistic to make findutils, coreutils, util_linux, audit, procps and any other tool that looks at process or files using new shadow-utils API in addition to glibc nss to resolve issue of "objects owned by unknown UID/GID". But that's a different story.

@martijndegouw
Copy link

just adding here that his is of interest for deploying containers at CERN. We have successfully tested the state-file based approach which works well, but to deploy this at scale a dynamic solution is needed

Are there already LDAP (especially Active Directory) attributes assigned for this info?
Right now I'm considering to just use a extension attribute and store the subuid:count in there.

@abbra
Copy link
Contributor Author

abbra commented Dec 14, 2020

No, I haven't had time to work on this yet. So no LDAP attributes designed and allocated. I guess we can start with a prototype and then settle down with a registered set of attributes that suit best.

@hallyn
Copy link

hallyn commented Dec 31, 2020

Hi,

This is purely untested and just meant to start a conversation and show what I think shadow's needs are, but I started a shadow branch here: https://github.com/hallyn/shadow/tree/2020-12-30/sssd latest commit so far being hallyn/shadow@20501b8 .

If you don't expect to have time in the next few weeks to write the sssd side of it, I could give it a shot. I'd of course try to keep it in the style of the rest of sssd, but testing setup would be an initial stumbling block.

@alexey-tikhonov
Copy link
Member

alexey-tikhonov commented Jan 5, 2021

Hi,

This is purely untested and just meant to start a conversation and show what I think shadow's needs are, but I started a shadow branch here: https://github.com/hallyn/shadow/tree/2020-12-30/sssd latest commit so far being hallyn/shadow@20501b8 .

If you don't expect to have time in the next few weeks to write the sssd side of it, I could give it a shot. I'd of course try to keep it in the style of the rest of sssd, but testing setup would be an initial stumbling block.

Hi,

first of all, thanks a lot for pushing this forward. Yes, I hope I'll be able to give this a try.

I will take a deeper look in your prototype this week, but from a first glance I have a following question: why do we need any SSSD specific code (i.e. /libmisc/sssd.c) in shadow-utils sources at all?

My understanding is that shadow should read name(-s) of the plugin from /etc/nsswitch.conf::subid field, then dlopen(libsubid_$name) (where name = files may stand for plugin that sources info from local /etc/ files, sss - for SSSD plugin that sources info from LDAP, etc -- but names shoudn't be hardcoded in shadow-util sources) and then dlsym()'s fixed API - independent of plugin being loaded.
I think code in shadow-utils that loads and uses plugin should be the same for any plugin: this simplifies things and allows anyone interested to provide/plug own data sources, besides classical files and IPA/SSSD.
This also somewhat resolves "testing setup" thing: libsubid_files is the very first setup to be tested in new framework.

Btw, I think it's better to follow libsubid_$plugin pattern (instead of lib$plugin_subid currently seen in sources) to be consistent with nss subsystem (libnss_files.so, libnss_sss.so, libnss_systemd.so, etc)

@hallyn
Copy link

hallyn commented Jan 11, 2021

Yeah I was following the sudo example, I agree shadow doesn't care whether it's sssd or something else.

Actually exporting a libsubid_files.so feels odd, but I'll go ahead and do that.

I'll post here when I've updated the branch per your suggestions. I'm sorry, due to some off-time coming up I'm not sure when I'll be able to. It shouldn't take too long though so when I find a slow afternoon...

@alexey-tikhonov
Copy link
Member

Yeah I was following the sudo example, I agree shadow doesn't care whether it's sssd or something else.

Actually exporting a libsubid_files.so feels odd, but I'll go ahead and do that.

Well, from my point of view that's fine, but if you feel it's too weird to export libsubid_files.so then I think it is also ok to have an exception / special handling specifically for /etc/nsswitch.conf::subid=files in internal implementation.

The main point is to have this transparent for users (i.e. configuration means should be the same - etc/nsswitch.conf - for all data sources) and for providers of 3rd party plugins (i.e. no plugin specific handling / changes in shadow-utils code to plug new data source)...

@alexey-tikhonov
Copy link
Member

Hi @hallyn,

shadow-maint/shadow#154 (comment) :

I've had a branch for this for awhile but haven't had time to review/test my own code.

Is this https://github.com/hallyn/shadow/commits/2021-01-31/newnss.1 or something different?

@hallyn
Copy link

hallyn commented Mar 6, 2021

Based on that, but that is a bit out of date.

@hallyn
Copy link

hallyn commented Mar 6, 2021

Ok I force pushed my current branch to https://github.com/hallyn/shadow/commits/2021-01-31/newnss.1 . I'm sure it needs some cleanup, but it works - passes the little tests I wrote, and I manually tested with a custom libsubid_zzz.so which provides subuid 200000 to my user while /etc/subuid provides 100000. I was able to get and not get the correct ranges based on /etc/nsswitch.conf subid: files versus subid: zzz.

Hoping to proofread and clean it up tonight. In the meantime, comments very welcome in that PR.

@alexey-tikhonov
Copy link
Member

Thanks.
Added comments here and inline.

alexey-tikhonov added a commit to alexey-tikhonov/sssd that referenced this issue Jun 20, 2021
Limitations:
 - only IPA provider
 - single subid interval pair (subuid+subgid) per user
 - idviews aren't supported
 - only forward lookup (user -> subid)

Known TODOs:
 - delete cached subid ranges in case "not found" on a server
 - distinguish "user not found" vs "user doesn't have ranges defined"

Resolves: SSSD#5197
alexey-tikhonov added a commit to alexey-tikhonov/sssd that referenced this issue Jun 20, 2021
Limitations:
 - only IPA provider
 - single subid interval pair (subuid+subgid) per user
 - idviews aren't supported
 - only forward lookup (user -> subid)

Known TODOs:
 - delete cached subid ranges in case "not found" on a server
 - distinguish "user not found" vs "user doesn't have ranges defined"

Resolves: SSSD#5197
@alexey-tikhonov alexey-tikhonov linked a pull request Jun 20, 2021 that will close this issue
alexey-tikhonov added a commit to alexey-tikhonov/sssd that referenced this issue Jul 23, 2021
Limitations:
 - only IPA provider
 - single subid interval pair (subuid+subgid) per user
 - idviews aren't supported
 - only forward lookup (user -> subid)

Resolves: SSSD#5197
alexey-tikhonov added a commit to alexey-tikhonov/sssd that referenced this issue Jul 26, 2021
Limitations:
 - only IPA provider
 - single subid interval pair (subuid+subgid) per user
 - idviews aren't supported
 - only forward lookup (user -> subid)

Resolves: SSSD#5197
alexey-tikhonov added a commit to alexey-tikhonov/sssd that referenced this issue Jul 28, 2021
:feature: Basic support of user's 'subuid and subgid ranges' for IPA
provider and corresponding plugin for shadow-utils were introduced.
Limitations:
 - single subid interval pair (subuid+subgid) per user
 - idviews aren't supported
 - only forward lookup (user -> subid ranges)
Take a note, this is MVP of experimental feature. Significant changes
might be required later, after initial feedback.
Corresponding support in shadow-utils was merged upstream, but since there
is no upstream release available yet, SSSD feature isn't built by default.
Build can be enabled with `--with-subid` configure option.
Plugin's install path can be configured with `--with-subid-lib-path=`
("${libdir}" by default)

:config: New IPA provider's option `ipa_subid_ranges_search_base` allows
configuration of search base for user's subid ranges.
Default: `cn=subids,%basedn`

Resolves: SSSD#5197
alexey-tikhonov added a commit to alexey-tikhonov/sssd that referenced this issue Jul 29, 2021
:feature: Basic support of user's 'subuid and subgid ranges' for IPA
provider and corresponding plugin for shadow-utils were introduced.
Limitations:
 - single subid interval pair (subuid+subgid) per user
 - idviews aren't supported
 - only forward lookup (user -> subid ranges)
Take a note, this is MVP of experimental feature. Significant changes
might be required later, after initial feedback.
Corresponding support in shadow-utils was merged upstream, but since there
is no upstream release available yet, SSSD feature isn't built by default.
Build can be enabled with `--with-subid` configure option.
Plugin's install path can be configured with `--with-subid-lib-path=`
("${libdir}" by default)

For additional details about support in shadow-utils please see discussion
in shadow-maint/shadow#154 and in related PRs.

:config: New IPA provider's option `ipa_subid_ranges_search_base` allows
configuration of search base for user's subid ranges.
Default: `cn=subids,%basedn`

Resolves: SSSD#5197
@pbrezina
Copy link
Member

Pushed PR: #5693

  • master
    • f546088 - Basics of 'subid ranges' support for IPA provider.

@pbrezina pbrezina added the Closed: Fixed Issue was closed as fixed. label Jul 29, 2021
pbrezina pushed a commit that referenced this issue Oct 13, 2021
issue: #5197

bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1803943

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Steeve Goveas <sgoveas@redhat.com>
shridhargadekar pushed a commit to shridhargadekar/sssd that referenced this issue Apr 1, 2022
issue: SSSD#5197

bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1803943

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Steeve Goveas <sgoveas@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed: Fixed Issue was closed as fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants