Quadlet - add support for UID and GID Mapping

Support UIDMap, GIDMap, SubUIDMap and SubGIDMap
If any of them are set disregard the deprecated Remap keys
Add tests and man

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
This commit is contained in:
Ygal Blum
2023-11-13 11:30:23 +02:00
parent 1d49773bb8
commit e35fc92c02
9 changed files with 132 additions and 14 deletions

View File

@@ -0,0 +1,10 @@
## assert-failed
## assert-stderr-contains "deprecated Remap keys are set along with explicit mapping keys"
[Container]
Image=localhost/imagename
UIDMap=0:10000:10
UIDMap=10:20000:10
GIDMap=0:10000:10
GIDMap=10:20000:10
RemapUsers=auto

View File

@@ -0,0 +1,11 @@
## assert-podman-args "--uidmap=0:10000:10"
## assert-podman-args "--uidmap=10:20000:10"
## assert-podman-args "--gidmap=0:10000:10"
## assert-podman-args "--gidmap=10:20000:10"
[Container]
Image=localhost/imagename
UIDMap=0:10000:10
UIDMap=10:20000:10
GIDMap=0:10000:10
GIDMap=10:20000:10

View File

@@ -0,0 +1,8 @@
## assert-failed
## assert-stderr-contains "deprecated Remap keys are set along with explicit mapping keys"
[Container]
Image=localhost/imagename
SubUIDMap=utest
SubGIDMap=gtest
RemapUsers=auto

View File

@@ -0,0 +1,7 @@
## assert-podman-args "--subuidname" "utest"
## assert-podman-args "--subgidname" "gtest"
[Container]
Image=localhost/imagename
SubUIDMap=utest
SubGIDMap=gtest

View File

@@ -0,0 +1,7 @@
## assert-failed
## assert-stderr-contains "deprecated Remap keys are set along with explicit mapping keys"
[Container]
Image=localhost/imagename
RemapUsers=auto
UserNS=keep-id

View File

@@ -0,0 +1,5 @@
## assert-podman-args "--userns" "keep-id"
[Container]
Image=localhost/imagename
UserNS=keep-id

View File

@@ -690,6 +690,8 @@ BOGUS=foo
Entry("exec.container", "exec.container", 0, ""),
Entry("health.container", "health.container", 0, ""),
Entry("hostname.container", "hostname.container", 0, ""),
Entry("idmapping.container", "idmapping.container", 0, ""),
Entry("idmapping-with-remap.container", "idmapping-with-remap.container", 1, "converting \"idmapping-with-remap.container\": deprecated Remap keys are set along with explicit mapping keys"),
Entry("image.container", "image.container", 0, ""),
Entry("install.container", "install.container", 0, ""),
Entry("ip.container", "ip.container", 0, ""),
@@ -726,10 +728,14 @@ BOGUS=foo
Entry("selinux.container", "selinux.container", 0, ""),
Entry("shmsize.container", "shmsize.container", 0, ""),
Entry("shortname.container", "shortname.container", 0, "Warning: shortname.container specifies the image \"shortname\" which not a fully qualified image name. This is not ideal for performance and security reasons. See the podman-pull manpage discussion of short-name-aliases.conf for details."),
Entry("subidmapping.container", "subidmapping.container", 0, ""),
Entry("subidmapping-with-remap.container", "subidmapping-with-remap.container", 1, "converting \"subidmapping-with-remap.container\": deprecated Remap keys are set along with explicit mapping keys"),
Entry("sysctl.container", "sysctl.container", 0, ""),
Entry("timezone.container", "timezone.container", 0, ""),
Entry("unmask.container", "unmask.container", 0, ""),
Entry("user.container", "user.container", 0, ""),
Entry("userns.container", "userns.container", 0, ""),
Entry("userns-with-remap.container", "userns-with-remap.container", 1, "converting \"userns-with-remap.container\": deprecated Remap keys are set along with explicit mapping keys"),
Entry("volume.container", "volume.container", 0, ""),
Entry("workingdir.container", "workingdir.container", 0, ""),
Entry("Container - global args", "globalargs.container", 0, ""),