Skip to content

Commit 6ab0aae

Browse files
committed
add cis tags for control 1.1 to 2.16
Signed-off-by: Patrick Münch <patrick.muench1111@gmail.com>
1 parent 78a5119 commit 6ab0aae

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

controls/docker_host_os_level1.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
title 'Create a separate partition for containers'
4444
desc 'All Docker containers and their data and metadata is stored under /var/lib/docker directory. By default, /var/lib/docker would be mounted under / or /var partitions based on availability.'
4545
tag 'host'
46+
tag cis: '1.1'
4647
ref 'Docker storage recommendation', url: 'http://www.projectatomic.io/docs/docker-storage-recommendation/'
4748

4849
describe mount('/var/lib/docker') do
@@ -55,6 +56,7 @@
5556
title 'Use the updated Linux Kernel'
5657
desc 'Docker in daemon mode has specific kernel requirements. A 3.10 Linux kernel is the minimum requirement for Docker.'
5758
tag 'host'
59+
tag cis: '1.2'
5860
ref 'Check kernel dependencies', url: 'https://docs.docker.com/engine/installation/binaries/#check-kernel-dependencies'
5961
ref 'Installation list', url: 'https://docs.docker.com/engine/installation/#installation-list'
6062

@@ -71,6 +73,7 @@
7173
title 'Harden the container host'
7274
desc 'Containers run on a Linux host. A container host can run one or more containers. It is of utmost importance to harden the host to mitigate host security misconfiguration'
7375
tag 'host'
76+
tag cis: '1.3'
7477
ref 'Hardening Framework dev-sec.io', url: 'http://dev-sec.io'
7578
ref 'Docker security article', url: 'https://docs.docker.com/engine/security/security/'
7679
ref 'CIS Benchmarks', url: 'https://benchmarks.cisecurity.org/downloads/multiform/index.cfm'
@@ -85,6 +88,7 @@
8588
title 'Remove all non-essential services from the host'
8689
desc 'Ensure that the host running the docker daemon is running only the essential services.'
8790
tag 'host'
91+
tag cis: '1.4'
8892
ref 'Containers & Docker: How Secure Are They?', url: 'https://blog.docker.com/2013/08/containers-docker-how-secure-are-they/'
8993
end
9094

@@ -93,6 +97,7 @@
9397
title 'Keep Docker up to date'
9498
desc 'The docker container solution is evolving to maturity and stability at a rapid pace. Like any other software, the vendor releases regular updates for Docker software that address security vulnerabilities, product bugs and bring in new functionality.'
9599
tag 'host'
100+
tag cis: '1.5'
96101
ref 'Docker installation', url: 'https://docs.docker.com/installation/'
97102
ref 'Docker releases', url: 'https://github.com/docker/docker/releases/latest'
98103

@@ -116,6 +121,7 @@
116121
title 'Only allow trusted users to control Docker daemon'
117122
desc 'The Docker daemon currently requires \'root\' privileges. A user added to the \'docker\' group gives him full \'root\' access rights'
118123
tag 'host'
124+
tag cis: '1.6'
119125
ref 'On Docker security: docker group considered harmful', url: 'https://www.andreas-jung.com/contents/on-docker-security-docker-group-considered-harmful'
120126
ref 'Why we do not let non-root users run Docker in CentOS, Fedora, or RHEL', url: 'http://www.projectatomic.io/blog/2015/08/why-we-dont-let-non-root-users-run-docker-in-centos-fedora-or-rhel/'
121127

@@ -133,6 +139,7 @@
133139
title 'Audit docker daemon'
134140
desc 'Apart from auditing your regular Linux file system and system calls, audit Docker daemon as well. Docker daemon runs with \'root\' privileges. It is thus necessary to audit its activities and usage.'
135141
tag 'host'
142+
tag cis: '1.7'
136143
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
137144

138145
describe auditd_rules do
@@ -150,6 +157,7 @@
150157
title 'Audit Docker files and directories - /var/lib/docker'
151158
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. /var/lib/docker is one such directory. It holds all the information about containers. It must be audited.'
152159
tag 'host'
160+
tag cis: '1.8'
153161
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
154162

