Skip to content

Commit

Permalink
Adding Umask= key to Quadlet .container files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerben Damave authored and geraveoyomama committed Feb 11, 2025
1 parent 2e36bc0 commit 1fb356a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/source/markdown/podman-systemd.unit.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ Valid options for `[Container]` are listed below:
| Tmpfs=/work | --tmpfs /work |
| UIDMap=0:10000:10 | --uidmap=0:10000:10 |
| Ulimit=nofile=1000:10000 | --ulimit nofile=1000:10000 |
| Umask=0002 | --umask=0002 |
| Unmask=ALL | --security-opt unmask=ALL |
| User=bin | --user bin |
| UserNS=keep-id:uid=200,gid=210 | --userns keep-id:uid=200,gid=210 |
Expand Down Expand Up @@ -894,6 +895,15 @@ Ulimit options. Sets the ulimits values inside of the container.

This key can be listed multiple times.

### `Umask=`

Set the umask of the process. This is equivalent to the Podman `--umask` and generally has the form `[UMASK]`

Example:
```
Umask=0002
```

### `Unmask=`

Specify the paths to unmask separated by a colon. unmask=ALL or /path/1:/path/2, or shell expanded paths (/proc/*):
Expand Down
4 changes: 4 additions & 0 deletions pkg/systemd/quadlet/quadlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const (
KeyType = "Type"
KeyUIDMap = "UIDMap"
KeyUlimit = "Ulimit"
KeyUmask = "Umask"
KeyUnmask = "Unmask"
KeyUser = "User"
KeyUserNS = "UserNS"
Expand Down Expand Up @@ -277,6 +278,7 @@ var (
KeyTmpfs: true,
KeyUIDMap: true,
KeyUlimit: true,
KeyUmask: true,
KeyUnmask: true,
KeyUser: true,
KeyUserNS: true,
Expand Down Expand Up @@ -635,6 +637,7 @@ func ConvertContainer(container *parser.UnitFile, isUser bool, unitsInfoMap map[
KeyStopSignal: "--stop-signal",
KeyStopTimeout: "--stop-timeout",
KeyPull: "--pull",
KeyUmask: "--umask",
}
lookupAndAddString(container, ContainerGroup, stringKeys, podman)

Expand Down Expand Up @@ -2220,3 +2223,4 @@ func addDefaultDependencies(service *parser.UnitFile, isUser bool) {
service.PrependUnitLine(UnitGroup, "Wants", networkUnit)
}
}

5 changes: 5 additions & 0 deletions test/e2e/quadlet/umask.container
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## assert-podman-args "--umask" "0002"

[Container]
Image=localhost/imagename
Umask=0002
1 change: 1 addition & 0 deletions test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ BOGUS=foo
Entry("sysctl.container", "sysctl.container"),
Entry("timezone.container", "timezone.container"),
Entry("ulimit.container", "ulimit.container"),
Entry("umask.container", "umask.container")
Entry("unmask.container", "unmask.container"),
Entry("user.container", "user.container"),
Entry("userns.container", "userns.container"),
Expand Down

0 comments on commit 1fb356a

Please sign in to comment.