Skip to content

[20.10 backport] Fix userns-remap option when username & UID match#42013

Merged
tiborvass merged 1 commit into
moby:20.10from
thaJeztah:20.10_backport_42003_fix_userns_uid_username_match
Feb 18, 2021
Merged

[20.10 backport] Fix userns-remap option when username & UID match#42013
tiborvass merged 1 commit into
moby:20.10from
thaJeztah:20.10_backport_42003_fix_userns_uid_username_match

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

backport of #42004

- What I did
Fixes #42003 by only matching UID or username.

- How I did it
Check subuidRangesWithUID first then subuidRangesWithUserName.

- How to verify it

  1. echo "10426:x:10426:10426::/nonexistent:/bin/false" >> /etc/passwd
  2. echo "10426:x:10426:" >> /etc/group
  3. echo "10426:10426000:10000" >> /etc/subuid
  4. echo "10426:10426000:10000" >> /etc/subgid
  5. dockerd --userns-remap=10426 &
  6. docker run hello-world

- Description for the changelog

Fix userns-remap option when username & UID match

- A picture of a cute animal (not mandatory but encouraged)
06-beaver-attack

Signed-off-by: Grant Millar <[email protected]>
(cherry picked from commit 2ad187f)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah

Copy link
Copy Markdown
Member Author

rebased to trigger CI with test-fixes that were merged

@thaJeztah
thaJeztah force-pushed the 20.10_backport_42003_fix_userns_uid_username_match branch from 2202f89 to 94d2467 Compare February 17, 2021 20:14

@cpuguy83 cpuguy83 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@tiborvass
tiborvass merged commit 8e2c5fc into moby:20.10 Feb 18, 2021
@thaJeztah
thaJeztah deleted the 20.10_backport_42003_fix_userns_uid_username_match branch February 18, 2021 21:27
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