155163
describe auditd_rules do
@@ -162,6 +170,7 @@
162170
title 'Audit Docker files and directories - /etc/docker'
163171
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. /etc/docker is one such directory. It holds various certificates and keys used for TLS communication between Docker daemon and Docker client. It must be audited.'
164172
tag 'host'
173+
tag cis: '1.9'
165174
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
166175

167176
describe auditd_rules do
@@ -174,6 +183,7 @@
174183
title 'Audit Docker files and directories - docker.service'
175184
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. docker.service is one such file. The docker.service file might be present if the daemon parameters have been changed by an administrator. It holds various parameters for Docker daemon. It must be audited, if applicable.'
176185
tag 'host'
186+
tag cis: '1.10'
177187
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
178188

179189
if docker.path
@@ -193,6 +203,7 @@
193203
title 'Audit Docker files and directories - docker.socket'
194204
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. docker.socket is one such file. It holds various parameters for Docker daemon socket. It must be audited, if applicable.'
195205
tag 'host'
206+
tag cis: '1.11'
196207
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
197208

198209
if docker.socket
@@ -212,6 +223,7 @@
212223
title 'Audit Docker files and directories - /etc/default/docker'
213224
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. /etc/default/docker is one such file. It holds various parameters for Docker daemon. It must be audited, if applicable.'
214225
tag 'host'
226+
tag cis: '1.12'
215227
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
216228

217229
only_if { os[:family] != 'centos' }
@@ -225,6 +237,7 @@
225237
title 'Audit Docker files and directories - /etc/docker/daemon.json'
226238
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. /etc/docker/daemon.json is one such file. It holds various parameters for Docker daemon. It must be audited, if applicable.'
227239
tag 'host'
240+
tag cis: '1.13'
228241
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
229242
ref 'Daemon configuration', url: 'https://docs.docker.com/engine/reference/commandline/daemon/#daemon-configuration-file'
230243

@@ -238,6 +251,7 @@
238251
title 'Audit Docker files and directories - /usr/bin/docker-containerd'
239252
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. /usr/bin/docker-containerd is one such file. Docker now relies on containerd and runC to spawn containers. It must be audited, if applicable.'
240253
tag 'host'
254+
tag cis: '1.14'
241255
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
242256
ref 'Containerd integration', url: 'https://github.com/docker/docker/pull/20662'
243257
ref 'Containerd tools', url: 'https://containerd.tools/'
@@ -252,6 +266,7 @@
252266
title 'Audit Docker files and directories - /usr/bin/docker-runc'
253267
desc 'Apart from auditing your regular Linux file system and system calls, audit all Docker related files and directories. Docker daemon runs with \'root\' privileges. Its behavior depends on some key files and directories. /usr/bin/docker-runc is one such file. Docker now relies on containerd and runC to spawn containers. It must be audited, if applicable.'
254268
tag 'host'
269+
tag cis: '1.15'
255270
ref 'System auditing', url: 'https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-system_auditing.html'
256271
ref 'Containerd integration', url: 'https://github.com/docker/docker/pull/20662'
257272
ref 'Containerd tools', url: 'https://containerd.tools/'

controls/docker_level1.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
title 'Restrict network traffic between containers'
8080
desc 'By default, all network traffic is allowed between containers on the same host. If not desired, restrict all the intercontainer communication. Link specific containers together that require inter communication.'
8181
tag 'daemon'
82+
tag cis: '2.1'
8283
ref 'Docker container networking', url: 'https://docs.docker.com/engine/userguide/networking/'
8384

8485
describe json('/etc/docker/daemon.json') do
@@ -91,6 +92,7 @@
9192
title 'Set the logging level'
9293
desc 'Setting up an appropriate log level, configures the Docker daemon to log events that you would want to review later. A ase log level of \'info\' and above would capture all logs except debug logs. Until and unless required, you should not run docker daemon at \'debug\' log level.'
9394
tag 'daemon'
95+
tag cis: '2.2'
9496
ref 'Docker daemon', url: 'https://docs.docker.com/engine/reference/commandline/daemon/'
9597

