CIS Docker Benchmark v1.5.0 PDF
CIS Docker Benchmark v1.5.0 PDF
v1.5.0 - 12-28-2022
Terms of Use
Please see the below link for our current terms of use:
https://www.cisecurity.org/cis-securesuite/cis-securesuite-membership-terms-of-use/
Page 1
Table of Contents
Terms of Use .................................................................................................................. 1
Table of Contents ........................................................................................................... 2
Overview ......................................................................................................................... 6
Intended Audience ................................................................................................................... 6
Consensus Guidance .............................................................................................................. 7
Typographical Conventions .................................................................................................... 8
Recommendation Definitions ....................................................................................... 9
Title ............................................................................................................................................ 9
Assessment Status .................................................................................................................. 9
Automated ............................................................................................................................................. 9
Manual .................................................................................................................................................... 9
Profile ........................................................................................................................................ 9
Description ............................................................................................................................... 9
Rationale Statement................................................................................................................. 9
Impact Statement ................................................................................................................... 10
Audit Procedure ..................................................................................................................... 10
Remediation Procedure ......................................................................................................... 10
Default Value .......................................................................................................................... 10
References .............................................................................................................................. 10
CIS Critical Security Controls® (CIS Controls®) .................................................................. 10
Additional Information ........................................................................................................... 10
Profile Definitions .................................................................................................................. 11
Acknowledgements ............................................................................................................... 12
Recommendations ....................................................................................................... 13
1 Host Configuration.............................................................................................................. 13
1.1 Linux Hosts Specific Configuration ............................................................................................ 14
1.1.1 Ensure a separate partition for containers has been created (Automated) ........................................ 15
1.1.2 Ensure only trusted users are allowed to control Docker daemon (Automated) ................................ 17
1.1.3 Ensure auditing is configured for the Docker daemon (Automated) ................................................... 19
1.1.4 Ensure auditing is configured for Docker files and directories - /run/containerd (Automated)............ 21
1.1.5 Ensure auditing is configured for Docker files and directories - /var/lib/docker (Automated) ............. 23
1.1.6 Ensure auditing is configured for Docker files and directories - /etc/docker (Automated) .................. 25
1.1.7 Ensure auditing is configured for Docker files and directories - docker.service (Automated) ............ 27
1.1.8 Ensure auditing is configured for Docker files and directories - containerd.sock (Automated) .......... 29
1.1.9 Ensure auditing is configured for Docker files and directories - docker.socket (Automated) ............. 31
1.1.10 Ensure auditing is configured for Docker files and directories - /etc/default/docker (Automated) .... 33
Page 2
1.1.11 Ensure auditing is configured for Docker files and directories - /etc/docker/daemon.json
(Automated) ................................................................................................................................................. 35
1.1.12 Ensure auditing is configured for Docker files and directories - /etc/containerd/config.toml
(Automated) ................................................................................................................................................. 37
1.1.13 Ensure auditing is configured for Docker files and directories - /etc/sysconfig/docker (Automated) 39
1.1.14 Ensure auditing is configured for Docker files and directories - /usr/bin/containerd (Automated) .... 41
1.1.15 Ensure auditing is configured for Docker files and directories - /usr/bin/containerd-shim (Automated)
..................................................................................................................................................................... 43
1.1.16 Ensure auditing is configured for Docker files and directories - /usr/bin/containerd-shim-runc-v1
(Automated) ................................................................................................................................................. 45
1.1.17 Ensure auditing is configured for Docker files and directories - /usr/bin/containerd-shim-runc-v2
(Automated) ................................................................................................................................................. 47
1.1.18 Ensure auditing is configured for Docker files and directories - /usr/bin/runc (Automated) .............. 49
1.2 General Configuration .................................................................................................................. 51
1.2.1 Ensure the container host has been Hardened (Manual) ................................................................... 52
1.2.2 Ensure that the version of Docker is up to date (Manual) .................................................................. 54
2 Docker daemon configuration ........................................................................................... 56
2.1 Run the Docker daemon as a non-root user, if possible (Manual) ........................................................ 57
2.2 Ensure network traffic is restricted between containers on the default bridge (Automated).................. 59
2.3 Ensure the logging level is set to 'info' (Automated) .............................................................................. 61
2.4 Ensure Docker is allowed to make changes to iptables (Automated) ................................................... 63
2.5 Ensure insecure registries are not used (Automated) ........................................................................... 65
2.6 Ensure aufs storage driver is not used (Automated) ............................................................................. 67
2.7 Ensure TLS authentication for Docker daemon is configured (Automated) .......................................... 69
2.8 Ensure the default ulimit is configured appropriately (Manual).............................................................. 71
2.9 Enable user namespace support (Automated) ...................................................................................... 73
2.10 Ensure the default cgroup usage has been confirmed (Automated) ................................................... 75
2.11 Ensure base device size is not changed until needed (Automated) .................................................... 77
2.12 Ensure that authorization for Docker client commands is enabled (Automated) ................................. 79
2.13 Ensure centralized and remote logging is configured (Automated) ..................................................... 81
2.14 Ensure containers are restricted from acquiring new privileges (Automated) ..................................... 83
2.15 Ensure live restore is enabled (Automated) ........................................................................................ 85
2.16 Ensure Userland Proxy is Disabled (Automated) ................................................................................ 87
2.17 Ensure that a daemon-wide custom seccomp profile is applied if appropriate (Manual) .................... 89
2.18 Ensure that experimental features are not implemented in production (Automated) .......................... 91
3 Docker daemon configuration files ................................................................................... 93
3.1 Ensure that the docker.service file ownership is set to root:root (Automated) ...................................... 94
3.2 Ensure that docker.service file permissions are appropriately set (Automated).................................... 96
3.3 Ensure that docker.socket file ownership is set to root:root (Automated) ............................................. 98
3.4 Ensure that docker.socket file permissions are set to 644 or more restrictive (Automated)................ 100
3.5 Ensure that the /etc/docker directory ownership is set to root:root (Automated) ................................. 102
3.6 Ensure that /etc/docker directory permissions are set to 755 or more restrictively (Automated) ........ 104
3.7 Ensure that registry certificate file ownership is set to root:root (Automated) ..................................... 106
3.8 Ensure that registry certificate file permissions are set to 444 or more restrictively (Automated) ....... 108
3.9 Ensure that TLS CA certificate file ownership is set to root:root (Automated)..................................... 110
3.10 Ensure that TLS CA certificate file permissions are set to 444 or more restrictively (Automated) .... 112
3.11 Ensure that Docker server certificate file ownership is set to root:root (Automated) ......................... 114
3.12 Ensure that the Docker server certificate file permissions are set to 444 or more restrictively
(Automated) ............................................................................................................................................... 116
3.13 Ensure that the Docker server certificate key file ownership is set to root:root (Automated) ............ 118
3.14 Ensure that the Docker server certificate key file permissions are set to 400 (Automated) .............. 120
3.15 Ensure that the Docker socket file ownership is set to root:docker (Automated) .............................. 122
Page 3
3.16 Ensure that the Docker socket file permissions are set to 660 or more restrictively (Automated) .... 124
3.17 Ensure that the daemon.json file ownership is set to root:root (Automated) ..................................... 126
3.18 Ensure that daemon.json file permissions are set to 644 or more restrictive (Automated) ............... 128
3.19 Ensure that the /etc/default/docker file ownership is set to root:root (Automated) ............................ 130
3.20 Ensure that the /etc/default/docker file permissions are set to 644 or more restrictively (Automated)
................................................................................................................................................................... 132
3.21 Ensure that the /etc/sysconfig/docker file permissions are set to 644 or more restrictively (Automated)
................................................................................................................................................................... 134
3.22 Ensure that the /etc/sysconfig/docker file ownership is set to root:root (Automated) ........................ 136
3.23 Ensure that the Containerd socket file ownership is set to root:root (Automated)............................. 138
3.24 Ensure that the Containerd socket file permissions are set to 660 or more restrictively (Automated)
................................................................................................................................................................... 140
4 Container Images and Build File Configuration ............................................................. 142
4.1 Ensure that a user for the container has been created (Automated)................................................... 143
4.2 Ensure that containers use only trusted base images (Manual).......................................................... 145
4.3 Ensure that unnecessary packages are not installed in the container (Manual) ................................. 147
4.4 Ensure images are scanned and rebuilt to include security patches (Manual) ................................... 149
4.5 Ensure Content trust for Docker is Enabled (Automated) ................................................................... 151
4.6 Ensure that HEALTHCHECK instructions have been added to container images (Automated) ......... 153
4.7 Ensure update instructions are not used alone in Dockerfiles (Manual) ............................................. 155
4.8 Ensure setuid and setgid permissions are removed (Manual) ............................................................ 157
4.9 Ensure that COPY is used instead of ADD in Dockerfiles (Manual).................................................... 159
4.10 Ensure secrets are not stored in Dockerfiles (Manual)...................................................................... 161
4.11 Ensure only verified packages are installed (Manual) ....................................................................... 163
4.12 Ensure all signed artifacts are validated (Manual)............................................................................. 165
Page 4
5.27 Ensure that Docker commands always make use of the latest version of their image (Manual) ...... 221
5.28 Ensure that the PIDs cgroup limit is used (Automated) ..................................................................... 223
5.29 Ensure that Docker's default bridge "docker0" is not used (Manual)................................................. 225
5.30 Ensure that the host's user namespaces are not shared (Automated) ............................................. 227
5.31 Ensure that the Docker socket is not mounted inside any containers (Automated) .......................... 229
6 Docker Security Operations ............................................................................................. 231
6.1 Ensure that image sprawl is avoided (Manual).................................................................................... 232
6.2 Ensure that container sprawl is avoided (Manual)............................................................................... 234
Page 5
Overview
All CIS Benchmarks focus on technical configuration settings used to maintain and/or
increase the security of the addressed technology, and they should be used in
conjunction with other essential cyber hygiene tasks like:
• Monitoring the base operating system for vulnerabilities and quickly updating with
the latest security patches
• Monitoring applications and libraries for vulnerabilities and quickly updating with
the latest security patches
In the end, the CIS Benchmarks are designed as a key component of a comprehensive
cybersecurity program.
This document, CIS Docker Benchmark, provides prescriptive guidance for establishing
a secure configuration posture for Docker Engine v20.10. This guide was tested against
Docker Engine 20.10.20 on RHEL 7 and Ubuntu 20.04. To obtain the latest version of
this guide, please visit http://benchmarks.cisecurity.org. If you have questions,
comments, or have identified ways to improve this guide, please write us at
[email protected].
Intended Audience
This document is intended for system and application administrators, security
specialists, auditors, help desk, and platform deployment personnel who plan to
develop, deploy, assess, or secure solutions that incorporate Docker Engine 20.10 or
later technology on Linux based platforms.
Page 6
Consensus Guidance
This CIS Benchmark was created using a consensus review process comprised of a
global community of subject matter experts. The process combines real world
experience with data-based information to create technology specific guidance to assist
users to secure their environments. Consensus participants provide perspective from a
diverse set of backgrounds including consulting, software development, audit and
compliance, security research, operations, government, and legal.
Each CIS Benchmark undergoes two phases of consensus review. The first phase
occurs during initial Benchmark development. During this phase, subject matter experts
convene to discuss, create, and test working drafts of the Benchmark. This discussion
occurs until consensus has been reached on Benchmark recommendations. The
second phase begins after the Benchmark has been published. During this phase, all
feedback provided by the Internet community is reviewed by the consensus team for
incorporation in the Benchmark. If you are interested in participating in the consensus
process, please visit https://workbench.cisecurity.org/.
Page 7
Typographical Conventions
The following typographical conventions are used throughout this guide:
Convention Meaning
Page 8
Recommendation Definitions
The following defines the various components included in a CIS recommendation as
applicable. If any of the components are not applicable it will be noted or the
component will not be included in the recommendation.
Title
Concise description for the recommendation's intended configuration.
Assessment Status
An assessment status is included for every recommendation. The assessment status
indicates whether the given recommendation can be automated or requires manual
steps to implement. Both statuses are equally important and are determined and
supported as defined below:
Automated
Represents recommendations for which assessment of a technical control can be fully
automated and validated to a pass/fail state. Recommendations will include the
necessary information to implement automation.
Manual
Represents recommendations for which assessment of a technical control cannot be
fully automated and requires all or some manual steps to validate that the configured
state is set as expected. The expected state can vary depending on the environment.
Profile
A collection of recommendations for securing a technology or a supporting platform.
Most benchmarks include at least a Level 1 and Level 2 Profile. Level 2 extends Level 1
recommendations and is not a standalone profile. The Profile Definitions section in the
benchmark provides the definitions as they pertain to the recommendations included for
the technology.
Description
Detailed information pertaining to the setting with which the recommendation is
concerned. In some cases, the description will include the recommended value.
Rationale Statement
Detailed reasoning for the recommendation to provide the user a clear and concise
understanding on the importance of the recommendation.
Page 9
Impact Statement
Any security, functionality, or operational consequences that can result from following
the recommendation.
Audit Procedure
Systematic instructions for determining if the target system complies with the
recommendation
Remediation Procedure
Systematic instructions for applying recommendations to the target system to bring it
into compliance according to the recommendation.
Default Value
Default value for the given setting in this recommendation, if known. If not known, either
not configured or not defined will be applied.
References
Additional documentation relative to the recommendation.
Additional Information
Supplementary information that does not correspond to any other field but may be
useful to the user.
Page 10
Profile Definitions
The following configuration profiles are defined by this Benchmark:
Items in this profile pertain to the Linux Host OS and intend to:
Page 11
Acknowledgements
This Benchmark exemplifies the great things a community of users, vendors, and
subject matter experts can accomplish through consensus collaboration. The CIS
community thanks the entire consensus team with special recognition to the following
individuals who contributed greatly to the creation of this guide:
Author
Pravin Goyal
Editor
Randall Mowen
Contributor/s
Thomas Sjögren
Jordan Rakoske GSEC, GCWN
Rory Mccune
Brian Andrzejewski
Andrew Weiss
Ryan Puffer
Marion McCune
Joshua Lochner
Thanks to the Community for all the individual contributions and consensus review.
Page 12
Recommendations
1 Host Configuration
This section covers security recommendations that you should follow to prepare the
host machine that you plan to use for executing containerized workloads. Securing the
Docker host and following your infrastructure security best practices would build a solid
and secure foundation for executing containerized workloads.
Page 13
1.1 Linux Hosts Specific Configuration
This section contains recommendations that securing Linux Hosts running Docker
Containers.
Page 14
1.1.1 Ensure a separate partition for containers has been created
(Automated)
Profile Applicability:
1. https://www.projectatomic.io/docs/docker-storage-recommendation/
2. https://docs.docker.com/storage/
Page 15
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 16
1.1.2 Ensure only trusted users are allowed to control Docker
daemon (Automated)
Profile Applicability:
Impact:
Provided the proceeding instructions are implemented, rights to build and execute
containers as normal user would be restricted.
Audit:
Execute the following command on the docker host and ensure that only trusted users
are members of the docker group.
getent group docker
Remediation:
You should remove any untrusted users from the docker group. Additionally, you should
not create a mapping of sensitive directories from the host to container volumes.
Default Value:
Not Applicable
References:
1. https://docs.docker.com/engine/security/#docker-daemon-attack-surface
2. http://www.projectatomic.io/blog/2015/08/why-we-dont-let-non-root-users-run-
docker-in-centos-fedora-or-rhel/
Page 17
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 18
1.1.3 Ensure auditing is configured for the Docker daemon
(Automated)
Profile Applicability:
As well as auditing the normal Linux file system and system calls, you should also audit
the Docker daemon. Because this daemon runs with root privileges. It is very important
to audit its activities and usage.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
Verify that there are audit rules for the Docker daemon. For example, you could execute
the following command:
auditctl -l | grep /usr/bin/dockerd
This should show the rules associated with the Docker daemon.
Remediation:
You should add rules for the Docker daemon.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/bin/dockerd -k docker
Then, restart the audit daemon using the following command
systemctl restart auditd
Default Value:
By default, the Docker daemon is not audited.
Page 19
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 20
1.1.4 Ensure auditing is configured for Docker files and directories
- /run/containerd (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
all Docker related files and directories. The Docker daemon runs with root privileges
and its behavior depends on some key files and directories. /run/containerd is one
such directory. As it holds all the information about containers it should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule applied to the /run/containerd directory.
For example, you could execute the command below:
auditctl -l | grep /run/containerd
This should list a rule for the /run/containerd directory.
Remediation:
You should add a rule for the /run/containerd directory.
For example,
Add the line as below to the /etc/audit/audit.rules file:
-a exit,always -F path=/run/containerd -F perm=war -k docker
Then, restart the audit daemon using the following command
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited.
Page 21
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 22
1.1.5 Ensure auditing is configured for Docker files and directories
- /var/lib/docker (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
all Docker related files and directories. The Docker daemon runs with root privileges
and its behavior depends on some key files and directories. /var/lib/docker is one
such directory. As it holds all the information about containers it should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule applied to the /var/lib/docker directory.
For example, you could execute the command below:
auditctl -l | grep /var/lib/docker
This should list a rule for the /var/lib/docker directory.
Remediation:
You should add a rule for the /var/lib/docker directory.
For example,
Add the line as below to the /etc/audit/audit.rules file:
-a exit,always -F path=/var/lib/docker -F perm=war -k docker
Then, restart the audit daemon using the following command
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited.
Page 23
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 24
1.1.6 Ensure auditing is configured for Docker files and directories
- /etc/docker (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
all Docker related files and directories. The Docker daemon runs with root privilege and
its behavior depends on some key files and directories, one of these being /etc/docker.
This holds various certificates and keys used for TLS communication between Docker
daemon and Docker client and as such it should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule applied to the /etc/docker directory.
For example, you could execute the command below:
auditctl -l | grep /etc/docker
This should display a rule for the /etc/docker directory.
Remediation:
You should add a rule for the /etc/docker directory.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /etc/docker -k docker
Then restart the audit daemon. For example:
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited.
Page 25
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 26
1.1.7 Ensure auditing is configured for Docker files and directories
- docker.service (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
all Docker related files and directories. The Docker daemon runs with root privileges
and its behavior depends on some key files and directories with docker.service being
one such file. The docker.service file might be present if the daemon parameters have
been changed by an administrator. If so, it holds various parameters for the Docker
daemon and should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.service
Step 2: If the file does not exist, this recommendation does not apply. If the file does
exist, verify that there is an audit rule corresponding to the file:
For example, you could execute the command below:
auditctl -l | grep docker.service
This should display a rule for docker.service.
Remediation:
If the file exists, a rule for it should be added.
For example:
Add the line as below in /etc/audit/audit.rules file:
-w /usr/lib/systemd/system/docker.service -k docker
Then restart the audit daemon.
For example:
Page 27
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file docker.service
may not be present on the system.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 28
1.1.8 Ensure auditing is configured for Docker files and directories
- containerd.sock (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
the Docker daemon. Because this daemon runs with root privileges, it is very important
to audit its activities and usage. Its behavior depends on some key files and directories
with containerd.sock being one such file, and as this holds various parameters for the
Docker daemon, it should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
Step 1: Find out the file location:
grep 'containerd.sock' /etc/containerd/config.toml
or by checking the Docker --containerd option.
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
you should verify that there is an audit rule corresponding to the file:
For example, you could execute the command below:
auditctl -l | grep containerd.sock
This should display a rule for containerd.sock.
Remediation:
If the file exists, you should add a rule for it.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /run/containerd/containerd.sock -k docker
Then restart the audit daemon.
For example:
Page 29
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file containerd.sock
may not be present, but if it is, it should be audited.
References:
1. https://github.com/containerd/containerd/blob/master/docs/ops.md
2. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
3. https://docs.docker.com/engine/reference/commandline/dockerd/#docker-
runtime-execution-options
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 30
1.1.9 Ensure auditing is configured for Docker files and directories
- docker.socket (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
the Docker daemon. Because this daemon runs with root privileges, it is very important
to audit its activities and usage. Its behavior depends on some key files and directories
with docker.socket being one such file, and as this holds various parameters for the
Docker daemon, it should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
Step 1: Find out the configuration file location:
systemctl show -p FragmentPath docker.socket
Step 2: Locate the socket file location:
grep ListenStream <FragmentPath from previous step>
Step 3: If the file does not exist, this recommendation is not applicable. If the file exists,
you should verify that there is an audit rule corresponding to the file:
For example, you could execute the command below:
auditctl -l | grep docker.socket
This should display a rule for docker.socket.
Remediation:
If the file exists, you should add a rule for it.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /var/run/docker.sock -k docker
Then restart the audit daemon.
For example:
Page 31
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file docker.socket
may not be present, but if it is, it should be audited.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 32
1.1.10 Ensure auditing is configured for Docker files and
directories - /etc/default/docker (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should audit all
Docker related files and directories. The Docker daemon runs with root privileges and
its behavior depends on some key files and directories. /etc/default/docker is one
such file. It holds various parameters related to the Docker daemon and should
therefore be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule associated with the /etc/default/docker
file.
For example, you could execute the command below:
auditctl -l | grep /etc/default/docker
This should display a rule for the /etc/default/docker file.
Remediation:
You should add a rule for the /etc/default/docker file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /etc/default/docker -k docker
Then restart the audit daemon.
For example:
Page 33
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited so these defaults should
be changed in line with organizational security policy. The file /etc/default/docker
may not be present, and if so, this recommendation is not applicable.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 34
1.1.11 Ensure auditing is configured for Docker files and
directories - /etc/docker/daemon.json (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
all Docker related files and directories. The Docker daemon runs with root privileges
and its behavior depends on some key files and directories. /etc/docker/daemon.json
is one such file. This holds various parameters for the Docker daemon, and as such it
should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule associated with the
/etc/docker/daemon.json file.
For example, you could execute the command below:
auditctl -l | grep /etc/docker/daemon.json
This should display a rule for the /etc/docker/daemon.json file.
Remediation:
You should add a rule for the /etc/docker/daemon.json file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /etc/docker/daemon.json -k docker
Then restart the audit daemon.
For example:
Page 35
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file
/etc/docker/daemon.json may not exist on the system and in that case, this
recommendation is not applicable.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
2. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-
configuration-file
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 36
1.1.12 Ensure auditing is configured for Docker files and
directories - /etc/containerd/config.toml (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
the Docker daemon. Because this daemon runs with root privileges it is very important
to audit its activities and usage. Its behavior depends on some key files and directories
and /etc/containerd/config.toml is one such file as it contains various parameters. If
present, it is important that it is audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule present relating to the
/etc/containerd/config.toml file.
For example, you could execute the command below:
auditctl -l | grep /etc/containerd/config.toml
This should display a rule for /etc/containerd/config.toml file.
Remediation:
You should add a rule for /etc/containerd/config.toml file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /etc/containerd/config.toml -k docker
Then restart the audit daemon.
For example:
Page 37
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file
/etc/containerd/config.toml may not be present on the system and in that case, this
recommendation is not applicable.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 38
1.1.13 Ensure auditing is configured for Docker files and
directories - /etc/sysconfig/docker (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
the Docker daemon. Because this daemon runs with root privileges it is very important
to audit its activities and usage. Its behavior depends on some key files and directories
and /etc/sysconfig/docker is one such file as it contains various parameters related to
the Docker daemon when run on CentOS and RHEL based distributions. If present, it is
important that it is audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule present relating to the
/etc/sysconfig/docker file.
For example, you could execute the command below:
auditctl -l | grep /etc/sysconfig/docker
This should display a rule for /etc/sysconfig/docker file.
Remediation:
You should add a rule for /etc/sysconfig/docker file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /etc/sysconfig/docker -k docker
Then restart the audit daemon.
For example:
Page 39
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file
/etc/sysconfig/docker may not be present on the system and in that case, this
recommendation is not applicable.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 40
1.1.14 Ensure auditing is configured for Docker files and
directories - /usr/bin/containerd (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should audit all
Docker related files and directories. The Docker daemon runs with root privileges and
its behavior depends on some key files and directories. /usr/bin/containerd is one
such file and as such should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule corresponding to /usr/bin/containerd file.
For example, you could execute the command below:
auditctl -l | grep /usr/bin/containerd
This should display a rule for /usr/bin/containerd file.
Remediation:
You should add a rule for the /usr/bin/containerd file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/bin/containerd -k docker
Then restart the audit daemon.
For example:
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file
/usr/bin/containerd may not be present on the system and in that case, this
recommendation is not applicable.
Page 41
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
2. https://containerd.io/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 42
1.1.15 Ensure auditing is configured for Docker files and
directories - /usr/bin/containerd-shim (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should audit all
Docker related files and directories. The Docker daemon runs with root privileges and
its behavior depends on some key files and directories. /usr/bin/containerd-shim is
one such file and as such should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule corresponding to /usr/bin/containerd-shim
file.
For example, you could execute the command below:
auditctl -l | grep /usr/bin/containerd-shim
This should display a rule for /usr/bin/containerd-shim file.
Remediation:
You should add a rule for the /usr/bin/containerd-shim file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/bin/containerd-shim -k docker
Then restart the audit daemon.
For example:
Page 43
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file
/usr/bin/containerd-shim may not be present on the system and in that case, this
recommendation is not applicable.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
2. https://containerd.io/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 44
1.1.16 Ensure auditing is configured for Docker files and
directories - /usr/bin/containerd-shim-runc-v1 (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should audit all
Docker related files and directories. The Docker daemon runs with root privileges and
its behavior depends on some key files and directories. /usr/bin/containerd-shim-
runc-v1 is one such file and as such should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule corresponding to /usr/bin/containerd-
shim-runc-v1 file.
For example, you could execute the command below:
auditctl -l | grep /usr/bin/containerd-shim-runc-v1
This should display a rule for /usr/bin/containerd-shim-runc-v1 file.
Remediation:
You should add a rule for the /usr/bin/containerd-shim-runc-v1 file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/bin/containerd-shim-runc-v1 -k docker
Then restart the audit daemon.
For example:
Page 45
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file
/usr/bin/containerd-shim-runc-v1 may not be present on the system and in that case,
this recommendation is not applicable.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
2. https://containerd.io/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 46
1.1.17 Ensure auditing is configured for Docker files and
directories - /usr/bin/containerd-shim-runc-v2 (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should audit all
Docker related files and directories. The Docker daemon runs with root privileges and
its behavior depends on some key files and directories. /usr/bin/containerd-shim-
runc-v2 is one such file and as such should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule corresponding to /usr/bin/containerd-
shim-runc-v2 file.
For example, you could execute the command below:
auditctl -l | grep /usr/bin/containerd-shim-runc-v2
This should display a rule for /usr/bin/containerd-shim-runc-v2 file.
Remediation:
You should add a rule for the /usr/bin/containerd-shim-runc-v2 file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/bin/containerd-shim-runc-v2 -k docker
Then restart the audit daemon.
For example:
Page 47
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file
/usr/bin/containerd-shim-runc-v2 may not be present on the system and in that case,
this recommendation is not applicable.
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
2. https://containerd.io/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 48
1.1.18 Ensure auditing is configured for Docker files and
directories - /usr/bin/runc (Automated)
Profile Applicability:
Rationale:
As well as auditing the normal Linux file system and system calls, you should also audit
all Docker related files and directories. The Docker daemon runs with root privileges
and its behavior depends on some key files and directories. /usr/bin/runc is one such
file, and as such it should be audited.
Impact:
Auditing can generate large log files. You should ensure that these are rotated and
archived periodically. A separate partition should also be created for audit logs to avoid
filling up any other critical partition.
Audit:
You should verify that there is an audit rule corresponding to /usr/bin/runc file.
For example, you could execute the command below:
auditctl -l | grep /usr/bin/runc
This should display a rule for the /usr/bin/runc file.
Remediation:
You should add a rule for /usr/bin/runc file.
For example:
Add the line below to the /etc/audit/audit.rules file:
-w /usr/bin/runc -k docker
Then restart the audit daemon.
For example:
systemctl restart auditd
Default Value:
By default, Docker related files and directories are not audited. The file /usr/bin/runc
may not be present on the system and in that case this recommendation is not
applicable.
Page 49
References:
1. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux/8/html/system_design_guide/auditing-the-
system_system-design-guide
2. https://containerd.io
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 50
1.2 General Configuration
This section contains general host recommendations for systems running Docker
Page 51
1.2.1 Ensure the container host has been Hardened (Manual)
Profile Applicability:
1. https://docs.docker.com/engine/security/
2. https://www.cisecurity.org/cis-benchmarks/
Page 52
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 53
1.2.2 Ensure that the version of Docker is up to date (Manual)
Profile Applicability:
Remediation:
You should monitor versions of Docker releases and make sure your software is
updated as required.
Default Value:
Not Applicable
Page 54
References:
1. https://docs.docker.com/engine/install/
2. https://docs.docker.com/engine/release-notes/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 55
2 Docker daemon configuration
This section lists the recommendations that alter and secure the behavior of the Docker
daemon. The settings that are under this section affect ALL container instances.
Note: Docker daemon options, when running in the default root mode, can also be
controlled using files such as /etc/sysconfig/docker, /etc/default/docker, the
systemd unit file or /etc/docker/daemon.json. Also, note that Docker in daemon mode
can be identified as /usr/bin/dockerd, or having -d or daemon as the argument to
docker service.
Note: When running in rootless mode does change all configuration file locations and
has some known limitations regarding e.g privileged TCP/UDP ports and specific
prerequisites depending on which distribution that is used.
Page 56
2.1 Run the Docker daemon as a non-root user, if possible
(Manual)
Profile Applicability:
Remediation:
Follow the current Docker documentation on how to install the Docker daemon as a
non-root user.
Default Value:
The Docker daemon is running as the root user by default.
References:
1. https://docs.docker.com/engine/security/rootless/
Page 57
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 58
2.2 Ensure network traffic is restricted between containers on the
default bridge (Automated)
Profile Applicability:
Page 59
dockerd --icc=false
Alternatively, you can follow the Docker documentation and create a custom network
and only join containers that need to communicate to that custom network. The --icc
parameter only applies to the default docker bridge, if custom networks are used then
the approach of segmenting networks should be adopted instead.
In order for this control to be fully effective, all containers connected to the docker0
bridge should drop the NET_RAW capability, otherwise a compromised container could
use raw ethernet packets to communicate with other containers despite this restriction.
Default Value:
By default, all inter-container communication is allowed on the default network bridge.
References:
1. https://docs.docker.com/network/
2. https://github.com/docker/cli/blob/v20.10.1/man/dockerd.8.md
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 60
2.3 Ensure the logging level is set to 'info' (Automated)
Profile Applicability:
Rationale:
Setting up an appropriate log level, configures the Docker daemon to log events that
you would want to review later. A base 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.
Impact:
None.
Audit:
To confirm this setting a combination of reviewing the dockerd start-up options and a
review of any settings in /etc/docker/daemon.json should be completed.
To review the dockerd startup options, use:
ps -ef | grep dockerd
Ensure that either the --log-level parameter is not present or if present, then it is set
to info.
The contents of /etc/docker/daemon.json should also be reviewed for this setting.
Remediation:
Ensure that the Docker daemon configuration file has the following configuration
included
"log-level": "info"
Alternatively, run the Docker daemon as below:
dockerd --log-level="info"
Default Value:
By default, Docker daemon is set to log level of info.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/
Page 61
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 62
2.4 Ensure Docker is allowed to make changes to iptables
(Automated)
Profile Applicability:
Rationale:
Docker will never make changes to your system iptables rules unless you allow it to
do so. If you do allow this, Docker server will automatically make any required changes.
We recommended letting Docker make changes to iptables automatically in order to
avoid networking misconfigurations that could affect the communication between
containers and with the outside world. Additionally, this reduces the administrative
overhead of updating iptables every time you add containers or modify networking
options.
Impact:
The Docker daemon service requires iptables rules to be enabled before it starts. Any
restarts of iptables during Docker daemon operation may result in losing Docker created
rules. Adding iptables-persistent to your iptables install can assist with mitigation of this
impact.
Audit:
To confirm this setting you should review the dockerd start-up options and the settings
in /etc/docker/daemon.json
To review the dockerd startup options, use:
ps -ef | grep dockerd
Ensure that the --iptables parameter is either not present or not set to false.
The contents of /etc/docker/daemon.json should also be reviewed for this setting.
Remediation:
Do not run the Docker daemon with --iptables=false parameter. For example, do not
start the Docker daemon as below:
Page 63
dockerd --iptables=false
Default Value:
By default, iptables is set to true.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/
2. https://docs.docker.com/network/iptables/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 64
2.5 Ensure insecure registries are not used (Automated)
Profile Applicability:
Remediation:
You should ensure that no insecure registries are in use.
Default Value:
By default, Docker assumes all, but local, registries are secure.
References:
1. https://docs.docker.com/registry/insecure/
Page 65
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 66
2.6 Ensure aufs storage driver is not used (Automated)
Profile Applicability:
Rationale:
The aufs storage driver is the oldest storage driver used on Linux systems. It is based
on a Linux kernel patch-set that is unlikely in future to be merged into the main OS
kernel. The aufs driver is also known to cause some serious kernel crashes. aufs only
has legacy support within systems using Docker.
Most importantly, aufs is not a supported driver in many Linux distributions using latest
Linux kernels and has also been deprecated with Docker Engine release 20.10.
Impact:
aufs is the only storage driver that allows containers to share executable and shared
library memory. It might be useful if you are running thousands of containers with the
same program or libraries, however its use should be reviewed in line with your
organization's security policy.
Audit:
Execute the below command and verify that aufs is not used as storage driver:
docker info --format 'Storage Driver: {{ .Driver }}'
The above command should not return aufs.
Remediation:
Do not explicitly use aufs as storage driver.
For example, do not start Docker daemon as below:
dockerd --storage-driver aufs
Default Value:
By default, Docker uses overlay2 as the storage driver on most of the platforms. The
default storage driver can vary based on your OS vendor. You should use the storage
driver that is recommended by your preferred vendor and which is in line with policy
around the applications which are being deployed.
References:
1. https://docs.docker.com/storage/storagedriver/select-storage-driver/
Page 67
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 68
2.7 Ensure TLS authentication for Docker daemon is configured
(Automated)
Profile Applicability:
Remediation:
Follow the steps mentioned in the Docker documentation or other references.
Page 69
Default Value:
By default, TLS authentication is not configured.
References:
1. https://docs.docker.com/engine/security/https/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 70
2.8 Ensure the default ulimit is configured appropriately (Manual)
Profile Applicability:
Remediation:
Run Docker in daemon mode and pass --default-ulimit as argument with respective
ulimits as appropriate in your environment and in line with your security policy.
For Example,
dockerd --default-ulimit nproc=1024:2048 --default-ulimit nofile=100:200
Default Value:
By default, no ulimit is set.
Page 71
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#default-ulimit-
settings
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 72
2.9 Enable user namespace support (Automated)
Profile Applicability:
Page 73
docker info --format '{{ .SecurityOptions }}'
Remediation:
Please consult the Docker documentation for various ways in which this can be
configured depending upon your requirements. Your steps might also vary based on
platform - For example, on Red Hat, sub-UIDs and sub-GIDs mapping creation do not
work automatically. You might have to create your own mapping.
The high-level steps are as below:
Step 1: Ensure that the files /etc/subuid and /etc/subgid exist.
touch /etc/subuid /etc/subgid
Step 2: Start the docker daemon with --userns-remap flag
dockerd --userns-remap=default
Default Value:
By default, user namespace is not remapped. Consideration should be given to
implementing this in line with the requirements of the applications being used and the
organization's security policy.
References:
1. https://man7.org/linux/man-pages/man7/user_namespaces.7.html
2. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-user-
namespace-options
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 74
2.10 Ensure the default cgroup usage has been confirmed
(Automated)
Profile Applicability:
Remediation:
The default setting is in line with good security practice and can be left in situ. If you
wish to specifically set a non-default cgroup, pass the --cgroup-parent parameter to
the Docker daemon when starting it.
For example,
Page 75
dockerd --cgroup-parent=/foobar
Default Value:
By default, docker daemon uses /docker for fs cgroup driver and system.slice for
systemd cgroup driver.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#default-cgroup-
parent
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 76
2.11 Ensure base device size is not changed until needed
(Automated)
Profile Applicability:
Page 77
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#storage-driver-
options
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 78
2.12 Ensure that authorization for Docker client commands is
enabled (Automated)
Profile Applicability:
To confirm this setting the dockerd start-up options and any settings in
/etc/docker/daemon.json should be reviewed.
To review the dockerd startup options, use:
ps -ef | grep dockerd
You should ensure that the --authorization-plugin parameter is set as appropriate if
you are using docker native authorization.
The contents of /etc/docker/daemon.json should also be reviewed.
Remediation:
Step 1: Install/Create an authorization plugin.
Step 2: Configure the authorization policy as desired.
Step 3: Start the docker daemon as below:
Page 79
dockerd --authorization-plugin=<PLUGIN_ID>
Default Value:
By default, authorization plugins are not set up.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#access-
authorization
2. https://docs.docker.com/engine/extend/plugins_authorization/
Additional Information:
It should be noted that the native Docker authentication plugin is only one method of
enforcing this control so other methods which could potentially be in use should be
reviewed before assessing this as a pass or fail in an audit.
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 80
2.13 Ensure centralized and remote logging is configured
(Automated)
Profile Applicability:
Default Value:
By default, container logs are maintained as json files
References:
1. https://docs.docker.com/config/containers/logging/configure/
Page 81
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 82
2.14 Ensure containers are restricted from acquiring new
privileges (Automated)
Profile Applicability:
Remediation:
You should run the Docker daemon as below:
dockerd --no-new-privileges
Default Value:
By default, containers are not restricted from acquiring new privileges.
Page 83
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/
2. https://github.com/moby/moby/pull/20727
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 84
2.15 Ensure live restore is enabled (Automated)
Profile Applicability:
Default Value:
By default, --live-restore is not enabled.
References:
1. https://docs.docker.com/config/containers/live-restore/
Page 85
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 86
2.16 Ensure Userland Proxy is Disabled (Automated)
Profile Applicability:
Remediation:
You should run the Docker daemon as below:
dockerd --userland-proxy=false
Default Value:
By default, the userland proxy is enabled.
References:
1. http://windsock.io/the-docker-proxy/
Page 87
2. https://github.com/docker/docker/issues/14856
3. https://github.com/docker/docker/issues/22741
4. https://docs.docker.com/config/containers/container-networking/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 88
2.17 Ensure that a daemon-wide custom seccomp profile is
applied if appropriate (Manual)
Profile Applicability:
Remediation:
By default, Docker's default seccomp profile is applied. If this is adequate for your
environment, no action is necessary. Alternatively, if you choose to apply your own
seccomp profile, use the --seccomp-profile flag at daemon start or put it in the daemon
runtime parameters file.
Page 89
dockerd --seccomp-profile </path/to/seccomp/profile>
Default Value:
By default, Docker applies a default seccomp profile.
References:
1. https://docs.docker.com/engine/security/seccomp/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 90
2.18 Ensure that experimental features are not implemented in
production (Automated)
Profile Applicability:
"Experimental" is currently a runtime Docker daemon flag rather than being a feature of
a separate build. Passing --experimental as a runtime flag to the docker daemon
activates experimental features. Whilst "Experimental" is considered a stable release, it
has a number of features which may not have been fully tested and do not guarantee
API stability.
Impact:
None
Audit:
You should run the command below and ensure that the Experimental property is set to
false in the Server section.
Remediation:
You should not pass --experimental as a runtime parameter to the Docker daemon on
production systems.
Default Value:
By default, experimental features are not activated in the Docker daemon.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/
Page 91
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 92
3 Docker daemon configuration files
This section covers Docker related files and directory permissions and ownership.
Keeping the files and directories, that may contain sensitive parameters, secure is
important for correct and secure functioning of Docker daemon.
Page 93
3.1 Ensure that the docker.service file ownership is set to
root:root (Automated)
Profile Applicability:
Rationale:
The docker.service file contains sensitive parameters that may alter the behavior of the
Docker daemon. It should therefore be individually and group owned by the root user in
order to ensure that it is not modified or corrupted by a less privileged user.
Impact:
None.
Audit:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.service
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
execute the command below including the correct file path in order to verify that the file
is owned and group owned by root.
For example:
stat -c %U:%G /usr/lib/systemd/system/docker.service | grep -v root:root
The command above should not return anything.
Remediation:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.service
Step 2: If the file does not exist, this recommendation is not applicable. If the file does
exist, you should execute the command below, including the correct file path, in order to
set the ownership and group ownership for the file to root.
For example,
Page 94
chown root:root /usr/lib/systemd/system/docker.service
Default Value:
This file may not be present on the system and if it is not, this recommendation is not
applicable. By default, if the file is present, the correct permissions are for the ownership
and group ownership to be set to "root".
References:
1. https://docs.docker.com/config/daemon/systemd/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 95
3.2 Ensure that docker.service file permissions are appropriately
set (Automated)
Profile Applicability:
Remediation:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.service
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
execute the command below including the correct file path to set the file permissions to
644.
For example,
chmod 644 /usr/lib/systemd/system/docker.service
Default Value:
This file may not be present on the system. In that case, this recommendation is not
applicable. By default, if the file is present, the file permissions are correctly set to 644.
Page 96
References:
1. https://docs.docker.com/articles/systemd/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 97
3.3 Ensure that docker.socket file ownership is set to root:root
(Automated)
Profile Applicability:
Rationale:
The docker.socket file contains sensitive parameters that may alter the behavior of the
Docker remote API. For this reason, it should be owned and group owned by root in
order to ensure that it is not modified by less privileged users.
Impact:
None.
Audit:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.socket
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
execute the command below, including the correct file path to verify that the file is
owned and group-owned by root.
For example,
stat -c %U:%G /usr/lib/systemd/system/docker.socket | grep -v root:root
The command above should not return a value.
Remediation:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.socket
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
execute the command below, including the correct file path to set the ownership and
group ownership for the file to root.
For example,
Page 98
chown root:root /usr/lib/systemd/system/docker.socket
Default Value:
This file may not be present on the system. In that case, this recommendation is not
applicable. By default, if the file is present, the ownership and group ownership for it
should be set to root.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-
socket-option
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 99
3.4 Ensure that docker.socket file permissions are set to 644 or
more restrictive (Automated)
Profile Applicability:
Rationale:
The docker.socket file contains sensitive parameters that may alter the behavior of the
Docker remote API. It should therefore be writeable only by root in order to ensure that
it is not modified by less privileged users.
Impact:
None.
Audit:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.socket
Step 2: If the file does not exist, this recommendation is not applicable. If the file exists,
you should execute the command below, including the correct file path in order to verify
that the file permissions are set to 644 or more restrictively.
For example:
stat -c %a /usr/lib/systemd/system/docker.socket
Remediation:
Step 1: Find out the file location:
systemctl show -p FragmentPath docker.socket
Step 2: If the file does not exist, this recommendation is not applicable. If the file does
exist, you should execute the command below, including the correct file path to set the
file permissions to 644.
For example,
Page 100
chmod 644 /usr/lib/systemd/system/docker.socket
Default Value:
This file may not be present on the system and in that case, this recommendation is not
applicable. By default, if the file is present, the permissions should be set to 644 or more
restrictively.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#bind-docker-to-
another-hostport-or-a-unix-socket
2. https://github.com/YungSang/fedora-atomic-
packer/blob/master/oem/docker.socket
3. http://daviddaeschler.com/2014/12/14/centos-7rhel-7-and-docker-containers-on-
boot/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 101
3.5 Ensure that the /etc/docker directory ownership is set to
root:root (Automated)
Profile Applicability:
Rationale:
The /etc/docker directory contains certificates and keys in addition to various other
sensitive files. It should therefore be individual owned and group owned by root in order
to ensure that it cannot be modified by less privileged users.
Impact:
None.
Audit:
You should execute the command below to verify that the directory is owned and group
owned by root:
stat -c %U:%G /etc/docker | grep -v root:root
This command should not return any data.
Remediation:
To resolve this issue you should run the following command:
chown root:root /etc/docker
This sets the ownership and group ownership for the directory to root.
Default Value:
By default, the ownership and group ownership for this directory is correctly set to root.
References:
1. https://docs.docker.com/engine/security/https/
Page 102
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 103
3.6 Ensure that /etc/docker directory permissions are set to 755 or
more restrictively (Automated)
Profile Applicability:
stat -c %a /etc/docker
Remediation:
You should run the following command:
chmod 755 /etc/docker
This sets the permissions for the directory to 755.
Default Value:
By default, the permissions for this directory are set to 755.
References:
1. https://docs.docker.com/engine/security/https/
Page 104
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 105
3.7 Ensure that registry certificate file ownership is set to root:root
(Automated)
Profile Applicability:
Rationale:
The /etc/docker/certs.d/<registry-name> directory contains Docker registry
certificates. These certificate files must be individually owned and group owned by root
to ensure that less privileged users are unable to modify the contents of the directory.
Impact:
None.
Audit:
You should execute the command below to verify that the registry certificate files are
individually owned and group owned by root:
stat -c %U:%G /etc/docker/certs.d/* | grep -v root:root
The above command should not return any value.
Remediation:
The following command could be executed:
chown root:root /etc/docker/certs.d/<registry-name>/*
This would set the individual ownership and group ownership for the registry certificate
files to root.
Default Value:
By default, the individual ownership and group ownership for registry certificate files is
correctly set to root.
References:
1. https://docs.docker.com/registry/insecure/
Page 106
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 107
3.8 Ensure that registry certificate file permissions are set to 444
or more restrictively (Automated)
Profile Applicability:
Remediation:
You should execute the following command:
find /etc/docker/certs.d/ -type f -exec chmod 0444 {} \;
This would set the permissions for the registry certificate files to 444.
Default Value:
By default, the permissions for registry certificate files might not be 444. The default file
permissions are governed by the system or user specific umask values which are
defined within the operating system itself.
References:
1. https://docs.docker.com/registry/insecure/
Page 108
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 109
3.9 Ensure that TLS CA certificate file ownership is set to root:root
(Automated)
Profile Applicability:
Rationale:
The TLS CA certificate file should be protected from any tampering. It is used to
authenticate the Docker server based on a given CA certificate. It must be therefore be
individually owned and group owned by root to ensure that it cannot be modified by
less privileged users.
Impact:
None.
Audit:
You should execute the command below to verify that the TLS CA certificate file is
owned and group owned by root:
stat -c %U:%G <path to TLS CA certificate file> | grep -v root:root
The above command should return no results.
Remediation:
You should execute the following command:
chown root:root <path to TLS CA certificate file>
This sets the individual ownership and group ownership for the TLS CA certificate file to
root.
Default Value:
By default, the ownership and group-ownership for TLS CA certificate file is correctly set
to root.
References:
1. https://docs.docker.com/registry/insecure/
2. https://docs.docker.com/engine/security/https/
Page 110
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 111
3.10 Ensure that TLS CA certificate file permissions are set to 444
or more restrictively (Automated)
Profile Applicability:
Rationale:
The TLS CA certificate file should be protected from any tampering. It is used to
authenticate the Docker server based on a given CA certificate. It must therefore have
permissions of 444, or more restrictive permissions to ensure that the file cannot be
modified by a less privileged user.
Impact:
None.
Audit:
You should execute the command below to verify that the TLS CA certificate file has
permissions of 444 or that these are more restrictively set:
stat -c %a <path to TLS CA certificate file>
Remediation:
You should execute the following command:
chmod 444 <path to TLS CA certificate file>
This sets the file permissions on the TLS CA file to 444.
Default Value:
By default, the permissions for the TLS CA certificate file might not be 444. The default
file permissions are governed by the operating system or user specific umask values.
References:
1. https://docs.docker.com/registry/insecure/
2. https://docs.docker.com/engine/security/https/
Page 112
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 113
3.11 Ensure that Docker server certificate file ownership is set to
root:root (Automated)
Profile Applicability:
References:
1. https://docs.docker.com/registry/insecure/
2. https://docs.docker.com/engine/security/https/
Page 114
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 115
3.12 Ensure that the Docker server certificate file permissions are
set to 444 or more restrictively (Automated)
Profile Applicability:
Impact:
None.
Audit:
You should execute the command below to verify that the Docker server certificate file
has permissions of 444 or more restrictive permissions:
stat -c %a <path to Docker server certificate file>
Remediation:
You should execute the command below:
chmod 444 <path to Docker server certificate file>
This sets the file permissions of the Docker server certificate file to 444.
Default Value:
By default, the permissions for the Docker server certificate file might not be 444. The
default file permissions are governed by the operating system or user specific umask
values.
References:
1. https://docs.docker.com/registry/insecure/
2. https://docs.docker.com/engine/security/https/
Page 116
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 117
3.13 Ensure that the Docker server certificate key file ownership
is set to root:root (Automated)
Profile Applicability:
Default Value:
By default, the individual ownership and group ownership for the Docker server
certificate key file is correctly set to root.
References:
1. https://docs.docker.com/registry/insecure/
2. https://docs.docker.com/engine/security/https/
Page 118
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 119
3.14 Ensure that the Docker server certificate key file permissions
are set to 400 (Automated)
Profile Applicability:
Impact:
None.
Audit:
You should execute the command below to verify that the Docker server certificate key
file has permissions of 400:
stat -c %a <path to Docker server certificate key file>
Remediation:
You should execute the following command:
chmod 400 <path to Docker server certificate key file>
This sets the Docker server certificate key file permissions to 400.
Default Value:
By default, the permissions for the Docker server certificate key file might not be 400.
The default file permissions are governed by the operating system or user specific
umask values.
References:
1. https://docs.docker.com/registry/insecure/
2. https://docs.docker.com/engine/security/https/
Page 120
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 121
3.15 Ensure that the Docker socket file ownership is set to
root:docker (Automated)
Profile Applicability:
Rationale:
The Docker daemon runs as root. The default Unix socket therefore must be owned by
root. If any other user or process owns this socket, it might be possible for that non-
privileged user or process to interact with the Docker daemon. Additionally, in this case
a non-privileged user or process might be able to interact with containers which is
neither a secure nor desired behavior.
Additionally, the Docker installer creates a Unix group called docker. You can add users
to this group, and in this case, those users would be able to read and write to the default
Docker Unix socket. The membership of the docker group is tightly controlled by the
system administrator. However, ff any other group owns this socket, then it might be
possible for members of that group to interact with the Docker daemon. Such a group
might not be as tightly controlled as the docker group. Again, this is not in line with good
security practice.
For these reason, the default Docker Unix socket file should be owned by root and
group owned by docker to maintain the integrity of the socket file.
Impact:
None.
Audit:
You should execute the below command to verify that the Docker socket file is owned
by root and group owned by docker:
stat -c %U:%G /var/run/docker.sock | grep -v root:docker
The command above should return no results.
Remediation:
You should execute the following command:
Page 122
chown root:docker /var/run/docker.sock
This sets the ownership to root and group ownership to docker for the default Docker
socket file.
Default Value:
By default, the ownership and group ownership for the Docker socket file is correctly set
to root:docker.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-
socket-option
2. https://docs.docker.com/engine/reference/commandline/dockerd/#bind-docker-to-
another-hostport-or-a-unix-socket
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 123
3.16 Ensure that the Docker socket file permissions are set to 660
or more restrictively (Automated)
Profile Applicability:
Impact:
None.
Audit:
You should execute the command below to verify that the Docker socket file has
permissions of 660 or more restrictive permissions
stat -c %a /var/run/docker.sock
Remediation:
You should execute the command below.
chmod 660 /var/run/docker.sock
This sets the file permissions of the Docker socket file to 660.
Default Value:
By default, the permissions for the Docker socket file is correctly set to 660.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-
socket-option
2. https://docs.docker.com/engine/reference/commandline/dockerd/#bind-docker-to-
another-hostport-or-a-unix-socket
Page 124
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 125
3.17 Ensure that the daemon.json file ownership is set to root:root
(Automated)
Profile Applicability:
Rationale:
The daemon.json file contains sensitive parameters that could alter the behavior of the
docker daemon. It should therefore be owned and group owned by root to ensure it
cannot be modified by less privileged users.
Impact:
None.
Audit:
You should execute the command below to verify that the file is owned and group
owned by root:
stat -c %U:%G /etc/docker/daemon.json | grep -v root:root
The command above should not return any results or, if there is no daemon.json file
present it will return:
stat: cannot stat '/etc/docker/daemon.json': No such file or directory
Remediation:
If the daemon.json file is present, you should execute the command below:
chown root:root /etc/docker/daemon.json
This sets the ownership and group ownership for the file to root.
Default Value:
This file may not be present on the system, and in that case, this recommendation is not
applicable.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-
configuration-file
Page 126
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 127
3.18 Ensure that daemon.json file permissions are set to 644 or
more restrictive (Automated)
Profile Applicability:
Rationale:
The daemon.json file contains sensitive parameters that may alter the behavior of the
docker daemon. Therefore it should be writeable only by root to ensure it is not
modified by less privileged users.
Impact:
None.
Audit:
You should execute the command below to verify that the file permissions are correctly
set to 644 or more restrictively:
stat -c %a /etc/docker/daemon.json
If the command returns the result below, the file is not present and this check does not
apply:
stat: cannot stat '/etc/docker/daemon.json': No such file or directory
Remediation:
If the file is present, you should execute the command below:
chmod 644 /etc/docker/daemon.json
This sets the file permissions for this file to 644.
Default Value:
This file may not be present on the system, and in that case, this recommendation is not
applicable.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-
configuration-file
Page 128
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 129
3.19 Ensure that the /etc/default/docker file ownership is set to
root:root (Automated)
Profile Applicability:
Rationale:
The /etc/default/docker file contains sensitive parameters that may alter the behavior
of the Docker daemon. It should therefore be individually owned and group owned by
root to ensure that it cannot be modified by less privileged users.
Impact:
None.
Audit:
You should execute the command below to verify that the file is individually owned and
group owned by root:
stat -c %U:%G /etc/default/docker | grep -v root:root
The command above should return no results.
Remediation:
You should execute the following command
chown root:root /etc/default/docker
This sets the ownership and group ownership of the file to root.
Default Value:
This file may not be present on the system, and in this case, this recommendation is not
applicable.
References:
1. https://docs.docker.com/engine/admin/configuring/
Page 130
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 131
3.20 Ensure that the /etc/default/docker file permissions are set to
644 or more restrictively (Automated)
Profile Applicability:
Remediation:
You should execute the following command:
chmod 644 /etc/default/docker
This sets the file permissions for this file to 644.
Default Value:
This file may not be present on the system and in this case, this recommendation is not
applicable.
References:
1. https://docs.docker.com/engine/admin/configuring/
Page 132
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 133
3.21 Ensure that the /etc/sysconfig/docker file permissions are set
to 644 or more restrictively (Automated)
Profile Applicability:
Rationale:
The /etc/sysconfig/docker file contains sensitive parameters that may alter the
behavior of the Docker daemon. It should therefore be writeable only by root in order to
ensure that it is not modified by less privileged users.
Impact:
None.
Audit:
You should execute the command below to verify that the file permissions are correctly
set to 644 or more restrictively:
stat -c %a /etc/sysconfig/docker
Remediation:
You should execute the following command:
chmod 644 /etc/sysconfig/docker
This sets the file permissions for this file to 644.
Default Value:
This file may not be present on the system and in this case, this recommendation is not
applicable.
References:
1. https://docs.docker.com/engine/admin/configuring/
Page 134
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 135
3.22 Ensure that the /etc/sysconfig/docker file ownership is set to
root:root (Automated)
Profile Applicability:
Rationale:
The /etc/sysconfig/docker file contains sensitive parameters that may alter the
behavior of the Docker daemon. It should therefore be individually owned and group
owned by root to ensure that it is not modified by less privileged users.
Impact:
None.
Audit:
You should execute the command below to verify that the file is individually owned and
group owned by root:
stat -c %U:%G /etc/sysconfig/docker | grep -v root:root
The command above should return no results.
Remediation:
You should execute the following command:
chown root:root /etc/sysconfig/docker
This sets the ownership and group ownership for the file to root.
Default Value:
This file may not be present on the system, and in this case, this recommendation is not
applicable.
References:
1. https://docs.docker.com/engine/admin/configuring/
Page 136
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 137
3.23 Ensure that the Containerd socket file ownership is set to
root:root (Automated)
Profile Applicability:
Rationale:
Containerd is an underlying component used by Docker to create and manage
containers. It provides a socket file similar to the Docker socket, which must be
protected from unauthorized access. If any other user or process owns this socket, it
might be possible for that non-privileged user or process to interact with the Containerd
daemon. Additionally, in this case a non-privileged user or process might be able to
interact with containers which is neither a secure nor desired behavior.
Unlike the Docker socket, there is usually no requirement for non-privileged users to
connect to the socket, so the ownership should be root:root.
Impact:
None.
Audit:
You should execute the below command to verify that the Containerd socket file is
owned by root and group owned by root:
stat -c %U:%G /run/containerd/containerd.sock | grep -v root:root
The command above should return no results.
Remediation:
You should execute the following command:
chown root:root /run/containerd/containerd.sock
This sets the ownership to root and group ownership to root for the default Containerd
socket file.
Default Value:
By default, the ownership and group ownership for the Containerd socket file is correctly
set to root:root.
Page 138
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 139
3.24 Ensure that the Containerd socket file permissions are set to
660 or more restrictively (Automated)
Profile Applicability:
Impact:
None.
Audit:
You should execute the command below to verify that the Docker socket file has
permissions of 660 or more restrictive permissions
stat -c %a /run/containerd/containerd.sock
Remediation:
You should execute the command below.
chmod 660 /run/containerd/containerd.sock
This sets the file permissions of the Containerd socket file to 660.
Default Value:
By default, the permissions for the Containerd socket file is correctly set to 660.
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 140
Controls
Control IG 1 IG 2 IG 3
Version
Page 141
4 Container Images and Build File Configuration
Container base images and build files govern the fundamentals of how a container
instance from a particular image would behave. Ensuring that you are using proper
base images and appropriate build files can be very important for building your
containerized infrastructure. Below are some of the recommendations that you should
follow for container base images and build files to ensure that your containerized
infrastructure is secure.
Page 142
4.1 Ensure that a user for the container has been created
(Automated)
Profile Applicability:
It is good practice to run the container as a non-root user, where possible. This can be
done either via the USER directive in the Dockerfile or through gosu or similar where
used as part of the CMD or ENTRYPOINT directives.
Impact:
Running as a non-root user can present challenges where you wish to bind mount
volumes from the underlying host. In this case, care should be taken to ensure that the
user running the contained process can read and write to the bound directory, according
to their requirements.
Audit:
You should run the following command
docker ps --quiet | xargs --max-args=1 -I{} docker exec {} cat /proc/1/status
| grep '^Uid:' | awk '{print $3}'
This should return the effective UID for each container and where it returns 0, it
indicates that the container process is running as root.
Note that some services may start as the root user and then starts all other related
processes as an unprivileged user.
Remediation:
You should ensure that the Dockerfile for each container image contains the information
below:
USER <username or ID>
In this case, the user name or ID refers to the user that was found in the container base
image. If there is no specific user created in the container base image, then make use
of the useradd command to add a specific user before the USER instruction in the
Dockerfile.
For example, add the below lines in the Dockerfile to create a user in the container:
Page 143
RUN useradd -d /home/username -m -s /bin/bash username
USER username
Note: If there are users in the image that are not needed, you should consider deleting
them. After deleting those users, commit the image and then generate new instances of
the containers.
Alternatively, if it is not possible to set the USER directive in the Dockerfile, a script
running as part of the CMD or ENTRYPOINT sections of the Dockerfile should be used to
ensure that the container process switches to a non-root user.
Default Value:
By default, containers are run with root privileges and also run as the root user inside
the container.
References:
1. https://docs.docker.com/engine/reference/builder/#user
2. https://docs.docker.com/engine/reference/run/#user
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
5 Account Management
Use processes and tools to assign and manage authorization to credentials for
v8 user accounts, including administrator accounts, as well as service accounts, to
enterprise assets and software.
Page 144
4.2 Ensure that containers use only trusted base images (Manual)
Profile Applicability:
Remediation:
The following procedures are useful for establishing trust for a specific image.
Default Value:
Not Applicable.
Page 145
References:
1. https://docs.docker.com/engine/reference/commandline/pull/
2. https://registry.hub.docker.com/
3. https://access.redhat.com/blogs/766093/posts/1976473
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 146
4.3 Ensure that unnecessary packages are not installed in the
container (Manual)
Profile Applicability:
1. https://docs.docker.com/develop/develop-images/baseimages/
Page 147
2. https://jpetazzo.github.io/2020/02/01/quest-minimal-docker-images-part-1/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 148
4.4 Ensure images are scanned and rebuilt to include security
patches (Manual)
Profile Applicability:
Page 149
Default Value:
By default, containers and images are not updated automatically to address missing
operating system security patches.
References:
1. https://docs.docker.com/engine/reference/builder/#onbuild
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 150
4.5 Ensure Content trust for Docker is Enabled (Automated)
Profile Applicability:
Page 151
References:
1. https://docs.docker.com/engine/security/trust/
2. https://docs.docker.com/notary/service_architecture/
3. https://docs.docker.com/engine/reference/commandline/cli/#environment-
variables
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
3 Data Protection
v8 Develop processes and technical controls to identify, classify, securely
handle, retain, and dispose of data.
v7 13 Data Protection
Data Protection
Page 152
4.6 Ensure that HEALTHCHECK instructions have been added to
container images (Automated)
Profile Applicability:
Remediation:
You should follow the Docker documentation and rebuild your container images to
include the HEALTHCHECK instruction.
Default Value:
By default, HEALTHCHECK is not set.
References:
1. https://docs.docker.com/engine/reference/builder/#healthcheck
Page 153
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 154
4.7 Ensure update instructions are not used alone in Dockerfiles
(Manual)
Profile Applicability:
Page 155
References:
1. https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 156
4.8 Ensure setuid and setgid permissions are removed (Manual)
Profile Applicability:
Default Value:
Not Applicable
Page 157
References:
1. https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-
capabilities
2. http://man7.org/linux/man-pages/man2/setuid.2.html
3. http://man7.org/linux/man-pages/man2/setgid.2.html
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 158
4.9 Ensure that COPY is used instead of ADD in Dockerfiles
(Manual)
Profile Applicability:
Rationale:
The COPY instruction simply copies files from the local host machine to the container file
system. The ADD instruction could potentially retrieve files from remote URLs and
perform operations such as unpacking them. The ADD instruction therefore introduces
security risks. For example, malicious files may be directly accessed from URLs without
scanning, or there may be vulnerabilities associated with decompressing them.
Impact:
Care needs to be taken in implementing this control if the application requires
functionality that is part of the ADD instruction, for example, if you need to retrieve files
from remote URLs.
Audit:
Run the command below to get the list of images:
docker images
Run the command below against each image in the list above and look for any ADD
instructions:
docker history <IMAGE ID>
Alternatively, if you have access to the Dockerfile for the image, you should verify that
there are no ADD instructions.
Remediation:
You should use COPY rather than ADD instructions in Dockerfiles.
Default Value:
Not Applicable
References:
1. https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-
or-copy
Page 159
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 160
4.10 Ensure secrets are not stored in Dockerfiles (Manual)
Profile Applicability:
1. https://docs.docker.com/develop/develop-images/build_enhancements/#new-
docker-build-secret-information
Page 161
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
3 Data Protection
v8 Develop processes and technical controls to identify, classify, securely
handle, retain, and dispose of data.
v7 13 Data Protection
Data Protection
Page 162
4.11 Ensure only verified packages are installed (Manual)
Profile Applicability:
1. https://www.redhat.com/sysadmin/rpm-gpg-verify-packages
2. https://help.ubuntu.com/community/SecureApt
Page 163
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 164
4.12 Ensure all signed artifacts are validated (Manual)
Profile Applicability:
Controls
Control IG 1 IG 2 IG 3
Version
Page 165
5 Container Runtime Configuration
There are many security implications associated with the ways that containers are
started. Some runtime parameters can be supplied that have security consequences
that could compromise the host and the containers running on it. It is therefore very
important to verify the way in which containers are started, and which parameters are
associated with them. Container runtime configuration should be reviewed in line with
organizational security policy.
Page 166
5.1 Ensure that, if applicable, an AppArmor Profile is enabled
(Automated)
Profile Applicability:
If AppArmor is applicable for your Linux OS, you should enable it.
Page 167
Default Value:
By default, the docker-default AppArmor profile is applied to running containers. The
Docker binary generates this profile and then loads it into the kernel.
References:
1. https://docs.docker.com/engine/security/apparmor/
2. https://docs.docker.com/engine/reference/run/#security-configuration
3. https://docs.docker.com/engine/security/#other-kernel-security-features
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 168
5.2 Ensure that, if applicable, SELinux security options are set
(Automated)
Profile Applicability:
Remediation:
If SELinux is applicable for your Linux OS, you should use it.
Page 169
{
"selinux-enabled": true
}
5. Start your Docker container using the security options. For example,
Default Value:
By default, no SELinux security options are applied on containers.
References:
1. https://docs.docker.com/engine/security/#other-kernel-security-features
2. https://docs.docker.com/engine/reference/run/#security-configuration
3. https://access.redhat.com/documentation/en-
us/red_hat_enterprise_linux_atomic_host/7/html/container_security_guide/docker
_selinux_security_policy
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 170
5.3 Ensure that Linux kernel capabilities are restricted within
containers (Automated)
Profile Applicability:
Remediation:
You should execute the command below to add required capabilities:
docker run --cap-add={"Capability 1","Capability 2"} <Run arguments>
<Container Image Name or ID> <Command>
You should execute the command below to remove unneeded capabilities:
docker run --cap-drop={"Capability 1","Capability 2"} <Run arguments>
<Container Image Name or ID> <Command>
Alternatively, you could remove all the currently configured capabilities and then restore
only the ones you specifically use:
Page 171
docker run --cap-drop=all --cap-add={"Capability 1","Capability 2"} <Run
arguments> <Container Image Name or ID> <Command>
Note that some settings also can be configured using the --sysctl option, reducing the
need for container capabilities even further. This includes unprivileged ICMP echo
sockets without NET_RAW and allow opening any port less than 1024 without
NET_BIND_SERVICE.
Adding and removing capabilities are also possible when the docker service command
is used:
docker service create --cap-drop=all --cap-add={"Capability 1","Capability
2"} <Run arguments> <Container Image Name or ID> <Command>
Default Value:
By default, the capabilities below are applied to containers:
AUDIT_WRITE
CHOWN
DAC_OVERRIDE
FOWNER
FSETID
KILL
MKNOD
NET_BIND_SERVICE
NET_RAW
SETFCAP
SETGID
SETPCAP
SETUID
SYS_CHROOT
References:
1. https://docs.docker.com/engine/security/#linux-kernel-capabilities
2. https://docs.docker.com/compose/compose-file/compose-file-v3/#cap_add-
cap_drop
3. https://docs.docker.com/engine/reference/commandline/service_create/#options
4. https://docs.docker.com/engine/reference/commandline/run/#configure-
namespaced-kernel-parameters-sysctls-at-runtime
Page 172
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 173
5.4 Ensure that privileged containers are not used (Automated)
Profile Applicability:
Default Value:
False.
References:
1. https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-
capabilities
Page 174
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 175
5.5 Ensure sensitive host system directories are not mounted on
containers (Automated)
Profile Applicability:
Rationale:
If sensitive directories are mounted in read-write mode, it could be possible to make
changes to files within them. This has obvious security implications and should be
avoided.
Impact:
None.
Audit:
You should run the following command:
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
Volumes={{ .Mounts }}'
This command returns a list of currently mapped directories and indicates whether they
are mounted in read-write mode for each container instance.
Remediation:
You should not mount directories which are security sensitive on the host within
containers, especially in read-write mode.
Default Value:
Docker defaults to using a read-write volume but you can also mount a directory read-
only. By default, no sensitive host directories are mounted within containers.
Page 176
References:
1. https://docs.docker.com/storage/volumes/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
3 Data Protection
v8 Develop processes and technical controls to identify, classify, securely
handle, retain, and dispose of data.
v7 13 Data Protection
Data Protection
Page 177
5.6 Ensure sshd is not run within containers (Automated)
Profile Applicability:
• Difficult to manage access policies and security compliance for SSH server
• Difficult to manage keys and passwords across various containers
• Difficult to manage security upgrades for SSH server
It is possible to have shell access to a container without using SSH, the needlessly
increasing the complexity of security management should be avoided.
Impact:
None.
Audit:
List all the running instances of containers by executing below command:
docker ps --quiet
For each container instance, execute the below command:
docker exec <CONTAINER ID> ps -el
Ensure that there is no process for SSH server.
Remediation:
Uninstall the SSH daemon from the container and use and use docker exec to enter a
container on the remote host.
docker exec --interactive --tty <CONTAINER ID> sh
OR
Page 178
docker attach <CONTAINER ID>
Default Value:
By default, SSH server is not running inside the container. Only one process per
container is allowed.
References:
1. https://jpetazzo.github.io/2014/06/23/docker-ssh-considered-evil/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 179
5.7 Ensure privileged ports are not mapped within containers
(Automated)
Profile Applicability:
Remediation:
You should not map container ports to privileged host ports when starting a container.
You should also, ensure that there is no such container to host privileged port mapping
declarations in the Dockerfile.
Default Value:
By default, mapping a container port to a privileged port on the host is allowed.
Note: There might be certain cases where you want to map privileged ports, because if
you forbid it, then the corresponding application has to run outside of a container.
Page 180
For example: HTTP and HTTPS load balancers have to bind 80/tcp and 443/tcp
respectively. Forbidding to map privileged ports effectively forbids from running those in
a container, and mandates using an external load balancer. In such cases, those
containers instances should be marked as exceptions for this recommendation.
References:
1. https://docs.docker.com/network/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 181
5.8 Ensure that only needed ports are open on the container
(Manual)
Profile Applicability:
Page 182
docker run --interactive --tty --publish 5000 --publish 5001 --publish 5002
centos /bin/bash
Default Value:
By default, all the ports that are listed in the Dockerfile under the EXPOSE instruction for
an image are opened when a container is run with the -P or --publish-all flags.
References:
1. https://docs.docker.com/engine/userguide/networking/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 183
5.9 Ensure that the host's network namespace is not shared
(Automated)
Profile Applicability:
1. https://docs.docker.com/network/
2. https://docs.docker.com/engine/reference/run/#network-settings
Page 184
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
v7 12 Boundary Defense
Boundary Defense
Page 185
5.10 Ensure that the memory usage for containers is limited
(Automated)
Profile Applicability:
Page 186
docker inspect --format='{{ .Id }}: Memory={{.HostConfig.Memory}}
KernelMemory={{.HostConfig.KernelMemory}} Swap={{.HostConfig.MemorySwap}}'
<CONTAINER ID>
Default Value:
By default, all containers on a Docker host share their resources equally and no
memory limits are enforced.
References:
1. https://docs.docker.com/config/containers/resource_constraints/#limit-a-
containers-access-to-memory
2. https://docs.docker.com/config/containers/runmetrics/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 187
5.11 Ensure that CPU priority is set appropriately on containers
(Automated)
Profile Applicability:
Remediation:
You should manage the CPU runtime between your containers dependent on their
priority within your organization. To do so start the container using the --cpu-shares
argument.
For example, you could run a container as below:
Page 188
docker run -d --cpu-shares 512 centos sleep 1000
In the example above, the container is started with CPU shares of 50% of what other
containers use. So if the other container has CPU shares of 80%, this container will
have CPU shares of 40%.
Every new container will have 1024 shares of CPU by default. However, this value is
shown as 0 if you run the command mentioned in the audit section.
If you set one container’s CPU shares to 512 it will receive half of the CPU time
compared to the other containers. So if you take 1024 as 100% you can then derive the
number that you should set for respective CPU shares. For example, use 512 if you
want to set it to 50% and 256 if you want to set it 25%.
You can also view the current CPU shares in the file
/sys/fs/cgroup/cpu/docker/<CONTAINER ID>/cpu.shares.
Default Value:
By default, all containers on a Docker host share their resources equally. No CPU
shares are enforced.
References:
1. https://docs.docker.com/config/containers/resource_constraints/#cpu
2. https://docs.docker.com/engine/reference/commandline/run/#options
3. https://docs.docker.com/engine/admin/runmetrics/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 189
5.12 Ensure that the container's root filesystem is mounted as
read only (Automated)
Profile Applicability:
Audit:
You should run the following command on the docker host:
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
ReadonlyRootfs={{ .HostConfig.ReadonlyRootfs }}'
If the above command returns true, it means the container's root filesystem is mounted
read-only.
If the above command returns false, it means the container's root filesystem is
writeable.
Remediation:
You should add a --read-only flag at a container's runtime to enforce the container's
root filesystem being mounted as read only.
Page 190
docker run <Run arguments> --read-only <Container Image Name or ID> <Command>
Enabling the --read-only option at a container's runtime should be used by
administrators to force a container's executable processes to only write container data
to explicit storage locations during its lifetime.
Examples of explicit storage locations during a container's runtime include, but are not
limited to:
1. Using the --tmpfs option to mount a temporary file system for non-persistent
data writes.
3. Utilizing the Docker shared-storage volume plugin for Docker data volume to
persist container data.
3. Transmitting container data outside of the Docker controlled area during the
container's runtime for container data in order to ensure that it is persistent.
Examples include hosted databases, network file shares and APIs.
Default Value:
By default, a container has its root filesystem writeable, allowing all container processes
to write files owned by the container's actual runtime user.
References:
1. https://docs.docker.com/storage/volumes/
2. https://docs.docker.com/storage/volumes/#use-a-read-only-volume
3. https://docs.docker.com/engine/reference/commandline/run/#mount-tmpfs---
tmpfs
Page 191
CIS Controls:
v7 13 Data Protection
Data Protection
Page 192
5.13 Ensure that incoming container traffic is bound to a specific
host interface (Automated)
Profile Applicability:
Remediation:
You should bind the container port to a specific host interface on the desired host port.
For example,
Page 193
docker run --detach --publish 10.2.3.4:49153:80 nginx
In the example above, the container port 80 is bound to the host port on 49153 and
would accept incoming connection only from the 10.2.3.4 external interface.
Default Value:
By default, Docker exposes the container ports on 0.0.0.0, the wildcard IP address that
will match any possible incoming network interface on the host machine.
References:
1. https://docs.docker.com/network/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 194
5.14 Ensure that the 'on-failure' container restart policy is set to '5'
(Automated)
Profile Applicability:
Rationale:
If you indefinitely keep trying to start the container, it could possibly lead to a denial of
service on the host. It could be an easy way to do a distributed denial of service attack
especially if you have many containers on the same host. Additionally, ignoring the exit
status of the container and always attempting to restart the container, leads to non-
investigation of the root cause behind containers getting terminated. If a container gets
terminated, you should investigate on the reason behind it instead of just attempting to
restart it indefinitely. You should use the on-failure restart policy to limit the number of
container restarts to a maximum of 5 attempts.
Impact:
If this option is set, a container will only attempt to restart itself 5 times.
Audit:
You should use the command below
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
RestartPolicyName={{ .HostConfig.RestartPolicy.Name }} MaximumRetryCount={{
.HostConfig.RestartPolicy.MaximumRetryCount }}'
If this command returns RestartPolicyName=always, then the system is not configured
optimally.
If the above command returns RestartPolicyName=no or just RestartPolicyName=, then
restart policies are not being used and the container would never be restarted
automatically. Whilst this may be a secure option, it is not the best option from a
usability standpoint.
If the above command returns RestartPolicyName=on-failure, then verify that the
number of restart attempts is set to 5 or less by looking at MaximumRetryCount.
Remediation:
If you wish a container to be automatically restarted, a sample command is as below:
Page 195
docker run --detach --restart=on-failure:5 nginx
Default Value:
By default, containers are not configured with restart policies.
References:
1. https://docs.docker.com/engine/reference/commandline/run/#restart-policies---
restart
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 196
5.15 Ensure that the host's process namespace is not shared
(Automated)
Profile Applicability:
Audit:
You should run the following command:
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
PidMode={{ .HostConfig.PidMode }}'
If the command above returns host, it means that the host PID namespace is shared
with its containers; any other result means that the system is configured in line with
good security practice.
Page 197
Remediation:
You should not start a container with the --pid=host argument.
For example, do not start a container with the command below:
docker run --interactive --tty --pid=host centos /bin/bash
Default Value:
By default, all containers have the PID namespace enabled and the therefore the host's
process namespace is not shared with its containers.
References:
1. https://docs.docker.com/engine/reference/run/#pid-settings---pid
2. https://man7.org/linux/man-pages/man7/pid_namespaces.7.html
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 198
5.16 Ensure that the host's IPC namespace is not shared
(Automated)
Profile Applicability:
Audit:
You should run the following command:
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
IpcMode={{ .HostConfig.IpcMode }}'
If the command returns host, it means that the host IPC namespace is shared with the
container. Any other result means that it is not shared, and that the system is therefore
configured in line with good security practice.
Remediation:
You should not start a container with the --ipc=host argument. For example, do not
start a container as below:
Page 199
docker run --interactive --tty --ipc=host centos /bin/bash
Default Value:
By default, all containers have their IPC namespace enabled and host IPC namespace
is not shared with any container.
References:
1. https://docs.docker.com/engine/reference/run/#ipc-settings---ipc
2. https://www.man7.org/linux/man-pages/man7/ipc_namespaces.7.html
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 200
5.17 Ensure that host devices are not directly exposed to
containers (Manual)
Profile Applicability:
• r - read only
• w - writable
• m - mknod allowed
Impact:
You would not be able to use host devices directly within containers.
Audit:
You should use the command below:
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
Devices={{ .HostConfig.Devices }}'
The above command would list out each device with below information:
•
CgroupPermissions - For example, rwm
•
PathInContainer - Device path within the container
•
PathOnHost - Device path on the host
Page 201
You should verify that the host device is needed to be accessed from within the
container and that the permissions required are correctly set. If the above command
returns [], then the container does not have access to host devices and is configured in
line with good security practice.
Remediation:
You should not directly expose host devices to containers. If you do need to expose
host devices to containers, you should use granular permissions as appropriate to your
organization:
For example, do not start a container using the command below:
docker run --interactive --tty --device=/dev/tty0:/dev/tty0:rwm --
device=/dev/temp_sda:/dev/temp_sda:rwm centos bash
You should only share the host device using appropriate permissions:
docker run --interactive --tty --device=/dev/tty0:/dev/tty0:rw --
device=/dev/temp_sda:/dev/temp_sda:r centos bash
Default Value:
By default, host devices are not exposed to containers. If you do not provide sharing
permissions and choose to expose a host device to a container, the host device is be
exposed with read, write and mknod permissions.
References:
1. https://docs.docker.com/engine/reference/commandline/run/#add-host-device-to-
container---device
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 202
5.18 Ensure that the default ulimit is overwritten at runtime if
needed (Manual)
Profile Applicability:
Default Value:
Container instances inherit the default ulimit settings set at the Docker daemon level.
Page 203
References:
1. https://docs.docker.com/engine/reference/commandline/run/#set-ulimits-in-
container---ulimit
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 204
5.19 Ensure mount propagation mode is not set to shared
(Automated)
Profile Applicability:
Default Value:
By default, the container mounts are private.
References:
1. https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation
Page 205
2. https://docs.docker.com/engine/reference/run/#volume-shared-filesystems
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
3 Data Protection
v8 Develop processes and technical controls to identify, classify, securely
handle, retain, and dispose of data.
v7 13 Data Protection
Data Protection
Page 206
5.20 Ensure that the host's UTS namespace is not shared
(Automated)
Profile Applicability:
Default Value:
By default, all containers have the UTS namespace enabled and the host UTS
namespace is not shared with any containers.
Page 207
References:
1. https://docs.docker.com/engine/reference/run/#uts-settings---uts
2. https://www.man7.org/linux/man-pages/man7/uts_namespaces.7.html
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 208
5.21 Ensure the default seccomp profile is not Disabled
(Automated)
Profile Applicability:
Audit:
Page 209
References:
1. https://docs.docker.com/engine/reference/run/#security-configuration
2. https://github.com/moby/moby/blob/master/profiles/seccomp/default.json
3. https://docs.docker.com/engine/security/seccomp/
4. https://www.kernel.org/doc/Documentation/prctl/seccomp_filter.txt
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 210
5.22 Ensure that docker exec commands are not used with the
privileged option (Automated)
Profile Applicability:
Rationale:
Using the --privileged option in docker exec commands gives extended Linux
capabilities to the command. This could potentially be an insecure practice, particularly
when you are running containers with reduced capabilities or with enhanced restrictions.
Impact:
If you need enhanced capabilities within a container, then run it with all the permissions
it requires. These should be specified individually.
Audit:
If you have auditing enabled as recommended in Section 1, you can use the command
below to filter out docker exec commands that use the --privileged option.
ausearch -k docker | grep exec | grep privileged
Remediation:
You should not use the --privileged option in docker exec commands.
Default Value:
By default, the docker exec command runs without the --privileged option.
References:
1. https://docs.docker.com/engine/reference/commandline/exec/
2. https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-
capabilities
Page 211
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 212
5.23 Ensure that docker exec commands are not used with the
user=root option (Manual)
Profile Applicability:
Rationale:
Using the --user=root option in a docker exec command, executes it within the
container as the root user. This could potentially be insecure, particularly when you are
running containers with reduced capabilities or enhanced restrictions.
For example, if your container is running as a tomcat user (or any other non-root user),
it would be possible to run a command through docker exec as root with the --
user=root option. This could potentially be dangerous.
Impact:
None.
Audit:
If you have auditing enabled as recommended in Section 1, you can use the command
below to filter out docker exec commands that use the --user=root option.
ausearch -k docker | grep exec | grep user
Remediation:
You should not use the --user=root option in docker exec commands.
Default Value:
By default, the docker exec command runs without the --user option.
References:
1. https://docs.docker.com/engine/reference/commandline/exec/
Page 213
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 214
5.24 Ensure that cgroup usage is confirmed (Automated)
Profile Applicability:
At run time, it is possible to attach a container to a different cgroup other than the one
originally defined. This usage should be monitored and confirmed, as by attaching to a
different cgroup, excess permissions and resources might be granted to the container
and this can therefore prove to be a security risk.
Impact:
None.
Audit:
You should run the following command:
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
CgroupParent={{ .HostConfig.CgroupParent }}'
The above command returns the cgroup where the containers are running. If it is blank,
it means that containers are running under the default docker cgroup. Any other return
value indicates that the system is not configured in line with good security practice.
Remediation:
You should not use the --cgroup-parent option within the docker run command unless
strictly required.
Default Value:
By default, containers run under docker cgroup.
References:
1. https://docs.docker.com/engine/reference/run/#specify-custom-cgroups
Page 215
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 216
5.25 Ensure that the container is restricted from acquiring
additional privileges (Automated)
Profile Applicability:
Default Value:
By default, new privileges are not restricted.
References:
1. https://docs.docker.com/engine/reference/run/#security-configuration
Page 217
2. https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 218
5.26 Ensure that container health is checked at runtime
(Automated)
Profile Applicability:
Rationale:
If the container image you are using does not have a pre-defined HEALTHCHECK
instruction, use the --health-cmd parameter to check container health at runtime.
Based on the reported health status, remedial actions can be taken if necessary.
Impact:
None.
Audit:
You should run the command below and ensure that all containers are reporting their
health status:
docker ps --quiet | xargs docker inspect --format '{{ .Id }}: Health={{
.State.Health.Status }}'
Remediation:
You should run the container using the --health-cmd parameter.
For example:
docker run -d --health-cmd='stat /etc/passwd || exit 1' nginx
Default Value:
By default, health checks are not carried out at container runtime.
References:
1. https://docs.docker.com/engine/reference/run/#healthcheck
Page 219
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 220
5.27 Ensure that Docker commands always make use of the
latest version of their image (Manual)
Profile Applicability:
Page 221
References:
1. https://docs.docker.com/engine/reference/commandline/pull/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 222
5.28 Ensure that the PIDs cgroup limit is used (Automated)
Profile Applicability:
Rationale:
Attackers could launch a fork bomb with a single command inside the container. This
fork bomb could crash the entire system and would require a restart of the host to make
the system functional again. Using the PIDs cgroup parameter --pids-limit would
prevent this kind of attack by restricting the number of forks that can happen inside a
container within a specified time frame.
Impact:
Set the PIDs limit value as appropriate. Incorrect values might leave containers
unusable.
Audit:
You should run the command below and ensure that PidsLimit is not set to 0 or -1. A
PidsLimit of 0 or -1 means that any number of processes can be forked concurrently
inside the container.
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
PidsLimit={{ .HostConfig.PidsLimit }}'
Remediation:
Use --pids-limit flag with an appropriate value when launching the container.
For example:
docker run -it --pids-limit 100 <Image ID>
In the above example, the number of processes allowed to run at any given time is set
to 100. After a limit of 100 concurrently running processes is reached, Docker would
restrict any new process creation.
Default Value:
The Default value for --pids-limit is 0 which means there is no restriction on the
number of forks. Note that the PIDs cgroup limit works only for kernel versions 4.3 and
higher.
Page 223
References:
1. https://docs.docker.com/engine/reference/commandline/run/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 224
5.29 Ensure that Docker's default bridge "docker0" is not used
(Manual)
Profile Applicability:
Remediation:
You should follow the Docker documentation and set up a user-defined network. All the
containers should be run in this network.
Default Value:
References:
1. https://docs.docker.com/network/bridge/
Page 225
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 226
5.30 Ensure that the host's user namespaces are not shared
(Automated)
Profile Applicability:
User namespaces ensure that a root process inside the container will be mapped to a
non-root process outside the container. Sharing the user namespaces of the host with
the container does not therefore isolate users on the host from users in the containers.
Impact:
None
Audit:
You should run the command below and ensure that it does not return any value for
UsernsMode. If it returns a value of host, it means that the host user namespace is
shared with its containers.
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
UsernsMode={{ .HostConfig.UsernsMode }}'
Remediation:
You should not share user namespaces between host and containers.
For example, you should not run the command below:
docker run --rm -it --userns=host ubuntu bash
Default Value:
By default, the host user namespace is shared with containers unless user namespace
support is enabled.
References:
1. https://docs.docker.com/engine/security/userns-remap/
2. https://docs.docker.com/engine/reference/commandline/run/#options
Page 227
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
v7 12 Boundary Defense
Boundary Defense
Page 228
5.31 Ensure that the Docker socket is not mounted inside any
containers (Automated)
Profile Applicability:
Rationale:
If the Docker socket is mounted inside a container it could allow processes running
within the container to execute Docker commands which would effectively allow for full
control of the host.
Impact:
None
Audit:
You should run the following command:
docker ps --quiet --all | xargs docker inspect --format '{{ .Id }}:
Volumes={{ .Mounts }}' | grep docker.sock
This would return any instances where docker.sock had been mapped to a container as
a volume.
Remediation:
You should ensure that no containers mount docker.sock as a volume.
Default Value:
By default, docker.sock is not mounted inside containers.
References:
1. https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-
socket-option
Page 229
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 230
6 Docker Security Operations
This section covers some of the operational security issues associated with Docker
deployments. These are best practices that should be followed where possible. Most of
the recommendations in this section simply act as reminders that organizations should
extend their current security best practices and policies to include containers.
Page 231
6.1 Ensure that image sprawl is avoided (Manual)
Profile Applicability:
Page 232
docker images --quiet | xargs docker inspect --format '{{ .Id }}: Image={{
.Config.Image }}'
Step 2: List all the images present on the system by executing the command below:
docker images
Step 3: Compare the list of image IDs created from Step 1 and Step 2 to find out
images which are currently not being instantiated.
Step 4: Decide if you want to keep the images that are not currently in use. If they are
not needed, delete them by executing the following command:
docker rmi <IMAGE ID>
Alternatively, the docker system prune command can be used to remove dangling
images which are not tagged or, if necessary, all images that are not currently used by a
running container when used with the -a option.
Default Value:
Images and layered filesystems remain accessible on the host until the administrator
removes all tags that refer to those images or layers.
References:
1. https://docs.docker.com/config/pruning/
2. https://docs.docker.com/engine/reference/commandline/rmi/
3. https://docs.docker.com/engine/reference/commandline/pull/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 233
6.2 Ensure that container sprawl is avoided (Manual)
Profile Applicability:
Default Value:
By default, Docker does not restrict the number of containers you may have on a host.
Page 234
References:
1. https://docs.docker.com/config/pruning/#prune-containers
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 235
7 Docker Swarm Configuration
This section lists the recommendations that alter and secure the behavior of the Docker
Swarm. If you are not using Docker Swarm then the recommendations in this section do
not apply.
Page 236
7.1 Ensure swarm mode is not Enabled, if not needed
(Automated)
Profile Applicability:
By default, a Docker engine instance will not listen on any network ports, with all
communications with the client coming over the Unix socket. When Docker swarm
mode is enabled on a Docker engine instance, multiple network ports are opened on the
system and made available to other systems on the network for the purposes of cluster
management and node communications.
Opening network ports on a system increases its attack surface and this should be
avoided unless required.
It should be noted that swarm mode is required for the operation of Docker Enterprise
components.
Impact:
Disabling swarm mode will impact the operation of Docker Enterprise components if
these are in use.
Audit:
Review the output of
docker info --format '{{ .Swarm }}'
If the output includes active true it indicates that swarm mode has been activated on
the Docker engine. In this case, you should confirm if swarm mode on the Docker
engine instance is actually needed.
Remediation:
If swarm mode has been enabled on a system in error, you should run the command
below:
docker swarm leave
Default Value:
By default, Docker swarm mode is not enabled.
Page 237
References:
1. https://docs.docker.com/engine/reference/commandline/swarm_leave/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 238
7.2 Ensure that the minimum number of manager nodes have
been created in a swarm (Automated)
Profile Applicability:
Remediation:
If an excessive number of managers is configured, the excess nodes can be demoted to
workers using the following command:
docker node demote <ID>
Where <ID> is the node ID value of the manager to be demoted.
Default Value:
Only a single manager is required to start a given cluster.
Page 239
References:
1. https://docs.docker.com/engine/swarm/manage-nodes/
2. https://docs.docker.com/engine/swarm/admin_guide/#add-manager-nodes-for-
fault-tolerance
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 240
7.3 Ensure that swarm services are bound to a specific host
interface (Automated)
Profile Applicability:
Remediation:
Resolving this issues requires re-initialization of the swarm, specifying a specific
interface for the --listen-addr parameter.
Default Value:
By default, Docker swarm services listen on all available host interfaces.
References:
1. https://docs.docker.com/engine/reference/commandline/swarm_init/#--listen-addr
2. https://docs.docker.com/engine/swarm/admin_guide/#recover-from-disaster
Page 241
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 242
7.4 Ensure that all Docker swarm overlay networks are encrypted
(Automated)
Profile Applicability:
By default, data exchanged between containers on nodes on the overlay network is not
encrypted. This could potentially expose traffic between containers.
Impact:
None
Audit:
You should run the command below to ensure that each overlay network has been
encrypted.
docker network ls --filter driver=overlay --quiet | xargs docker network
inspect --format '{{.Name}} {{ .Options }}'
Remediation:
You should create overlay networks the with --opt encrypted flag.
Default Value:
By default, data exchanged in overlay networks in Docker swarm mode is not
encrypted.
References:
1. https://docs.docker.com/network/overlay/#encrypt-traffic-on-an-overlay-network
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 243
Controls
Control IG 1 IG 2 IG 3
Version
Page 244
7.5 Ensure that Docker's secret management commands are
used for managing secrets in a swarm cluster (Manual)
Profile Applicability:
Remediation:
You should follow the docker secret documentation and use it to manage secrets
effectively.
Default Value:
Not Applicable
References:
1. https://docs.docker.com/engine/reference/commandline/secret/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 245
Controls
Control IG 1 IG 2 IG 3
Version
Page 246
7.6 Ensure that swarm manager is run in auto-lock mode
(Automated)
Profile Applicability:
When Docker restarts, both the TLS key used to encrypt communication among swarm
nodes, and the key used to encrypt and decrypt Raft logs on disk, are loaded into each
manager node's memory. You could protect the mutual TLS encryption key and the key
used to encrypt and decrypt Raft logs at rest. This protection could be enabled by
initializing the swarm with the --autolock flag.
With --autolock enabled, when Docker restarts, you must unlock the swarm first, using
a key encryption key generated by Docker when the swarm was initialized.
This has benefits in a high security environment, however these should be balanced
against the support issues caused by the swarm not starting automatically if, for
example the host were to experience an outage.
Impact:
A swarm in auto-lock mode will not recover from a restart without manual intervention
from an administrator to enter the unlock key. This may not always be desirable, and
should be reviewed at a policy level.
Audit:
You should run the command below
docker info --format 'Swarm Autolock: {{
.Swarm.Cluster.Spec.EncryptionConfig.AutoLockManagers }}'
If the result is true, auto-lock mode is enable.
You could also run the command below. If a key value is returned, it means that the
swarm was initialized with the --autolock flag. If the output is no unlock key is set, it
means that swarm was NOT initialized with the --autolock flag. This should be
reviewed in line with the organization's IT Security policy.
docker swarm unlock-key
Remediation:
If you are initializing a swarm, use the command below.
Page 247
docker swarm init --autolock
If you want to set --autolock on an existing swarm manager node, use the following
command.
docker swarm update --autolock
Default Value:
By default, the swarm manager does not run in auto-lock mode.
References:
1. https://docs.docker.com/engine/swarm/swarm_manager_locking/
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 248
7.7 Ensure that the swarm manager auto-lock key is rotated
periodically (Manual)
Profile Applicability:
The swarm manager auto-lock key is not automatically rotated. Good security practice
is to rotate keys.
Impact:
None
Audit:
Currently, there is no mechanism to find out when the key was last rotated on a swarm
manager node. You should check with the system administrator to see if there is a key
rotation process, and how often the key is rotated.
Remediation:
You should run the command below to rotate the keys.
docker swarm unlock-key --rotate
Additionally, to facilitate auditing of this recommendation, you should maintain key
rotation records and ensure that you establish a pre-defined frequency for key rotation.
Default Value:
By default, keys are not rotated automatically.
References:
1. https://docs.docker.com/engine/reference/commandline/swarm_unlock-key/
Page 249
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 250
7.8 Ensure that node certificates are rotated as appropriate
(Manual)
Profile Applicability:
Remediation:
You should run the command to set the desired expiry time on the node certificate.
For example:
docker swarm update --cert-expiry 48h
Default Value:
By default, node certificates are rotated automatically every 90 days.
References:
1. https://docs.docker.com/engine/reference/commandline/swarm_update/#exampl
es
Page 251
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 252
7.9 Ensure that CA certificates are rotated as appropriate
(Manual)
Profile Applicability:
Docker Swarm uses TLS for clustering operations between its nodes. Certificate
rotation ensures that in an event such as a compromised node or key, it is difficult to
impersonate a node. Node certificates depend upon root CA certificates. For operational
security, it is important to rotate these frequently. Currently, root CA certificates are not
rotated automatically and you should therefore establish a process for rotating them in
line with your organizational security policy.
Impact:
None
Audit:
You should check the time stamp on the root CA certificate file.
For example:
ls -l /var/lib/docker/swarm/certificates/swarm-root-ca.crt
The certificate should show a time stamp in line with the organizational rotation policy.
Remediation:
Default Value:
By default, root CA certificates are not rotated.
References:
1. https://docs.docker.com/engine/swarm/how-swarm-mode-works/pki/#rotating-
the-ca-certificate
Page 253
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 254
7.10 Ensure that management plane traffic is separated from data
plane traffic (Manual)
Profile Applicability:
Separating management plane traffic from data plane traffic ensures that these types of
traffic are segregated from each other. These traffic flows can then be individually
monitored and tied to different traffic control policies and monitoring. This also ensures
that the management plane is always reachable even if there is a great deal of traffic on
the data plane.
Impact:
This requires two network interfaces per node.
Audit:
You should run the command below on each swarm node and ensure that the
management plane address is different from the data plane address.
docker node inspect --format '{{ .Status.Addr }}' self
Remediation:
You should initialize the swarm with dedicated interfaces for management and data
planes respectively.
For example,
docker swarm init --advertise-addr=192.168.0.1 --data-path-addr=17.1.0.3
Default Value:
By default, data plane traffic is not separated from management plane traffic.
References:
1. https://docs.docker.com/engine/reference/commandline/swarm_init/#--data-path-
addr
Page 255
CIS Controls:
Controls
Control IG 1 IG 2 IG 3
Version
Page 256
Appendix: Summary Table
CIS Benchmark Recommendation Set
Correctly
Yes No
1 Host Configuration
Page 257
CIS Benchmark Recommendation Set
Correctly
Yes No
Page 258
CIS Benchmark Recommendation Set
Correctly
Yes No
Page 259
CIS Benchmark Recommendation Set
Correctly
Yes No
Page 260
CIS Benchmark Recommendation Set
Correctly
Yes No
3.16 Ensure that the Docker socket file permissions are set to o o
660 or more restrictively (Automated)
4.1 Ensure that a user for the container has been created o o
(Automated)
Page 261
CIS Benchmark Recommendation Set
Correctly
Yes No
5.8 Ensure that only needed ports are open on the container o o
(Manual)
Page 262
CIS Benchmark Recommendation Set
Correctly
Yes No
5.22 Ensure that docker exec commands are not used with o o
the privileged option (Automated)
Page 263
CIS Benchmark Recommendation Set
Correctly
Yes No
5.23 Ensure that docker exec commands are not used with o o
the user=root option (Manual)
5.30 Ensure that the host's user namespaces are not shared o o
(Automated)
5.31 Ensure that the Docker socket is not mounted inside any o o
containers (Automated)
Page 264
CIS Benchmark Recommendation Set
Correctly
Yes No
Page 265
Appendix: CIS Controls v7 IG 1 Mapped
Recommendations
Recommendation Set
Correctly
Yes No
1.1.3 Ensure auditing is configured for the Docker daemon o o
2.3 Ensure the logging level is set to 'info' o o
3.2 Ensure that docker.service file permissions are
o o
appropriately set
3.4 Ensure that docker.socket file permissions are set to 644
o o
or more restrictive
3.6 Ensure that /etc/docker directory permissions are set to
o o
755 or more restrictively
3.8 Ensure that registry certificate file permissions are set to
o o
444 or more restrictively
3.10 Ensure that TLS CA certificate file permissions are set to
o o
444 or more restrictively
3.12 Ensure that the Docker server certificate file permissions
o o
are set to 444 or more restrictively
3.14 Ensure that the Docker server certificate key file
o o
permissions are set to 400
3.16 Ensure that the Docker socket file permissions are set to
o o
660 or more restrictively
3.18 Ensure that daemon.json file permissions are set to 644
o o
or more restrictive
3.20 Ensure that the /etc/default/docker file permissions are
o o
set to 644 or more restrictively
3.21 Ensure that the /etc/sysconfig/docker file permissions are
o o
set to 644 or more restrictively
3.24 Ensure that the Containerd socket file permissions are
o o
set to 660 or more restrictively
5.24 Ensure that cgroup usage is confirmed o o
6.2 Ensure that container sprawl is avoided o o
7.2 Ensure that the minimum number of manager nodes
o o
have been created in a swarm
Page 266
Recommendation Set
Correctly
Yes No
7.5 Ensure that Docker's secret management commands are
o o
used for managing secrets in a swarm cluster
Page 267
Appendix: CIS Controls v7 IG 2 Mapped
Recommendations
Recommendation Set
Correctly
Yes No
1.1.3 Ensure auditing is configured for the Docker daemon o o
2.3 Ensure the logging level is set to 'info' o o
2.5 Ensure insecure registries are not used o o
2.7 Ensure TLS authentication for Docker daemon is
o o
configured
2.13 Ensure centralized and remote logging is configured o o
2.16 Ensure Userland Proxy is Disabled o o
3.2 Ensure that docker.service file permissions are
o o
appropriately set
3.4 Ensure that docker.socket file permissions are set to 644
o o
or more restrictive
3.6 Ensure that /etc/docker directory permissions are set to
o o
755 or more restrictively
3.8 Ensure that registry certificate file permissions are set to
o o
444 or more restrictively
3.10 Ensure that TLS CA certificate file permissions are set to
o o
444 or more restrictively
3.12 Ensure that the Docker server certificate file permissions
o o
are set to 444 or more restrictively
3.14 Ensure that the Docker server certificate key file
o o
permissions are set to 400
3.16 Ensure that the Docker socket file permissions are set to
o o
660 or more restrictively
3.18 Ensure that daemon.json file permissions are set to 644
o o
or more restrictive
3.20 Ensure that the /etc/default/docker file permissions are
o o
set to 644 or more restrictively
3.21 Ensure that the /etc/sysconfig/docker file permissions are
o o
set to 644 or more restrictively
Page 268
Recommendation Set
Correctly
Yes No
3.24 Ensure that the Containerd socket file permissions are
o o
set to 660 or more restrictively
4.2 Ensure that containers use only trusted base images o o
4.3 Ensure that unnecessary packages are not installed in
o o
the container
4.4 Ensure images are scanned and rebuilt to include
o o
security patches
4.6 Ensure that HEALTHCHECK instructions have been
o o
added to container images
4.7 Ensure update instructions are not used alone in
o o
Dockerfiles
4.9 Ensure that COPY is used instead of ADD in Dockerfiles o o
4.11 Ensure only verified packages are installed o o
5.1 Ensure that, if applicable, an AppArmor Profile is enabled o o
5.2 Ensure that, if applicable, SELinux security options are
o o
set
5.3 Ensure that Linux kernel capabilities are restricted within
o o
containers
5.6 Ensure sshd is not run within containers o o
5.7 Ensure privileged ports are not mapped within containers o o
5.8 Ensure that only needed ports are open on the container o o
5.14 Ensure that the 'on-failure' container restart policy is set
o o
to '5'
5.15 Ensure that the host's process namespace is not shared o o
5.16 Ensure that the host's IPC namespace is not shared o o
5.18 Ensure that the default ulimit is overwritten at runtime if
o o
needed
5.20 Ensure that the host's UTS namespace is not shared o o
5.24 Ensure that cgroup usage is confirmed o o
5.26 Ensure that container health is checked at runtime o o
5.27 Ensure that Docker commands always make use of the
o o
latest version of their image
5.28 Ensure that the PIDs cgroup limit is used o o
5.30 Ensure that the host's user namespaces are not shared o o
Page 269
Recommendation Set
Correctly
Yes No
6.1 Ensure that image sprawl is avoided o o
6.2 Ensure that container sprawl is avoided o o
7.1 Ensure swarm mode is not Enabled, if not needed o o
7.2 Ensure that the minimum number of manager nodes
o o
have been created in a swarm
7.4 Ensure that all Docker swarm overlay networks are
o o
encrypted
7.5 Ensure that Docker's secret management commands are
o o
used for managing secrets in a swarm cluster
7.7 Ensure that the swarm manager auto-lock key is rotated
o o
periodically
7.8 Ensure that node certificates are rotated as appropriate o o
7.9 Ensure that CA certificates are rotated as appropriate o o
7.10 Ensure that management plane traffic is separated from
o o
data plane traffic
Page 270
Appendix: CIS Controls v7 IG 3 Mapped
Recommendations
Recommendation Set
Correctly
Yes No
1.1.3 Ensure auditing is configured for the Docker daemon o o
1.1.4 Ensure auditing is configured for Docker files and
o o
directories - /run/containerd
1.1.5 Ensure auditing is configured for Docker files and
o o
directories - /var/lib/docker
1.1.6 Ensure auditing is configured for Docker files and
o o
directories - /etc/docker
1.1.7 Ensure auditing is configured for Docker files and
o o
directories - docker.service
1.1.8 Ensure auditing is configured for Docker files and
o o
directories - containerd.sock
1.1.9 Ensure auditing is configured for Docker files and
o o
directories - docker.socket
1.1.10 Ensure auditing is configured for Docker files and
o o
directories - /etc/default/docker
1.1.11 Ensure auditing is configured for Docker files and
o o
directories - /etc/docker/daemon.json
1.1.12 Ensure auditing is configured for Docker files and
o o
directories - /etc/containerd/config.toml
1.1.13 Ensure auditing is configured for Docker files and
o o
directories - /etc/sysconfig/docker
1.1.14 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd
1.1.15 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim
1.1.16 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim-runc-v1
1.1.17 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim-runc-v2
1.1.18 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/runc
Page 271
Recommendation Set
Correctly
Yes No
2.3 Ensure the logging level is set to 'info' o o
2.5 Ensure insecure registries are not used o o
2.7 Ensure TLS authentication for Docker daemon is
o o
configured
2.13 Ensure centralized and remote logging is configured o o
2.16 Ensure Userland Proxy is Disabled o o
3.2 Ensure that docker.service file permissions are
o o
appropriately set
3.4 Ensure that docker.socket file permissions are set to 644
o o
or more restrictive
3.6 Ensure that /etc/docker directory permissions are set to
o o
755 or more restrictively
3.8 Ensure that registry certificate file permissions are set to
o o
444 or more restrictively
3.10 Ensure that TLS CA certificate file permissions are set to
o o
444 or more restrictively
3.12 Ensure that the Docker server certificate file permissions
o o
are set to 444 or more restrictively
3.14 Ensure that the Docker server certificate key file
o o
permissions are set to 400
3.16 Ensure that the Docker socket file permissions are set to
o o
660 or more restrictively
3.18 Ensure that daemon.json file permissions are set to 644
o o
or more restrictive
3.20 Ensure that the /etc/default/docker file permissions are
o o
set to 644 or more restrictively
3.21 Ensure that the /etc/sysconfig/docker file permissions are
o o
set to 644 or more restrictively
3.24 Ensure that the Containerd socket file permissions are
o o
set to 660 or more restrictively
4.2 Ensure that containers use only trusted base images o o
4.3 Ensure that unnecessary packages are not installed in
o o
the container
4.4 Ensure images are scanned and rebuilt to include
o o
security patches
Page 272
Recommendation Set
Correctly
Yes No
4.6 Ensure that HEALTHCHECK instructions have been
o o
added to container images
4.7 Ensure update instructions are not used alone in
o o
Dockerfiles
4.9 Ensure that COPY is used instead of ADD in Dockerfiles o o
4.11 Ensure only verified packages are installed o o
4.12 Ensure all signed artifacts are validated o o
5.1 Ensure that, if applicable, an AppArmor Profile is enabled o o
5.2 Ensure that, if applicable, SELinux security options are
o o
set
5.3 Ensure that Linux kernel capabilities are restricted within
o o
containers
5.6 Ensure sshd is not run within containers o o
5.7 Ensure privileged ports are not mapped within containers o o
5.8 Ensure that only needed ports are open on the container o o
5.14 Ensure that the 'on-failure' container restart policy is set
o o
to '5'
5.15 Ensure that the host's process namespace is not shared o o
5.16 Ensure that the host's IPC namespace is not shared o o
5.18 Ensure that the default ulimit is overwritten at runtime if
o o
needed
5.20 Ensure that the host's UTS namespace is not shared o o
5.21 Ensure the default seccomp profile is not Disabled o o
5.24 Ensure that cgroup usage is confirmed o o
5.26 Ensure that container health is checked at runtime o o
5.27 Ensure that Docker commands always make use of the
o o
latest version of their image
5.28 Ensure that the PIDs cgroup limit is used o o
5.30 Ensure that the host's user namespaces are not shared o o
6.1 Ensure that image sprawl is avoided o o
6.2 Ensure that container sprawl is avoided o o
7.1 Ensure swarm mode is not Enabled, if not needed o o
Page 273
Recommendation Set
Correctly
Yes No
7.2 Ensure that the minimum number of manager nodes
o o
have been created in a swarm
7.4 Ensure that all Docker swarm overlay networks are
o o
encrypted
7.5 Ensure that Docker's secret management commands are
o o
used for managing secrets in a swarm cluster
7.6 Ensure that swarm manager is run in auto-lock mode o o
7.7 Ensure that the swarm manager auto-lock key is rotated
o o
periodically
7.8 Ensure that node certificates are rotated as appropriate o o
7.9 Ensure that CA certificates are rotated as appropriate o o
7.10 Ensure that management plane traffic is separated from
o o
data plane traffic
Page 274
Appendix: CIS Controls v7 Unmapped
Recommendations
Recommendation Set
Correctly
Yes No
5.29 Ensure that Docker's default bridge "docker0" is not used o o
Page 275
Appendix: CIS Controls v8 IG 1 Mapped
Recommendations
Recommendation Set
Correctly
Yes No
1.1.2 Ensure only trusted users are allowed to control Docker
o o
daemon
1.1.3 Ensure auditing is configured for the Docker daemon o o
2.1 Run the Docker daemon as a non-root user, if possible o o
2.13 Ensure centralized and remote logging is configured o o
2.14 Ensure containers are restricted from acquiring new
o o
privileges
3.1 Ensure that the docker.service file ownership is set to
o o
root:root
3.2 Ensure that docker.service file permissions are
o o
appropriately set
3.3 Ensure that docker.socket file ownership is set to
o o
root:root
3.4 Ensure that docker.socket file permissions are set to 644
o o
or more restrictive
3.5 Ensure that the /etc/docker directory ownership is set to
o o
root:root
3.6 Ensure that /etc/docker directory permissions are set to
o o
755 or more restrictively
3.7 Ensure that registry certificate file ownership is set to
o o
root:root
3.8 Ensure that registry certificate file permissions are set to
o o
444 or more restrictively
3.9 Ensure that TLS CA certificate file ownership is set to
o o
root:root
3.10 Ensure that TLS CA certificate file permissions are set to
o o
444 or more restrictively
3.11 Ensure that Docker server certificate file ownership is set
o o
to root:root
3.12 Ensure that the Docker server certificate file permissions
o o
are set to 444 or more restrictively
Page 276
Recommendation Set
Correctly
Yes No
3.13 Ensure that the Docker server certificate key file
o o
ownership is set to root:root
3.14 Ensure that the Docker server certificate key file
o o
permissions are set to 400
3.15 Ensure that the Docker socket file ownership is set to
o o
root:docker
3.16 Ensure that the Docker socket file permissions are set to
o o
660 or more restrictively
3.17 Ensure that the daemon.json file ownership is set to
o o
root:root
3.18 Ensure that daemon.json file permissions are set to 644
o o
or more restrictive
3.19 Ensure that the /etc/default/docker file ownership is set to
o o
root:root
3.20 Ensure that the /etc/default/docker file permissions are
o o
set to 644 or more restrictively
3.21 Ensure that the /etc/sysconfig/docker file permissions are
o o
set to 644 or more restrictively
3.22 Ensure that the /etc/sysconfig/docker file ownership is set
o o
to root:root
3.23 Ensure that the Containerd socket file ownership is set to
o o
root:root
3.24 Ensure that the Containerd socket file permissions are
o o
set to 660 or more restrictively
4.8 Ensure setuid and setgid permissions are removed o o
4.11 Ensure only verified packages are installed o o
5.4 Ensure that privileged containers are not used o o
5.13 Ensure that incoming container traffic is bound to a
o o
specific host interface
5.17 Ensure that host devices are not directly exposed to
o o
containers
5.21 Ensure the default seccomp profile is not Disabled o o
5.22 Ensure that docker exec commands are not used with
o o
the privileged option
Page 277
Recommendation Set
Correctly
Yes No
5.23 Ensure that docker exec commands are not used with
o o
the user=root option
5.24 Ensure that cgroup usage is confirmed o o
5.25 Ensure that the container is restricted from acquiring
o o
additional privileges
5.31 Ensure that the Docker socket is not mounted inside any
o o
containers
7.3 Ensure that swarm services are bound to a specific host
o o
interface
7.7 Ensure that the swarm manager auto-lock key is rotated
o o
periodically
7.8 Ensure that node certificates are rotated as appropriate o o
7.9 Ensure that CA certificates are rotated as appropriate o o
Page 278
Appendix: CIS Controls v8 IG 2 Mapped
Recommendations
Recommendation Set
Correctly
Yes No
1.1.1 Ensure a separate partition for containers has been
o o
created
1.1.2 Ensure only trusted users are allowed to control Docker
o o
daemon
1.1.3 Ensure auditing is configured for the Docker daemon o o
1.1.4 Ensure auditing is configured for Docker files and
o o
directories - /run/containerd
1.1.5 Ensure auditing is configured for Docker files and
o o
directories - /var/lib/docker
1.1.6 Ensure auditing is configured for Docker files and
o o
directories - /etc/docker
1.1.7 Ensure auditing is configured for Docker files and
o o
directories - docker.service
1.1.8 Ensure auditing is configured for Docker files and
o o
directories - containerd.sock
1.1.9 Ensure auditing is configured for Docker files and
o o
directories - docker.socket
1.1.10 Ensure auditing is configured for Docker files and
o o
directories - /etc/default/docker
1.1.11 Ensure auditing is configured for Docker files and
o o
directories - /etc/docker/daemon.json
1.1.12 Ensure auditing is configured for Docker files and
o o
directories - /etc/containerd/config.toml
1.1.13 Ensure auditing is configured for Docker files and
o o
directories - /etc/sysconfig/docker
1.1.14 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd
1.1.15 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim
1.1.16 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim-runc-v1
Page 279
Recommendation Set
Correctly
Yes No
1.1.17 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim-runc-v2
1.1.18 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/runc
1.2.1 Ensure the container host has been Hardened o o
1.2.2 Ensure that the version of Docker is up to date o o
2.1 Run the Docker daemon as a non-root user, if possible o o
2.2 Ensure network traffic is restricted between containers on
o o
the default bridge
2.3 Ensure the logging level is set to 'info' o o
2.4 Ensure Docker is allowed to make changes to iptables o o
2.5 Ensure insecure registries are not used o o
2.7 Ensure TLS authentication for Docker daemon is
o o
configured
2.8 Ensure the default ulimit is configured appropriately o o
2.11 Ensure base device size is not changed until needed o o
2.13 Ensure centralized and remote logging is configured o o
2.14 Ensure containers are restricted from acquiring new
o o
privileges
2.15 Ensure live restore is enabled o o
2.16 Ensure Userland Proxy is Disabled o o
2.18 Ensure that experimental features are not implemented
o o
in production
3.1 Ensure that the docker.service file ownership is set to
o o
root:root
3.2 Ensure that docker.service file permissions are
o o
appropriately set
3.3 Ensure that docker.socket file ownership is set to
o o
root:root
3.4 Ensure that docker.socket file permissions are set to 644
o o
or more restrictive
3.5 Ensure that the /etc/docker directory ownership is set to
o o
root:root
Page 280
Recommendation Set
Correctly
Yes No
3.6 Ensure that /etc/docker directory permissions are set to
o o
755 or more restrictively
3.7 Ensure that registry certificate file ownership is set to
o o
root:root
3.8 Ensure that registry certificate file permissions are set to
o o
444 or more restrictively
3.9 Ensure that TLS CA certificate file ownership is set to
o o
root:root
3.10 Ensure that TLS CA certificate file permissions are set to
o o
444 or more restrictively
3.11 Ensure that Docker server certificate file ownership is set
o o
to root:root
3.12 Ensure that the Docker server certificate file permissions
o o
are set to 444 or more restrictively
3.13 Ensure that the Docker server certificate key file
o o
ownership is set to root:root
3.14 Ensure that the Docker server certificate key file
o o
permissions are set to 400
3.15 Ensure that the Docker socket file ownership is set to
o o
root:docker
3.16 Ensure that the Docker socket file permissions are set to
o o
660 or more restrictively
3.17 Ensure that the daemon.json file ownership is set to
o o
root:root
3.18 Ensure that daemon.json file permissions are set to 644
o o
or more restrictive
3.19 Ensure that the /etc/default/docker file ownership is set to
o o
root:root
3.20 Ensure that the /etc/default/docker file permissions are
o o
set to 644 or more restrictively
3.21 Ensure that the /etc/sysconfig/docker file permissions are
o o
set to 644 or more restrictively
3.22 Ensure that the /etc/sysconfig/docker file ownership is set
o o
to root:root
3.23 Ensure that the Containerd socket file ownership is set to
o o
root:root
Page 281
Recommendation Set
Correctly
Yes No
3.24 Ensure that the Containerd socket file permissions are
o o
set to 660 or more restrictively
4.2 Ensure that containers use only trusted base images o o
4.3 Ensure that unnecessary packages are not installed in
o o
the container
4.4 Ensure images are scanned and rebuilt to include
o o
security patches
4.7 Ensure update instructions are not used alone in
o o
Dockerfiles
4.8 Ensure setuid and setgid permissions are removed o o
4.9 Ensure that COPY is used instead of ADD in Dockerfiles o o
4.11 Ensure only verified packages are installed o o
5.1 Ensure that, if applicable, an AppArmor Profile is enabled o o
5.2 Ensure that, if applicable, SELinux security options are
o o
set
5.3 Ensure that Linux kernel capabilities are restricted within
o o
containers
5.4 Ensure that privileged containers are not used o o
5.6 Ensure sshd is not run within containers o o
5.9 Ensure that the host's network namespace is not shared o o
5.10 Ensure that the memory usage for containers is limited o o
5.11 Ensure that CPU priority is set appropriately on
o o
containers
5.13 Ensure that incoming container traffic is bound to a
o o
specific host interface
5.15 Ensure that the host's process namespace is not shared o o
5.16 Ensure that the host's IPC namespace is not shared o o
5.17 Ensure that host devices are not directly exposed to
o o
containers
5.18 Ensure that the default ulimit is overwritten at runtime if
o o
needed
5.20 Ensure that the host's UTS namespace is not shared o o
5.21 Ensure the default seccomp profile is not Disabled o o
Page 282
Recommendation Set
Correctly
Yes No
5.22 Ensure that docker exec commands are not used with
o o
the privileged option
5.23 Ensure that docker exec commands are not used with
o o
the user=root option
5.24 Ensure that cgroup usage is confirmed o o
5.25 Ensure that the container is restricted from acquiring
o o
additional privileges
5.26 Ensure that container health is checked at runtime o o
5.29 Ensure that Docker's default bridge "docker0" is not used o o
5.30 Ensure that the host's user namespaces are not shared o o
5.31 Ensure that the Docker socket is not mounted inside any
o o
containers
6.1 Ensure that image sprawl is avoided o o
6.2 Ensure that container sprawl is avoided o o
7.1 Ensure swarm mode is not Enabled, if not needed o o
7.3 Ensure that swarm services are bound to a specific host
o o
interface
7.4 Ensure that all Docker swarm overlay networks are
o o
encrypted
7.6 Ensure that swarm manager is run in auto-lock mode o o
7.7 Ensure that the swarm manager auto-lock key is rotated
o o
periodically
7.8 Ensure that node certificates are rotated as appropriate o o
7.9 Ensure that CA certificates are rotated as appropriate o o
7.10 Ensure that management plane traffic is separated from
o o
data plane traffic
Page 283
Appendix: CIS Controls v8 IG 3 Mapped
Recommendations
Recommendation Set
Correctly
Yes No
1.1.1 Ensure a separate partition for containers has been
o o
created
1.1.2 Ensure only trusted users are allowed to control Docker
o o
daemon
1.1.3 Ensure auditing is configured for the Docker daemon o o
1.1.4 Ensure auditing is configured for Docker files and
o o
directories - /run/containerd
1.1.5 Ensure auditing is configured for Docker files and
o o
directories - /var/lib/docker
1.1.6 Ensure auditing is configured for Docker files and
o o
directories - /etc/docker
1.1.7 Ensure auditing is configured for Docker files and
o o
directories - docker.service
1.1.8 Ensure auditing is configured for Docker files and
o o
directories - containerd.sock
1.1.9 Ensure auditing is configured for Docker files and
o o
directories - docker.socket
1.1.10 Ensure auditing is configured for Docker files and
o o
directories - /etc/default/docker
1.1.11 Ensure auditing is configured for Docker files and
o o
directories - /etc/docker/daemon.json
1.1.12 Ensure auditing is configured for Docker files and
o o
directories - /etc/containerd/config.toml
1.1.13 Ensure auditing is configured for Docker files and
o o
directories - /etc/sysconfig/docker
1.1.14 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd
1.1.15 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim
1.1.16 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim-runc-v1
Page 284
Recommendation Set
Correctly
Yes No
1.1.17 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/containerd-shim-runc-v2
1.1.18 Ensure auditing is configured for Docker files and
o o
directories - /usr/bin/runc
1.2.1 Ensure the container host has been Hardened o o
1.2.2 Ensure that the version of Docker is up to date o o
2.1 Run the Docker daemon as a non-root user, if possible o o
2.2 Ensure network traffic is restricted between containers on
o o
the default bridge
2.3 Ensure the logging level is set to 'info' o o
2.4 Ensure Docker is allowed to make changes to iptables o o
2.5 Ensure insecure registries are not used o o
2.7 Ensure TLS authentication for Docker daemon is
o o
configured
2.8 Ensure the default ulimit is configured appropriately o o
2.11 Ensure base device size is not changed until needed o o
2.13 Ensure centralized and remote logging is configured o o
2.14 Ensure containers are restricted from acquiring new
o o
privileges
2.15 Ensure live restore is enabled o o
2.16 Ensure Userland Proxy is Disabled o o
2.18 Ensure that experimental features are not implemented
o o
in production
3.1 Ensure that the docker.service file ownership is set to
o o
root:root
3.2 Ensure that docker.service file permissions are
o o
appropriately set
3.3 Ensure that docker.socket file ownership is set to
o o
root:root
3.4 Ensure that docker.socket file permissions are set to 644
o o
or more restrictive
3.5 Ensure that the /etc/docker directory ownership is set to
o o
root:root
Page 285
Recommendation Set
Correctly
Yes No
3.6 Ensure that /etc/docker directory permissions are set to
o o
755 or more restrictively
3.7 Ensure that registry certificate file ownership is set to
o o
root:root
3.8 Ensure that registry certificate file permissions are set to
o o
444 or more restrictively
3.9 Ensure that TLS CA certificate file ownership is set to
o o
root:root
3.10 Ensure that TLS CA certificate file permissions are set to
o o
444 or more restrictively
3.11 Ensure that Docker server certificate file ownership is set
o o
to root:root
3.12 Ensure that the Docker server certificate file permissions
o o
are set to 444 or more restrictively
3.13 Ensure that the Docker server certificate key file
o o
ownership is set to root:root
3.14 Ensure that the Docker server certificate key file
o o
permissions are set to 400
3.15 Ensure that the Docker socket file ownership is set to
o o
root:docker
3.16 Ensure that the Docker socket file permissions are set to
o o
660 or more restrictively
3.17 Ensure that the daemon.json file ownership is set to
o o
root:root
3.18 Ensure that daemon.json file permissions are set to 644
o o
or more restrictive
3.19 Ensure that the /etc/default/docker file ownership is set to
o o
root:root
3.20 Ensure that the /etc/default/docker file permissions are
o o
set to 644 or more restrictively
3.21 Ensure that the /etc/sysconfig/docker file permissions are
o o
set to 644 or more restrictively
3.22 Ensure that the /etc/sysconfig/docker file ownership is set
o o
to root:root
3.23 Ensure that the Containerd socket file ownership is set to
o o
root:root
Page 286
Recommendation Set
Correctly
Yes No
3.24 Ensure that the Containerd socket file permissions are
o o
set to 660 or more restrictively
4.2 Ensure that containers use only trusted base images o o
4.3 Ensure that unnecessary packages are not installed in
o o
the container
4.4 Ensure images are scanned and rebuilt to include
o o
security patches
4.6 Ensure that HEALTHCHECK instructions have been
o o
added to container images
4.7 Ensure update instructions are not used alone in
o o
Dockerfiles
4.8 Ensure setuid and setgid permissions are removed o o
4.9 Ensure that COPY is used instead of ADD in Dockerfiles o o
4.11 Ensure only verified packages are installed o o
4.12 Ensure all signed artifacts are validated o o
5.1 Ensure that, if applicable, an AppArmor Profile is enabled o o
5.2 Ensure that, if applicable, SELinux security options are
o o
set
5.3 Ensure that Linux kernel capabilities are restricted within
o o
containers
5.4 Ensure that privileged containers are not used o o
5.6 Ensure sshd is not run within containers o o
5.7 Ensure privileged ports are not mapped within containers o o
5.8 Ensure that only needed ports are open on the container o o
5.9 Ensure that the host's network namespace is not shared o o
5.10 Ensure that the memory usage for containers is limited o o
5.11 Ensure that CPU priority is set appropriately on
o o
containers
5.13 Ensure that incoming container traffic is bound to a
o o
specific host interface
5.15 Ensure that the host's process namespace is not shared o o
5.16 Ensure that the host's IPC namespace is not shared o o
5.17 Ensure that host devices are not directly exposed to
o o
containers
Page 287
Recommendation Set
Correctly
Yes No
5.18 Ensure that the default ulimit is overwritten at runtime if
o o
needed
5.20 Ensure that the host's UTS namespace is not shared o o
5.21 Ensure the default seccomp profile is not Disabled o o
5.22 Ensure that docker exec commands are not used with
o o
the privileged option
5.23 Ensure that docker exec commands are not used with
o o
the user=root option
5.24 Ensure that cgroup usage is confirmed o o
5.25 Ensure that the container is restricted from acquiring
o o
additional privileges
5.26 Ensure that container health is checked at runtime o o
5.29 Ensure that Docker's default bridge "docker0" is not used o o
5.30 Ensure that the host's user namespaces are not shared o o
5.31 Ensure that the Docker socket is not mounted inside any
o o
containers
6.1 Ensure that image sprawl is avoided o o
6.2 Ensure that container sprawl is avoided o o
7.1 Ensure swarm mode is not Enabled, if not needed o o
7.3 Ensure that swarm services are bound to a specific host
o o
interface
7.4 Ensure that all Docker swarm overlay networks are
o o
encrypted
7.6 Ensure that swarm manager is run in auto-lock mode o o
7.7 Ensure that the swarm manager auto-lock key is rotated
o o
periodically
7.8 Ensure that node certificates are rotated as appropriate o o
7.9 Ensure that CA certificates are rotated as appropriate o o
7.10 Ensure that management plane traffic is separated from
o o
data plane traffic
Page 288
Appendix: CIS Controls v8 Unmapped
Recommendations
Recommendation Set
Correctly
Yes No
o o
Page 289
Appendix: Change History
Date Version Changes for this version
Page 290
Date Version Changes for this version
Page 291