Bug 1715195 - Need nsswitch support for /etc/subuid and /etc/subgid content
Summary: Need nsswitch support for /etc/subuid and /etc/subgid content
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: glibc team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1715193
TreeView+ depends on / blocked
 
Reported: 2019-05-29 19:27 UTC by Daniel Walsh
Modified: 2020-06-29 15:43 UTC (History)
19 users (show)

Fixed In Version:
Clone Of: 1715193
Environment:
Last Closed: 2020-01-21 14:22:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Proposal for adding subuid and subgid to nsswitch (1.84 KB, text/plain)
2019-10-17 13:00 UTC, Daniel Walsh
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github shadow-maint shadow issues 154 0 'None' open subid ranges sourced from the network store 2021-01-21 06:48:37 UTC

Description Daniel Walsh 2019-05-29 19:27:52 UTC
+++ This bug was initially created as a clone of Bug #1715193 +++

Lots of people are playing with the new container runtime tools that run containers as non root, like Podman and Buildah.

These tools take advantage of the /etc/subuid and /etc/subgid files provided by shadow-utils and updated via useradd for managing extra uids to be used by the user within containers.

A lot of people using these tools want to be able to destribute the content in these files the same way they do for content in /etc/passwd.

Basically they want to have nsswitch support for them.

Comment 1 Daniel Walsh 2019-05-29 19:28:43 UTC
https://github.com/shadow-maint/shadow/issues/154

Comment 2 Ben Cotton 2019-08-13 16:49:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 5 Daniel Walsh 2019-10-17 13:00:53 UTC
Created attachment 1626793 [details]
Proposal for adding subuid and subgid to nsswitch

Comment 6 Carlos O'Donell 2019-10-24 21:36:23 UTC
(In reply to Daniel Walsh from comment #5)
> Created attachment 1626793 [details]
> Proposal for adding subuid and subgid to nsswitch

This is a good start.

The proposal needs to take into account the feedback from upstream, integrate that and point out why the current direction is still the best.

The upstream feedback can be extracted from here: https://github.com/shadow-maint/shadow/issues/154

I'd like to see the proposal discuss the issues of UID/GID space exhaustion. Even if it's just to say that's a problem that each site has to tackle.

Likewise a discussion about dynamic vs. static allocation is a must.

Comment 7 Romain Geissler 2019-11-07 19:17:47 UTC
Hi,

FYI, in Amadeus we wish to use at some point podman on Linux servers shared among Amadeus developers. The fact that machines are shared also implies that users are managed by a remote server, in our case Active Directory (using LDAP protocol). So indeed for us having these files /etc/subuid and /etc/subgid as the only mean to configure multi-user containers is currently one blocker for our adoption of podman, as deploying these static files on all machines each time an Amadeus developer enter or leaves the company is not convenient.

I have read the discussion in https://github.com/shadow-maint/shadow/issues/154, to be honest I miss too many concepts to understand it correctly. As much as possible for a rapid adoption of podman, the final solution shall be easy to configure and deploy. Let's say in addition to fixed uid/gid which exists today already in Active Directory, podman also needs ranges of uid/gid to be statically allocated in Active Directory, then we would need to wait that:
 - Microsoft supports that (since I don't know anything to Active Directory, maybe it's needed, maybe not)
 - Our sysadmin do setup that range allocation correctly.

Maybe I misunderstood what Lennart Poettering wrote in https://github.com/shadow-maint/shadow/issues/154 but if indeed we could make podman run without the need of statically allocated id ranges, that would mean for us no change at all on Active Directory side, which is simpler for deployment for us. If indeed ranges could be dynamically allocated by a local service on the machine without needing to same that user X can user range Y in any config file anywhere, it looks more appealing.

Anyway, our primary need is to be able to run containers containing more than a single user, rootless, where the host user running podman is defined in an Active Directory database. I would be glad to test any future implementation in podman/glibc allowing to do this ;)

Cheers,
Romain

Comment 8 Florian Weimer 2019-11-07 20:07:31 UTC
(In reply to Romain Geissler from comment #7)
> Hi,
> 
> FYI, in Amadeus we wish to use at some point podman on Linux servers shared
> among Amadeus developers. The fact that machines are shared also implies
> that users are managed by a remote server, in our case Active Directory
> (using LDAP protocol). So indeed for us having these files /etc/subuid and
> /etc/subgid as the only mean to configure multi-user containers is currently
> one blocker for our adoption of podman, as deploying these static files on
> all machines each time an Amadeus developer enter or leaves the company is
> not convenient.

Thank you for sharing your perspective. This is very helpful.

> I have read the discussion in
> https://github.com/shadow-maint/shadow/issues/154, to be honest I miss too
> many concepts to understand it correctly. As much as possible for a rapid
> adoption of podman, the final solution shall be easy to configure and
> deploy. Let's say in addition to fixed uid/gid which exists today already in
> Active Directory, podman also needs ranges of uid/gid to be statically
> allocated in Active Directory, then we would need to wait that:
>  - Microsoft supports that (since I don't know anything to Active Directory,
> maybe it's needed, maybe not)
>  - Our sysadmin do setup that range allocation correctly.

I think you can add new data structures to Active Directory. I have no idea how common an activity this is, but it's certainly a (one-time) task that has to happen, in addition to the day-to-day data management.

The other concern I would expect that auditors might prefer if every user had just a single POSIX UID/GID combination.

> Maybe I misunderstood what Lennart Poettering wrote in
> https://github.com/shadow-maint/shadow/issues/154 but if indeed we could
> make podman run without the need of statically allocated id ranges, that
> would mean for us no change at all on Active Directory side, which is
> simpler for deployment for us. If indeed ranges could be dynamically
> allocated by a local service on the machine without needing to same that
> user X can user range Y in any config file anywhere, it looks more appealing.

I think you can play with the dynamic assignment today, using systemd-nspawn:

<https://systemd.io/UIDS-GIDS.html#special-systemd-uid-ranges>
<https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--private-users=>

The downside of course is that these IDs aren't unique over time.

I don't know if podman can use these dynamic ranges today, and if using these features is still considered “rootless”.

Comment 9 Daniel Walsh 2019-11-07 22:37:27 UTC
Podman is relying on newuidmap and newgidmap for a rootless user to run containers.  At least this is the use case we are after.
We are not currently looking at the use case where a root running podman is attempting to use ranges of UIDs for each different
container, so that they run in different User Namespaces.

Comment 10 Romain Geissler 2019-11-08 00:42:02 UTC
> The downside of course is that these IDs aren't unique over time.

If allocated IDs were dynamic, would it be possible that I run a container on a given machine, bind mount a local filesystem directory, write a secret into a file in there with a user which is not the default user of the container (so that I am allocated a dynamic id), then stop the container, and the file remains on the filesystem, using this "fake" id, unrelated to my linux user ? And then another unrelated developer could run another unrelated container, be allocated the same recycled "fake" user id, and thus read my secret file ? If yes indeed, statically allocated ranges seems more secure.

Comment 11 Daniel Walsh 2019-11-08 11:14:18 UTC
I think the answer to this is clearly yes.  This issue always exists with the reuse of UIDs.

Comment 12 Carlos O'Donell 2020-01-07 03:21:21 UTC
I've commented on this upstream again, summarizing the past comments and adding my own reflection on the design direction:
https://github.com/shadow-maint/shadow/issues/154#issuecomment-571415244

Next week I'm going to close this issue as CLOSED/UPSTREAM, as something we can track upstream. Fedora would inherit a choice made and designed upstream.


Note You need to log in before you can comment on or make changes to this bug.