9698
describe json('/etc/docker/daemon.json') do
@@ -103,6 +105,7 @@
103105
title 'Allow Docker to make changes to iptables'
104106
desc 'Iptables are used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. Allow the Docker daemon to make changes to the iptables.'
105107
tag 'daemon'
108+
tag cis: '2.3'
106109
ref 'https://docs.docker.com/v1.8/articles/networking/'
107110

108111
describe json('/etc/docker/daemon.json') do
@@ -115,6 +118,7 @@
115118
title 'Do not use insecure registries'
116119
desc 'Docker considers a private registry either secure or insecure. By default, registries are considered secure.'
117120
tag 'daemon'
121+
tag cis: '2.4'
118122
ref 'Insecure registry', url: 'https://docs.docker.com/registry/insecure/'
119123

120124
describe json('/etc/docker/daemon.json') do
@@ -127,6 +131,7 @@
127131
title 'Do not use the aufs storage driver'
128132
desc 'The \'aufs\' storage driver is the oldest storage driver. It is based on a Linux kernel patch-set that is unlikely to be merged into the main Linux kernel. \'aufs\' driver is also known to cause some serious kernel crashes. \'aufs\' just has legacy support from Docker. Most importantly, \'aufs\' is not a supported driver in many Linux distributions using latest Linux kernels.'
129133
tag 'daemon'
134+
tag cis: '2.5'
130135
ref 'Docker daemon storage driver options', url: 'https://docs.docker.com/engine/reference/commandline/cli/#daemon-storage-driver-option'
131136
ref 'permission denied if chown after chmod', url: 'https://github.com/docker/docker/issues/6047'
132137
ref 'Switch from aufs to devicemapper', url: 'http://muehe.org/posts/switching-docker-from-aufs-to-devicemapper/'
@@ -142,6 +147,7 @@
142147
title 'Configure TLS authentication for Docker daemon'
143148
desc 'It is possible to make the Docker daemon to listen on a specific IP and port and any other Unix socket other than default Unix socket. Configure TLS authentication to restrict access to Docker daemon via IP and port.'
144149
tag 'daemon'
150+
tag cis: '2.6'
145151
ref 'Protect Docker deamon socket', url: 'https://docs.docker.com/engine/security/https/'
146152

147153
describe json('/etc/docker/daemon.json') do
@@ -166,6 +172,7 @@
166172
title 'Set default ulimit as appropriate'
167173
desc 'ulimit provides control over the resources available to the shell and to processes started by it. Setting system resource limits judiciously saves you from many disasters such as a fork bomb. Sometimes, even friendly users and legitimate processes can overuse system resources and in-turn can make the system unusable.'
168174
tag 'daemon'
175+
tag cis: '2.7'
169176
ref 'Docker daemon deafult ulimits', url: 'https://docs.docker.com/engine/reference/commandline/daemon/#default-ulimits'
170177

171178
describe json('/etc/docker/daemon.json') do

controls/docker_level2.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
title 'Enable user namespace support'
6363
desc 'Enable user namespace support in Docker daemon to utilize container user to host user re-mapping. This recommendation is beneficial where containers you are using do not have an explicit container user defined in the container image. If container images that you are using have a pre-defined non-root user, this recommendation may be skipped since this feature is still in its infancy and might give you unpredictable issues and complexities.'
6464
tag 'daemon'
65+
tag cis: '2.8'
6566
ref 'User namespeces', url: 'http://man7.org/linux/man-pages/man7/user_namespaces.7.html'
6667
ref 'Docker daemon configuration', url: 'https://docs.docker.com/engine/reference/commandline/daemon/'
6768
ref 'Routing out root: user namespaces in docker', url: 'http://events.linuxfoundation.org/sites/events/files/slides/User%20Namespaces%20-%20ContainerCon%202015%20-%2016-9-final_0.pdf'
@@ -85,6 +86,7 @@
8586
title 'Confirm default cgroup usage'
8687
desc 'The --cgroup-parent option allows you to set the default cgroup parent to use for all the containers. If there is no specific use case, this setting should be left at its default.'
8788
tag 'daemon'
89+
tag cis: '2.9'
8890
ref 'Docker daemon configuration', url: 'https://docs.docker.com/engine/reference/commandline/daemon/'
8991

