Bug 1859252

Summary: [RFE] support pluggable data sources for subid ranges configurable via /etc/nsswitch.conf
Product: Red Hat Enterprise Linux 9 Reporter: Phil Jasbutis <pjasbuti>
Component: shadow-utilsAssignee: Alexey Tikhonov <atikhono>
Status: CLOSED CURRENTRELEASE QA Contact: Anuj Borah <aborah>
Severity: medium Docs Contact: Alexandra Nikandrova <anikandr>
Priority: medium    
Version: 9.0CC: aborah, anikandr, atikhono, bbaude, byodlows, cheimes, dapospis, dlavu, dornelas, dpal, dwalsh, fhirtz, fsayyed, grajaiya, gscrivan, gunther.mayer, ipedrosa, jhrozek, jligon, jnovy, lslebodn, lsm5, mheon, mzidek, pbrezina, rmanes, robert.zaage, sgoveas, smccarty, thalman, tscherf, tsweeney
Target Milestone: betaKeywords: FutureFeature, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard: sync-to-jira
Fixed In Version: shadow-utils-4.8.1-9.el9 Doc Type: Enhancement
Doc Text:
.The support for managing subID ranges is available in the shadow-utils Previously, `shadow-utils` configured the subID ranges automatically from the `/etc/subuid` and `/etc/subgid` files. With this update, the configuration of subID ranges is available in the `/etc/nsswitch.conf` file by setting a value in the `subid` field. For more information, see `man subuid` and `man subgid`. Also, with this update, an SSSD implementation of the `shadow-utils` plugin is available, which provides the subID ranges from the IPA server. To use this functionality, add the `subid: sss` value to the `/etc/nsswitch.conf` file. This solution might be useful in the containerized environment to facilitate rootless containers. Note that in case the `/etc/nsswitch.conf` file is configured by the `authselect` tool, you must follow the procedures described in the `authselect` documentation. When it is not the case, you can modify the `/etc/nsswitch.conf` file manually.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:20:54 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1989476, 2019921    
Bug Blocks: 1186913    

Description Phil Jasbutis 2020-07-21 14:52:48 UTC
1. Proposed title of this feature request

Rootless Containers as Easy as Pie : just work out-of-the-box


3. What is the nature and description of the request?

The customer has meanwhile investigated the technology for his application and is now thinking
about the obstacles that still have to be overcome for productive use.

For enterprise environments it is typical to have a centralized user management and
podman requires to manage subuid/subgid on file level of the host where a container should run.

So since we are talking about a decentralized approach the customer has to take the effort and 
taking care of a consistent user/group mapping all over his infrastructure.

In addition the customers environment delivers user home directories via NFS shares. This is quite
common in enterprise environments but not supported by podman atm.


4. Why does the customer need this? (List the business requirements here)

Customer wants to:

 - minimize the management effort for subuid/subgid management
 - simplify integration into the corporate environment
 - have a more stable solution while using the podman as it comes out-of-the-box for business environments


5. How would the customer like to achieve this? (List the functional requirements here)

- A novel concept/implementation for subuid/subgid which works automatic
   (that would allow a even a single user to run isolated workloads)

- A novel approach to container .vs fileystem-permissions, e.g. store subuid/subgid in ACLs
   and work on all filesystems which support ACLs

- or encapsulate the filesystem in a filesystem-image in a single file (which is owned by the user)

- perhaps this functionality might be implemented directly into the kernel.



6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.

- Since this is a suggestion for improvement, for which it is currently not foreseeable how it might be implemented, no information can be given yet.


7. Is there already an existing RFE upstream or in Red Hat Bugzilla?

- not known yet


8. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?

- no, asap


9. Is the sales team involved in this request and do they have any additional input?

- no


10. List any affected packages or components.

- podman


11. Would the customer be able to assist in testing this functionality if implemented?

- yes, customer is highly engaged and would support testing.

Comment 3 Daniel Walsh 2020-07-21 17:06:47 UTC
This is totally out of Podman's hands this request needs to be handled by shadow-utils/sssd we need
a way of getting this information in Podman and newuidmap/newgidmap.

We need Full discussion has been open for 1.5 years.

https://github.com/shadow-maint/shadow/issues/154

Comment 4 Alexey Tikhonov 2020-07-21 17:28:34 UTC
Upstream tickets:
 * shadow-utils: https://github.com/shadow-maint/shadow/issues/154
 * SSSD: https://github.com/SSSD/sssd/issues/5197
 * FreeIPA: https://pagure.io/freeipa/issue/8361

Comment 5 Gunther Mayer 2020-07-23 18:36:31 UTC
Hi,

I would even opt for a radically new handling of this issue in the Kernel itself:


1) Make "subuid/subgid" a primary citizen in the linux kernel
   - Each user can have the full range subuid 0...2^32-1, no need to allocate ranges and keep them disjunct
  
2) Make this a "secondary citizen" in the filesystem code (e.g. using xattr /acl) [primary citizen would be preferrable,
   but perhaps that needs very heavy changes]
   E.g. When accessing files, use both UID + SubUID for checking permissions.
   
2a) I do not know if extended attributes already are in NFS standards, e.g. see https://tools.ietf.org/html/rfc8276 from Dec. 2017)


Both items also have more implications and architecture/design/implementation choices which need to be well-thought.
This is just the high level idea.

Of course this is not in the hand of podman, but would require kernel changes (the same happened for namespaces).

Regards, Gunther

e.g. the kernel already has Real_UID, Saved_UID, Effective_UID, so why not another "SubUID" ?

Comment 6 Daniel Walsh 2020-07-24 09:51:07 UTC
Also realize that anytime you are playing with DAC (UIDs/GIDS) you are risking CVE Vulnerabilities. which means changes would take many YEARS to get implemeneted if ever.  So I would rather deal with this in user space.

Comment 15 Alexey Tikhonov 2021-04-23 11:29:39 UTC
https://github.com/shadow-maint/shadow/pull/321 was merged upstream