Skip to content

Commit cd13d2d

Browse files
authored
Merge pull request #941 from cyphar/config-umask-option
config: add "umask" field to POSIX "user" section
2 parents 19e92ca + 6b04c63 commit cd13d2d

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

config.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ For POSIX platforms the `user` structure has the following fields:
221221

222222
* **`uid`** (int, REQUIRED) specifies the user ID in the [container namespace](glossary.md#container-namespace).
223223
* **`gid`** (int, REQUIRED) specifies the group ID in the [container namespace](glossary.md#container-namespace).
224+
* **`umask`** (int, OPTIONAL) specifies the [umask][umask_2] of the user. If unspecified, the umask should not be changed from the calling process' umask.
224225
* **`additionalGids`** (array of ints, OPTIONAL) specifies additional group IDs in the [container namespace](glossary.md#container-namespace) to be added to the process.
225226

226227
_Note: symbolic name for uid and gid, such as uname and gname respectively, are left to upper levels to derive (i.e. `/etc/passwd` parsing, NSS, etc)_
@@ -237,6 +238,7 @@ _Note: symbolic name for uid and gid, such as uname and gname respectively, are
237238
"user": {
238239
"uid": 1,
239240
"gid": 1,
241+
"umask": 63,
240242
"additionalGids": [5, 6]
241243
},
242244
"env": [
@@ -295,6 +297,7 @@ _Note: symbolic name for uid and gid, such as uname and gname respectively, are
295297
"user": {
296298
"uid": 1,
297299
"gid": 1,
300+
"umask": 7,
298301
"additionalGids": [2, 8]
299302
},
300303
"env": [
@@ -855,6 +858,7 @@ Here is a full example `config.json` for reference.
855858
[selinux]:http://selinuxproject.org/page/Main_Page
856859
[no-new-privs]: https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt
857860
[proc_2]: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
861+
[umask.2]: http://pubs.opengroup.org/onlinepubs/009695399/functions/umask.html
858862
[semver-v2.0.0]: http://semver.org/spec/v2.0.0.html
859863
[ieee-1003.1-2008-xbd-c8.1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_01
860864
[ieee-1003.1-2008-functions-exec]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html

schema/config-schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
"gid": {
9393
"$ref": "defs.json#/definitions/GID"
9494
},
95+
"umask": {
96+
"id": "https://opencontainers.org/schema/bundle/process/user/umask",
97+
"$ref": "defs.json#/definitions/Umask"
98+
},
9599
"additionalGids": {
96100
"$ref": "defs.json#/definitions/ArrayOfGIDs"
97101
},

schema/defs.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
"GID": {
6161
"$ref": "#/definitions/uint32"
6262
},
63+
"Umask": {
64+
"$ref": "#/definitions/uint32"
65+
},
6366
"ArrayOfGIDs": {
6467
"type": "array",
6568
"items": {

specs-go/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ type User struct {
8989
UID uint32 `json:"uid" platform:"linux,solaris"`
9090
// GID is the group id.
9191
GID uint32 `json:"gid" platform:"linux,solaris"`
92+
// Umask is the umask for the init process.
93+
Umask uint32 `json:"umask,omitempty" platform:"linux,solaris"`
9294
// AdditionalGids are additional group ids set for the container's process.
9395
AdditionalGids []uint32 `json:"additionalGids,omitempty" platform:"linux,solaris"`
9496
// Username is the user name.

0 commit comments

Comments
 (0)