9092
describe json('/etc/docker/daemon.json') do
@@ -97,6 +99,7 @@
9799
title 'Do not change base device size until needed'
98100
desc 'In certain circumstances, you might need containers bigger than 10G in size. In these cases, carefully choose the base device size.'
99101
tag 'daemon'
102+
tag cis: '2.10'
100103
ref 'Docker daemon storage driver options', url: 'https://docs.docker.com/engine/reference/commandline/daemon/#storage-driver-options'
101104

102105
describe json('/etc/docker/daemon.json') do
@@ -109,6 +112,7 @@
109112
title 'Use authorization plugin'
110113
desc 'Docker’s out-of-the-box authorization model is all or nothing. Any user with permission to access the Docker daemon can run any Docker client command. The same is true for callers using Docker’s remote API to contact the daemon. If you require greater access control, you can create authorization plugins and add them to your Docker daemon configuration. Using an authorization plugin, a Docker administrator can configure granular access policies for managing access to Docker daemon.'
111114
tag 'daemon'
115+
tag cis: '2.11'
112116
ref 'Access authorization', url: 'https://docs.docker.com/engine/reference/commandline/daemon/#access-authorization'
113117
ref 'Auhtorization plugins', url: 'https://docs.docker.com/engine/extend/plugins_authorization/'
114118
ref 'Twistlock authorization plugin', url: 'https://github.com/twistlock/authz'
@@ -126,6 +130,7 @@
126130
title 'Configure centralized and remote logging'
127131
desc 'Docker now supports various log drivers. A preferable way to store logs is the one that supports centralized and remote logging.'
128132
tag 'daemon'
133+
tag cis: '2.12'
129134
ref 'Logging overview', url: 'https://docs.docker.com/engine/admin/logging/overview/'
130135

131136
describe json('/etc/docker/daemon.json') do
@@ -144,6 +149,7 @@
144149
title 'Disable operations on legacy registry (v1)'
145150
desc 'The latest Docker registry is v2. All operations on the legacy registry version (v1) should be restricted.'
146151
tag 'daemon'
152+
tag cis: '2.13'
147153
ref 'Docker daemon storage driver options', url: 'https://docs.docker.com/engine/reference/commandline/daemon/#storage-driver-options'
148154
ref 'Proposal: Provenance step 1 - Transform images for validation and verification', url: 'https://github.com/docker/docker/issues/8093'
149155
ref 'Proposal: JSON Registry API V2.1', url: 'https://github.com/docker/docker/issues/9015'
@@ -163,6 +169,7 @@
163169
title 'Enable live restore'
164170
desc 'The \'--live-restore\' enables full support of daemon-less containers in docker. It ensures that docker does not stop containers on shutdown or restore and properly reconnects to the container when restarted.'
165171
tag 'daemon'
172+
tag cis: '2.14'
166173
ref 'Add --live-restore flag', url: 'https://github.com/docker/docker/pull/23213'
167174

168175
describe json('/etc/docker/daemon.json') do
@@ -175,6 +182,20 @@
175182
title 'Do not enable swarm mode, if not needed'
176183
desc 'Do not enable swarm mode on a docker engine instance unless needed.'
177184
tag 'daemon'
185+
tag cis: '2.15'
186+
ref 'docker swarm init', url: 'https://docs.docker.com/engine/reference/commandline/swarm_init/'
187+
188+
describe command('docker info') do
189+
its('stdout') { should include 'Swarm: inactive' }
190+
end
191+
end
192+
193+
control 'cis-docker-benchmark-2.16' do
194+
impact 1.0
195+
title 'Control the number of manager nodes in a swarm'
196+
desc 'Ensure that the minimum number of required manager nodes is created in a swarm.'
197+
tag 'daemon'
198+
tag cis: '2.16'
178199
ref 'docker swarm init', url: 'https://docs.docker.com/engine/reference/commandline/swarm_init/'
179200

180201
describe command('docker info') do

0 commit comments

Comments
 (0)