Skip to content

Commit f408ce0

Browse files
committed
Rework default list of capabilities to minimal
For a couple of years now we have been shipping containers.conf settings to use only 10 capabities. Docker uses 14, with the difference being CAP_AUDIT_ALLOW, CAP_NET_RAW, CAP_MKNOD, CAP_CHROOT. This allows us to run with a tighter security then Docker. This PR makes the change to default config, so that if no containers.conf overrides are present, we will run with the tighter security. Currently most distros that ship the containers.conf already run with this setting, but this makes it formal, and changes the man page to match the defaults. Signed-off-by: Daniel J Walsh <[email protected]>
1 parent f5d94c3 commit f408ce0

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

docs/containers.conf.5.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,24 @@ List of default capabilities for containers.
8888
The default list is:
8989
```
9090
default_capabilities = [
91-
"AUDIT_WRITE",
9291
"CHOWN",
9392
"DAC_OVERRIDE",
9493
"FOWNER",
9594
"FSETID",
9695
"KILL",
97-
"MKNOD",
9896
"NET_BIND_SERVICE",
99-
"NET_RAW",
97+
"SETFCAP",
10098
"SETGID",
10199
"SETPCAP",
102100
"SETUID",
103-
"SYS_CHROOT",
104101
]
105102
```
106103

104+
Note, by default container engines using containers.conf, run with less
105+
capabilities then Docker. Docker runs additionally with "AUDIT_WRITE", "MKNOD",
106+
"NET_RAW", "CHROOT". If you need to add one of these capabilities for a
107+
particular container, you can use the --cap-add option.
108+
107109
**default_sysctls**=[]
108110

109111
A list of sysctls to be set in containers by default,

pkg/config/containers.conf

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,18 @@
5252
# List of default capabilities for containers. If it is empty or commented out,
5353
# the default capabilities defined in the container engine will be added.
5454
#
55-
default_capabilities = [
56-
"CHOWN",
57-
"DAC_OVERRIDE",
58-
"FOWNER",
59-
"FSETID",
60-
"KILL",
61-
"NET_BIND_SERVICE",
62-
"SETFCAP",
63-
"SETGID",
64-
"SETPCAP",
65-
"SETUID",
66-
"SYS_CHROOT"
67-
]
55+
#default_capabilities = [
56+
# "CHOWN",
57+
# "DAC_OVERRIDE",
58+
# "FOWNER",
59+
# "FSETID",
60+
# "KILL",
61+
# "NET_BIND_SERVICE",
62+
# "SETFCAP",
63+
# "SETGID",
64+
# "SETPCAP",
65+
# "SETUID",
66+
#]
6867

6968
# A list of sysctls to be set in containers by default,
7069
# specified as "name=value",

pkg/config/default.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,16 @@ var (
7676
DefaultHooksDirs = []string{"/usr/share/containers/oci/hooks.d"}
7777
// DefaultCapabilities is the default for the default_capabilities option in the containers.conf file.
7878
DefaultCapabilities = []string{
79-
"CAP_AUDIT_WRITE",
8079
"CAP_CHOWN",
8180
"CAP_DAC_OVERRIDE",
8281
"CAP_FOWNER",
8382
"CAP_FSETID",
8483
"CAP_KILL",
85-
"CAP_MKNOD",
8684
"CAP_NET_BIND_SERVICE",
87-
"CAP_NET_RAW",
8885
"CAP_SETFCAP",
8986
"CAP_SETGID",
9087
"CAP_SETPCAP",
9188
"CAP_SETUID",
92-
"CAP_SYS_CHROOT",
9389
}
9490

9591
// Search these locations in which CNIPlugins can be installed.

0 commit comments

Comments
 (0)