Merge pull request #469 from konstruktoid/v131

Initial v1.3.1 PR
This commit is contained in:
Thomas Sjögren 2021-05-25 18:52:43 +00:00 committed by GitHub
commit 3769a64a2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 741 additions and 833 deletions

View file

@ -8,13 +8,10 @@ project, and follows the same rules and principles. If you're already familiar
with the way Docker does things, you'll feel right at home.
Otherwise, go read
[Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md).
[Contribute to the Moby Project](https://github.com/moby/moby/blob/master/CONTRIBUTING.md).
## Development Environment Setup
The only thing you need to hack on Docker Bench for Security is a POSIX 2004
compliant shell. We try to keep the project compliant for maximum portability.
### Start hacking
You can build the container that wraps the docker-bench for security:
@ -53,12 +50,9 @@ tests/
```
To modify the Docker Bench for Security you should first clone the repository,
make your changes, check your code with `shellcheck`, `checkbashisms` or similar
tools, and then sign off on your commits. After that feel free to send us a
pull request with the changes.
make your changes, check your code with `shellcheck`, or similar tools, and
then sign off on your commits. After that feel free to send us a pull request
with the changes.
While this tool was inspired by the [CIS Docker 1.11.0 benchmark](https://www.cisecurity.org/benchmark/docker/)
and its successors, feel free to add new tests. We will try to turn
[dockerbench.com](https://dockerbench.com) into a list of good community
benchmarks for both security and performance, and we would love community
contributions.
and its successors, feel free to add new tests.

View file

@ -2,9 +2,7 @@
![Docker Bench for Security running](img/benchmark_log.png)
The Docker Bench for Security is a script that checks for dozens of common best-practices around deploying Docker containers in production. The tests are all automated, and are inspired by the [CIS Docker Benchmark v1.2.0](https://www.cisecurity.org/benchmark/docker/).
The list with all tests is available [here](tests/TESTS.md).
The Docker Bench for Security is a script that checks for dozens of common best-practices around deploying Docker containers in production. The tests are all automated, and are based on the [CIS Docker Benchmark v1.3.1](https://www.cisecurity.org/benchmark/docker/).
We are making this available as an open-source utility so the Docker community can have an easy way to self-assess their hosts and docker containers against this benchmark.
@ -99,7 +97,7 @@ logs in the log folder from current directory, named `docker-bench-security.sh.l
If the docker container is used then the log files will be created inside the container in location `/usr/local/bin/log/`. If you wish to access them from the host after the container has been run you will need to mount a volume for storing them in.
The CIS based checks are named `check_<section>_<number>`, e.g. `check_2_6` and community contributed checks are named `check_c_<number>`. A complete list of checks is present in [TESTS.md](tests/TESTS.md).
The CIS based checks are named `check_<section>_<number>`, e.g. `check_2_6` and community contributed checks are named `check_c_<number>`.
`sh docker-bench-security.sh -c check_2_2` will only run check `2.2 Ensure the logging level is set to 'info'`.
@ -134,5 +132,3 @@ git clone https://github.com/docker/docker-bench-security.git
cd docker-bench-security
docker-compose run --rm docker-bench-security
```
This script was built to be POSIX 2004 compliant, so it should be portable across any Unix platform.

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Docker Bench for Security
#
@ -36,7 +36,7 @@ usage () {
cat <<EOF
Docker Bench for Security - Docker, Inc. (c) 2015-$(date +"%Y")
Checks for dozens of common best-practices around deploying Docker containers in production.
Inspired by the CIS Docker Benchmark v1.2.0.
Based on the CIS Docker Benchmark 1.3.1.
Usage: ${myname}.sh [OPTIONS]
@ -58,7 +58,7 @@ Options:
-i INCLUDE optional Comma delimited list of patterns within a container or image name to check
-x EXCLUDE optional Comma delimited list of patterns within a container or image name to exclude from check
-n LIMIT optional In JSON output, when reporting lists of items (containers, images, etc.), limit the number of reported items to LIMIT. Default 0 (no limit).
-p PRINT optional Disable the printing of remediation measures. Default: print remediation measures.
-p PRINT optional Print remediation measures. Default: Don't print remediation measures.
Complete list of checks: <https://github.com/docker/docker-bench-security/blob/master/tests/>
Full documentation: <https://github.com/docker/docker-bench-security>
@ -70,9 +70,10 @@ EOF
if [ ! -d log ]; then
mkdir log
fi
logger="log/${myname}.log"
limit=0
printremediation="1"
printremediation="0"
globalRemediation=""
# Get the flags
@ -90,7 +91,7 @@ do
i) include="$OPTARG" ;;
x) exclude="$OPTARG" ;;
n) limit="$OPTARG" ;;
p) printremediation="0" ;;
p) printremediation="1" ;;
*) usage; exit 1 ;;
esac
done
@ -101,8 +102,7 @@ done
yell_info
# Warn if not root
ID=$(id -u)
if [ "x$ID" != "x0" ]; then
if [ "$(id -u)" != "0" ]; then
warn "$(yell 'Some tests might require root to run')\n"
sleep 3
fi
@ -118,7 +118,7 @@ beginjson "$version" "$(date +%s)"
# Load all the tests from tests/ and run them
main () {
logit "\n${bldylw}Section A - Check results${txtrsr}"
logit "\n${bldylw}Section A - Check results${txtrst}"
# Get configuration location
get_docker_configuration_file

View file

@ -5,65 +5,60 @@ host_configuration() {
check_1_1
check_1_1_1
check_1_1_2
check_1_1_3
check_1_1_4
check_1_1_5
check_1_1_6
check_1_1_7
check_1_1_8
check_1_1_9
check_1_1_10
check_1_1_11
check_1_1_12
check_1_1_13
check_1_1_14
check_1_1_15
check_1_1_16
check_1_1_17
check_1_1_18
check_1_2
check_1_2_1
check_1_2_2
check_1_2_3
check_1_2_4
check_1_2_5
check_1_2_6
check_1_2_7
check_1_2_8
check_1_2_9
check_1_2_10
check_1_2_11
check_1_2_12
check_1_end
}
host_configuration_level1() {
check_1
check_1_1
check_1_1_1
check_1_1_2
check_1_2
check_1_2_1
check_1_2_2
check_1_2_3
check_1_2_5
check_1_2_6
check_1_2_7
check_1_2_8
check_1_2_9
check_1_2_10
check_1_2_11
check_1_2_12
check_1_end
}
host_general_configuration() {
check_1
check_1_1
check_1_1_1
check_1_1_2
check_1_end
}
linux_hosts_specific_configuration() {
check_1_1
check_1_1_1
check_1_1_2
check_1_1_3
check_1_1_4
check_1_1_5
check_1_1_6
check_1_1_7
check_1_1_8
check_1_1_9
check_1_1_10
check_1_1_11
check_1_1_12
check_1_1_13
check_1_1_14
check_1_1_15
check_1_1_16
check_1_1_17
check_1_1_18
}
host_general_configuration() {
check_1
check_1_2
check_1_2_1
check_1_2_2
check_1_2_3
check_1_2_4
check_1_2_5
check_1_2_6
check_1_2_7
check_1_2_8
check_1_2_9
check_1_2_10
check_1_2_11
check_1_2_12
check_1_end
}
@ -86,22 +81,12 @@ docker_daemon_configuration() {
check_2_15
check_2_16
check_2_17
check_2_18
check_2_end
}
docker_daemon_configuration_level1() {
check_2
check_2_1
check_2_2
check_2_3
check_2_4
check_2_5
check_2_6
check_2_7
check_2_13
check_2_14
check_2_16
check_2_17
check_2_end
}
@ -129,33 +114,13 @@ docker_daemon_files() {
check_3_20
check_3_21
check_3_22
check_3_23
check_3_24
check_3_end
}
docker_daemon_files_level1() {
check_3
check_3_1
check_3_2
check_3_3
check_3_4
check_3_5
check_3_6
check_3_7
check_3_8
check_3_9
check_3_10
check_3_11
check_3_12
check_3_13
check_3_14
check_3_15
check_3_16
check_3_17
check_3_18
check_3_19
check_3_20
check_3_21
check_3_22
check_3_end
}
@ -177,14 +142,6 @@ container_images() {
container_images_level1() {
check_4
check_4_1
check_4_2
check_4_3
check_4_4
check_4_6
check_4_7
check_4_9
check_4_10
check_4_end
}
@ -227,34 +184,6 @@ container_runtime() {
container_runtime_level1() {
check_5
check_running_containers
check_5_1
check_5_3
check_5_4
check_5_5
check_5_6
check_5_7
check_5_8
check_5_9
check_5_10
check_5_11
check_5_12
check_5_13
check_5_14
check_5_15
check_5_16
check_5_17
check_5_18
check_5_19
check_5_20
check_5_21
check_5_24
check_5_25
check_5_26
check_5_27
check_5_28
check_5_30
check_5_31
check_5_end
}
@ -289,11 +218,6 @@ docker_swarm_configuration() {
docker_swarm_configuration_level1() {
check_7
check_7_1
check_7_2
check_7_3
check_7_4
check_7_7
check_7_end
}
@ -366,7 +290,6 @@ cis() {
container_runtime
docker_security_operations
docker_swarm_configuration
docker_enterprise_configuration
}
cis_level1() {
@ -377,7 +300,6 @@ cis_level1() {
container_runtime_level1
docker_security_operations_level1
docker_swarm_configuration_level1
docker_enterprise_configuration_level1
}
# Community contributed
@ -388,5 +310,6 @@ community() {
# All
all() {
cis
docker_enterprise_configuration
community
}

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Returns the absolute path of a given string
abspath () { case "$1" in /*)printf "%s\n" "$1";; *)printf "%s\n" "$PWD/$1";; esac; }
@ -145,6 +145,6 @@ yell "# ------------------------------------------------------------------------
# Docker, Inc. (c) 2015-$(date +"%Y")
#
# Checks for dozens of common best-practices around deploying Docker containers in production.
# Inspired by the CIS Docker Benchmark v1.2.0.
# Based on the CIS Docker Benchmark 1.3.1.
# --------------------------------------------------------------------------------------------"
}

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
bldred='\033[1;31m' # Bold Red
bldgrn='\033[1;32m' # Bold Green
@ -143,7 +143,7 @@ log_to_json() {
# Result also includes details and a list of items. Add that directly to details and to an array property "items"
# Also limit the number of items to $limit, if $limit is non-zero
truncItems=$3
if [ $limit != 0 ]; then
if [ "$limit" != 0 ]; then
truncItems=""
ITEM_COUNT=0
for item in $3; do

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_1() {
logit ""
@ -11,57 +11,14 @@ check_1() {
check_1_1() {
local id="1.1"
local desc="General Configuration"
local desc="Linux Hosts Specific Configuration"
local check="$id - $desc"
info "$check"
}
check_1_1_1() {
local id="1.1.1"
local desc="Ensure the container host has been Hardened (Not Scored)"
local remediation="You may consider various Security Benchmarks for your container host."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
note -c "$check"
logcheckresult "INFO"
}
check_1_1_2() {
local id="1.1.2"
local desc="Ensure that the version of Docker is up to date (Not Scored)"
local remediation="You should monitor versions of Docker releases and make sure your software is updated as required."
local remediationImpact="You should perform a risk assessment regarding Docker version updates and review how they may impact your operations."
local check="$id - $desc"
starttestjson "$id" "$desc"
docker_version=$(docker version | grep -i -A2 '^server' | grep ' Version:' \
| awk '{print $NF; exit}' | tr -d '[:alpha:]-,')
docker_current_version="$(date +%y.%m.0 -d @$(( $(date +%s) - 2592000)))"
do_version_check "$docker_current_version" "$docker_version"
if [ $? -eq 11 ]; then
pass -c "$check"
info " * Using $docker_version, verify is it up to date as deemed necessary"
logcheckresult "INFO" "Using $docker_version"
return
fi
pass -c "$check"
info " * Using $docker_version which is current"
info " * Check with your operating system vendor for support and security maintenance for Docker"
logcheckresult "PASS" "Using $docker_version"
}
check_1_2() {
local id="1.2"
local desc="Linux Hosts Specific Configuration"
local check="$id - $desc"
info "$check"
}
check_1_2_1() {
local id="1.2.1"
local desc="Ensure a separate partition for containers has been created (Scored)"
local desc="Ensure a separate partition for containers has been created (Automated)"
local remediation="For new installations, you should create a separate partition for the /var/lib/docker mount point. For systems that have already been installed, you should use the Logical Volume Manager (LVM) within Linux to create a new partition."
local remediationImpact="None."
local check="$id - $desc"
@ -81,9 +38,9 @@ check_1_2_1() {
logcheckresult "WARN"
}
check_1_2_2() {
local id="1.2.2"
local desc="Ensure only trusted users are allowed to control Docker daemon (Scored)"
check_1_1_2() {
local id="1.1.2"
local desc="Ensure only trusted users are allowed to control Docker daemon (Automated)"
local remediation="You should remove any untrusted users from the docker group using command sudo gpasswd -d <your-user> docker or add trusted users to the docker group using command sudo usermod -aG docker <your-user>. You should not create a mapping of sensitive directories from the host to container volumes."
local remediationImpact="Only trust user are allow to build and execute containers as normal user."
local check="$id - $desc"
@ -123,9 +80,9 @@ check_1_2_2() {
fi
}
check_1_2_3() {
local id="1.2.3"
local desc="Ensure auditing is configured for the Docker daemon (Scored)"
check_1_1_3() {
local id="1.1.3"
local desc="Ensure auditing is configured for the Docker daemon (Automated)"
local remediation="Install auditd. Add -w /usr/bin/dockerd -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
@ -151,9 +108,37 @@ check_1_2_3() {
logcheckresult "WARN"
}
check_1_2_4() {
local id="1.2.4"
local desc="Ensure auditing is configured for Docker files and directories - /var/lib/docker (Scored)"
check_1_1_4() {
local id="1.1.4"
local desc="Ensure auditing is configured for Docker files and directories -/run/containerd (Automated)"
local remediation="Install auditd. Add -a exit,always -F path=/run/containerd -F perm=war -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/run/containerd"
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep "$file" >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
}
check_1_1_5() {
local id="1.1.5"
local desc="Ensure auditing is configured for Docker files and directories - /var/lib/docker (Automated)"
local remediation="Install auditd. Add -w /var/lib/docker -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
@ -185,9 +170,9 @@ check_1_2_4() {
logcheckresult "INFO" "Directory not found"
}
check_1_2_5() {
local id="1.2.5"
local desc="Ensure auditing is configured for Docker files and directories - /etc/docker (Scored)"
check_1_1_6() {
local id="1.1.6"
local desc="Ensure auditing is configured for Docker files and directories - /etc/docker (Automated)"
local remediation="Install auditd. Add -w /etc/docker -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
@ -219,9 +204,9 @@ check_1_2_5() {
logcheckresult "INFO" "Directory not found"
}
check_1_2_6() {
local id="1.2.6"
local desc="Ensure auditing is configured for Docker files and directories - docker.service (Scored)"
check_1_1_7() {
local id="1.1.7"
local desc="Ensure auditing is configured for Docker files and directories - docker.service (Automated)"
local remediation
remediation="Install auditd. Add -w $(get_service_file docker.service) -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
@ -254,9 +239,43 @@ check_1_2_6() {
logcheckresult "INFO" "File not found"
}
check_1_2_7() {
local id="1.2.7"
local desc="Ensure auditing is configured for Docker files and directories - docker.socket (Scored)"
check_1_1_8() {
local id="1.1.8"
local desc="Ensure auditing is configured for Docker files and directories - containerd.sock (Automated)"
local remediation
remediation="Install auditd. Add -w $(get_service_file containerd.socket) -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="$(get_service_file containerd.socket)"
if [ -e "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep "$file" >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_1_1_9() {
local id="1.1.9"
local desc="Ensure auditing is configured for Docker files and directories - docker.socket (Automated)"
local remediation
remediation="Install auditd. Add -w $(get_service_file docker.socket) -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
@ -289,9 +308,9 @@ check_1_2_7() {
logcheckresult "INFO" "File not found"
}
check_1_2_8() {
local id="1.2.8"
local desc="Ensure auditing is configured for Docker files and directories - /etc/default/docker (Scored)"
check_1_1_10() {
local id="1.1.10"
local desc="Ensure auditing is configured for Docker files and directories - /etc/default/docker (Automated)"
local remediation="Install auditd. Add -w /etc/default/docker -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
@ -323,43 +342,9 @@ check_1_2_8() {
logcheckresult "INFO" "File not found"
}
check_1_2_9() {
local id="1.2.9"
local desc="Ensure auditing is configured for Docker files and directories - /etc/sysconfig/docker (Scored)"
local remediation="Install auditd. Add -w /etc/sysconfig/docker -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/etc/sysconfig/docker"
if [ -f "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep $file >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_1_2_10() {
local id="1.2.10"
local desc="Ensure auditing is configured for Docker files and directories - /etc/docker/daemon.json (Scored)"
check_1_1_11() {
local id="1.1.11"
local desc="Ensure auditing is configured for Dockerfiles and directories - /etc/docker/daemon.json (Automated)"
local remediation="Install auditd. Add -w /etc/docker/daemon.json -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
@ -391,9 +376,77 @@ check_1_2_10() {
logcheckresult "INFO" "File not found"
}
check_1_2_11() {
local id="1.2.11"
local desc="Ensure auditing is configured for Docker files and directories - /usr/bin/containerd (Scored)"
check_1_1_12() {
local id="1.1.12"
local desc="1.1.12 Ensure auditing is configured for Dockerfiles and directories - /etc/containerd/config.toml (Automated)"
local remediation="Install auditd. Add -w /etc/containerd/config.toml -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/etc/containerd/config.toml"
if [ -f "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep $file >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_1_1_13() {
local id="1.1.13"
local desc="Ensure auditing is configured for Docker files and directories - /etc/sysconfig/docker (Automated)"
local remediation="Install auditd. Add -w /etc/sysconfig/docker -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/etc/sysconfig/docker"
if [ -f "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep $file >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_1_1_14() {
local id="1.1.14"
local desc="Ensure auditing is configured for Docker files and directories - /usr/bin/containerd (Automated)"
local remediation="Install auditd. Add -w /usr/bin/containerd -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
@ -425,15 +478,15 @@ check_1_2_11() {
logcheckresult "INFO" "File not found"
}
check_1_2_12() {
local id="1.2.12"
local desc="Ensure auditing is configured for Docker files and directories - /usr/sbin/runc (Scored)"
local remediation="Install auditd. Add -w /usr/sbin/runc -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
check_1_1_15() {
local id="1.1.15"
local desc="Ensure auditing is configured for Docker files and directories - /usr/bin/containerd-shim (Automated)"
local remediation="Install auditd. Add -w /usr/bin/containerd-shim -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/usr/sbin/runc"
file="/usr/bin/containerd-shim"
if [ -f "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep $file >/dev/null 2>&1; then
@ -459,6 +512,151 @@ check_1_2_12() {
logcheckresult "INFO" "File not found"
}
check_1_1_16() {
local id="1.1.16"
local desc="Ensure auditing is configured for Docker files and directories - /usr/bin/containerd-shim-runc-v1 (Automated)"
local remediation="Install auditd. Add -w /usr/bin/containerd-shim-runc-v1 -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/usr/bin/containerd-shim-runc-v1"
if [ -f "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep $file >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_1_1_17() {
local id="1.1.17"
local desc="Ensure auditing is configured for Docker files and directories - /usr/bin/containerd-shim-runc-v2 (Automated)"
local remediation="Install auditd. Add -w /usr/bin/containerd-shim-runc-v2 -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/usr/bin/containerd-shim-runc-v2"
if [ -f "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep $file >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_1_1_18() {
local id="1.1.18"
local desc="Ensure auditing is configured for Docker files and directories - /usr/bin/runc (Automated)"
local remediation="Install auditd. Add -w /usr/bin/runc -k docker to the /etc/audit/rules.d/audit.rules file. Then restart the audit daemon using command service auditd restart."
local remediationImpact="Audit can generate large log files. So you need to make sure that they are rotated and archived periodically. Create a separate partition for audit logs to avoid filling up other critical partitions."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/usr/bin/runc"
if [ -f "$file" ]; then
if command -v auditctl >/dev/null 2>&1; then
if auditctl -l | grep $file >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
if grep -s "$file" "$auditrules" | grep "^[^#;]" 2>/dev/null 1>&2; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_1_2() {
local id="1.2"
local desc="General Configuration"
local check="$id - $desc"
info "$check"
}
check_1_2_1() {
local id="1.2.1"
local desc="Ensure the container host has been Hardened (Manual)"
local remediation="You may consider various Security Benchmarks for your container host."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
note -c "$check"
logcheckresult "INFO"
}
check_1_2_2() {
local id="1.2.2"
local desc="Ensure that the version of Docker is up to date (Manual)"
local remediation="You should monitor versions of Docker releases and make sure your software is updated as required."
local remediationImpact="You should perform a risk assessment regarding Docker version updates and review how they may impact your operations."
local check="$id - $desc"
starttestjson "$id" "$desc"
docker_version=$(docker version | grep -i -A2 '^server' | grep ' Version:' \
| awk '{print $NF; exit}' | tr -d '[:alpha:]-,')
docker_current_version="$(date +%y.%m.0 -d @$(( $(date +%s) - 2592000)))"
do_version_check "$docker_current_version" "$docker_version"
if [ $? -eq 11 ]; then
pass -c "$check"
info " * Using $docker_version, verify is it up to date as deemed necessary"
logcheckresult "INFO" "Using $docker_version"
return
fi
pass -c "$check"
info " * Using $docker_version which is current"
info " * Check with your operating system vendor for support and security maintenance for Docker"
logcheckresult "PASS" "Using $docker_version"
}
check_1_end() {
endsectionjson
}

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_2() {
logit ""
@ -11,6 +11,18 @@ check_2() {
check_2_1() {
local id="2.1"
local desc="Run the Docker daemon as a non-root user, if possible (Manual)"
local remediation="Follow the current Dockerdocumentation on how to install the Docker daemon as a non-root user."
local remediationImpact="There are multiple prerequisites depending on which distribution that is in use, and also known limitations regarding networking and resource limitation. Running in rootless mode also changes the location of any configuration files in use, including all containers using the daemon."
local check="$id - $desc"
starttestjson "$id" "$desc"
note -c "$check"
logcheckresult "INFO"
}
check_2_2() {
local id="2.2"
local desc="Ensure network traffic is restricted between containers on the default bridge (Scored)"
local remediation="Edit the Docker daemon configuration file to ensure that inter-container communication is disabled: icc: false."
local remediationImpact="Inter-container communication is disabled on the default network bridge. If any communication between containers on the same host is desired, it needs to be explicitly defined using container linking or custom networks."
@ -31,8 +43,8 @@ check_2_1() {
logcheckresult "WARN"
}
check_2_2() {
local id="2.2"
check_2_3() {
local id="2.3"
local desc="Ensure the logging level is set to 'info' (Scored)"
local remediation="Ensure that the Docker daemon configuration file has the following configuration included log-level: info. Alternatively, run the Docker daemon as following: dockerd --log-level=info"
local remediationImpact="None."
@ -68,8 +80,8 @@ check_2_2() {
logcheckresult "PASS"
}
check_2_3() {
local id="2.3"
check_2_4() {
local id="2.4"
local desc="Ensure Docker is allowed to make changes to iptables (Scored)"
local remediation="Do not run the Docker daemon with --iptables=false option."
local remediationImpact="The Docker daemon service requires iptables rules to be enabled before it starts."
@ -90,8 +102,8 @@ check_2_3() {
logcheckresult "PASS"
}
check_2_4() {
local id="2.4"
check_2_5() {
local id="2.5"
local desc="Ensure insecure registries are not used (Scored)"
local remediation="You should ensure that no insecure registries are in use."
local remediationImpact="None."
@ -117,8 +129,8 @@ check_2_4() {
logcheckresult "PASS"
}
check_2_5() {
local id="2.5"
check_2_6() {
local id="2.6"
local desc="Ensure aufs storage driver is not used (Scored)"
local remediation="Do not start Docker daemon as using dockerd --storage-driver aufs option."
local remediationImpact="aufs is the only storage driver that allows containers to share executable and shared library memory. Its use should be reviewed in line with your organization's security policy."
@ -134,8 +146,8 @@ check_2_5() {
logcheckresult "PASS"
}
check_2_6() {
local id="2.6"
check_2_7() {
local id="2.7"
local desc="Ensure TLS authentication for Docker daemon is configured (Scored)"
local remediation="Follow the steps mentioned in the Docker documentation or other references. By default, TLS authentication is not configured."
local remediationImpact="You would need to manage and guard certificates and keys for the Docker daemon and Docker clients."
@ -167,9 +179,9 @@ check_2_6() {
logcheckresult "INFO" "Docker daemon not listening on TCP"
}
check_2_7() {
local id="2.7"
local desc="Ensure the default ulimit is configured appropriately (Not Scored)"
check_2_8() {
local id="2.8"
local desc="Ensure the default ulimit is configured appropriately (Manual)"
local remediation="Run Docker in daemon mode and pass --default-ulimit as option with respective ulimits as appropriate in your environment and in line with your security policy. Example: dockerd --default-ulimit nproc=1024:2048 --default-ulimit nofile=100:200"
local remediationImpact="If ulimits are set incorrectly this could cause issues with system resources, possibly causing a denial of service condition."
local check="$id - $desc"
@ -190,8 +202,8 @@ check_2_7() {
logcheckresult "INFO" "Default ulimit doesn't appear to be set"
}
check_2_8() {
local id="2.8"
check_2_9() {
local id="2.9"
local desc="Enable user namespace support (Scored)"
local remediation="Please consult the Docker documentation for various ways in which this can be configured depending upon your requirements. The high-level steps are: Ensure that the files /etc/subuid and /etc/subgid exist. Start the docker daemon with --userns-remap flag."
local remediationImpact="User namespace remapping is incompatible with a number of Docker features and also currently breaks some of its functionalities."
@ -212,8 +224,8 @@ check_2_8() {
logcheckresult "WARN"
}
check_2_9() {
local id="2.9"
check_2_10() {
local id="2.10"
local desc="Ensure the default cgroup usage has been confirmed (Scored)"
local remediation="The default setting is in line with good security practice and can be left in situ."
local remediationImpact="None."
@ -236,8 +248,8 @@ check_2_9() {
logcheckresult "PASS"
}
check_2_10() {
local id="2.10"
check_2_11() {
local id="2.11"
local desc="Ensure base device size is not changed until needed (Scored)"
local remediation="Do not set --storage-opt dm.basesize until needed."
local remediationImpact="None."
@ -258,8 +270,8 @@ check_2_10() {
logcheckresult "PASS"
}
check_2_11() {
local id="2.11"
check_2_12() {
local id="2.12"
local desc="Ensure that authorization for Docker client commands is enabled (Scored)"
local remediation="Install/Create an authorization plugin. Configure the authorization policy as desired. Start the docker daemon using command dockerd --authorization-plugin=<PLUGIN_ID>"
local remediationImpact="Each Docker command needs to pass through the authorization plugin mechanism. This may have a performance impact"
@ -280,8 +292,8 @@ check_2_11() {
logcheckresult "WARN"
}
check_2_12() {
local id="2.12"
check_2_13() {
local id="2.13"
local desc="Ensure centralized and remote logging is configured (Scored)"
local remediation="Set up the desired log driver following its documentation. Start the docker daemon using that logging driver. Example: dockerd --log-driver=syslog --log-opt syslog-address=tcp://192.xxx.xxx.xxx"
local remediationImpact="None."
@ -297,8 +309,30 @@ check_2_12() {
logcheckresult "PASS"
}
check_2_13() {
local id="2.13"
check_2_14() {
local id="2.14"
local desc="Ensure containers are restricted from acquiring new privileges (Scored)"
local remediation="You should run the Docker daemon using command: dockerd --no-new-privileges"
local remediationImpact="no_new_priv prevents LSMs such as SELinux from escalating the privileges of individual containers."
local check="$id - $desc"
starttestjson "$id" "$desc"
if get_docker_effective_command_line_args '--no-new-privileges' | grep "no-new-privileges" >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
if get_docker_configuration_file_args 'no-new-privileges' | grep true >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
}
check_2_15() {
local id="2.15"
local desc="Ensure live restore is enabled (Scored)"
local remediation="Run Docker in daemon mode and pass --live-restore option."
local remediationImpact="None."
@ -324,8 +358,8 @@ check_2_13() {
logcheckresult "WARN"
}
check_2_14() {
local id="2.14"
check_2_16() {
local id="2.16"
local desc="Ensure Userland Proxy is Disabled (Scored)"
local remediation="You should run the Docker daemon using command: dockerd --userland-proxy=false"
local remediationImpact="Some systems with older Linux kernels may not be able to support hairpin NAT and therefore require the userland proxy service. Also, some networking setups can be impacted by the removal of the userland proxy."
@ -346,9 +380,9 @@ check_2_14() {
logcheckresult "WARN"
}
check_2_15() {
local id="2.15"
local desc="Ensure that a daemon-wide custom seccomp profile is applied if appropriate (Not Scored)"
check_2_17() {
local id="2.17"
local desc="Ensure that a daemon-wide custom seccomp profile is applied if appropriate (Manual)"
local remediation="By default, Docker's default seccomp profile is applied. If this is adequate for your environment, no action is necessary."
local remediationImpact="A misconfigured seccomp profile could possibly interrupt your container environment. You should therefore exercise extreme care if you choose to override the default settings."
local check="$id - $desc"
@ -390,28 +424,6 @@ check_2_16() {
logcheckresult "INFO"
}
check_2_17() {
local id="2.17"
local desc="Ensure containers are restricted from acquiring new privileges (Scored)"
local remediation="You should run the Docker daemon using command: dockerd --no-new-privileges"
local remediationImpact="no_new_priv prevents LSMs such as SELinux from escalating the privileges of individual containers."
local check="$id - $desc"
starttestjson "$id" "$desc"
if get_docker_effective_command_line_args '--no-new-privileges' | grep "no-new-privileges" >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
if get_docker_configuration_file_args 'no-new-privileges' | grep true >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
logcheckresult "WARN"
}
check_2_end() {
endsectionjson
}

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_3() {
logit ""
@ -11,15 +11,15 @@ check_3() {
check_3_1() {
local id="3.1"
local desc="Ensure that the docker.service file ownership is set to root:root (Scored)"
local desc="Ensure that the docker.service file ownership is set to root:root (Automated)"
local remediation="Find out the file location: systemctl show -p FragmentPath docker.service. If the file does not exist, this recommendation is not applicable. If the file does exist, you should run the command chown root:root <path>, in order to set the ownership and group ownership for the file to root."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="$(get_service_file docker.service)"
file=$(get_service_file docker.service)
if [ -f "$file" ]; then
if [ "$(stat -c %u%g $file)" -eq 00 ]; then
if [ "$(stat -c %u%g "$file")" -eq 00 ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -36,15 +36,15 @@ check_3_1() {
check_3_2() {
local id="3.2"
local desc="Ensure that docker.service file permissions are appropriately set (Scored)"
local desc="Ensure that docker.service file permissions are appropriately set (Automated)"
local remediation="Find out the file location: systemctl show -p FragmentPath docker.service. If the file does not exist, this recommendation is not applicable. If the file exists, run the command chmod 644 <path> to set the file permissions to 644."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="$(get_service_file docker.service)"
file=$(get_service_file docker.service)
if [ -f "$file" ]; then
if [ "$(stat -c %a $file)" -le 644 ]; then
if [ "$(stat -c %a "$file")" -le 644 ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -61,15 +61,15 @@ check_3_2() {
check_3_3() {
local id="3.3"
local desc="Ensure that docker.socket file ownership is set to root:root (Scored)"
local desc="Ensure that docker.socket file ownership is set to root:root (Automated)"
local remediation="Find out the file location: systemctl show -p FragmentPath docker.socket. If the file does not exist, this recommendation is not applicable. If the file exists, run the command chown root:root <path> to set the ownership and group ownership for the file to root."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="$(get_service_file docker.socket)"
file=$(get_service_file docker.socket)
if [ -f "$file" ]; then
if [ "$(stat -c %u%g $file)" -eq 00 ]; then
if [ "$(stat -c %u%g "$file")" -eq 00 ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -86,15 +86,15 @@ check_3_3() {
check_3_4() {
local id="3.4"
local desc="Ensure that docker.socket file permissions are set to 644 or more restrictive (Scored)"
local desc="Ensure that docker.socket file permissions are set to 644 or more restrictive (Automated)"
local remediation="Find out the file location: systemctl show -p FragmentPath docker.socket. If the file does not exist, this recommendation is not applicable. If the file does exist, you should run the command chmod 644 <path> to set the file permissions to 644."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="$(get_service_file docker.socket)"
file=$(get_service_file docker.socket)
if [ -f "$file" ]; then
if [ "$(stat -c %a $file)" -le 644 ]; then
if [ "$(stat -c %a "$file")" -le 644 ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -111,7 +111,7 @@ check_3_4() {
check_3_5() {
local id="3.5"
local desc="Ensure that the /etc/docker directory ownership is set to root:root (Scored)"
local desc="Ensure that the /etc/docker directory ownership is set to root:root (Automated)"
local remediation="You should run the following command: chown root:root /etc/docker. This sets the ownership and group ownership for the directory to root."
local remediationImpact="None."
local check="$id - $desc"
@ -136,7 +136,7 @@ check_3_5() {
check_3_6() {
local id="3.6"
local desc="Ensure that /etc/docker directory permissions are set to 755 or more restrictively (Scored)"
local desc="Ensure that /etc/docker directory permissions are set to 755 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 755 /etc/docker. This sets the permissions for the directory to 755."
local remediationImpact="None."
local check="$id - $desc"
@ -161,7 +161,7 @@ check_3_6() {
check_3_7() {
local id="3.7"
local desc="Ensure that registry certificate file ownership is set to root:root (Scored)"
local desc="Ensure that registry certificate file ownership is set to root:root (Automated)"
local remediation="You should run the following command: 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."
local remediationImpact="None."
local check="$id - $desc"
@ -172,7 +172,7 @@ check_3_7() {
fail=0
owners=$(find "$directory" -type f -name '*.crt')
for p in $owners; do
if [ "$(stat -c %u $p)" -ne 0 ]; then
if [ "$(stat -c %u "$p")" -ne 0 ]; then
fail=1
fi
done
@ -193,7 +193,7 @@ check_3_7() {
check_3_8() {
local id="3.8"
local desc="Ensure that registry certificate file permissions are set to 444 or more restrictively (Scored)"
local desc="Ensure that registry certificate file permissions are set to 444 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 444 /etc/docker/certs.d/<registry-name>/*. This would set the permissions for the registry certificate files to 444."
local remediationImpact="None."
local check="$id - $desc"
@ -204,7 +204,7 @@ check_3_8() {
fail=0
perms=$(find "$directory" -type f -name '*.crt')
for p in $perms; do
if [ "$(stat -c %a $p)" -gt 444 ]; then
if [ "$(stat -c %a "$p")" -gt 444 ]; then
fail=1
fi
done
@ -225,7 +225,7 @@ check_3_8() {
check_3_9() {
local id="3.9"
local desc="Ensure that TLS CA certificate file ownership is set to root:root (Scored)"
local desc="Ensure that TLS CA certificate file ownership is set to root:root (Automated)"
local remediation="You should run 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."
local remediationImpact="None."
local check="$id - $desc"
@ -253,7 +253,7 @@ check_3_9() {
check_3_10() {
local id="3.10"
local desc="Ensure that TLS CA certificate file permissions are set to 444 or more restrictively (Scored)"
local desc="Ensure that TLS CA certificate file permissions are set to 444 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 444 <path to TLS CA certificate file>. This sets the file permissions on the TLS CA file to 444."
local remediationImpact="None."
local check="$id - $desc"
@ -264,7 +264,7 @@ check_3_10() {
tlscacert=$(get_docker_configuration_file_args 'tlscacert')
fi
if [ -f "$tlscacert" ]; then
if [ "$(stat -c %a $tlscacert)" -le 444 ]; then
if [ "$(stat -c %a "$tlscacert")" -le 444 ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -281,7 +281,7 @@ check_3_10() {
check_3_11() {
local id="3.11"
local desc="Ensure that Docker server certificate file ownership is set to root:root (Scored)"
local desc="Ensure that Docker server certificate file ownership is set to root:root (Automated)"
local remediation="You should run the following command: chown root:root <path to Docker server certificate file>. This sets the individual ownership and the group ownership for the Docker server certificate file to root."
local remediationImpact="None."
local check="$id - $desc"
@ -309,7 +309,7 @@ check_3_11() {
check_3_12() {
local id="3.12"
local desc="Ensure that the Docker server certificate file permissions are set to 444 or more restrictively (Scored)"
local desc="Ensure that the Docker server certificate file permissions are set to 444 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 444 <path to Docker server certificate file>. This sets the file permissions of the Docker server certificate file to 444."
local remediationImpact="None."
local check="$id - $desc"
@ -320,7 +320,7 @@ check_3_12() {
tlscert=$(get_docker_configuration_file_args 'tlscert')
fi
if [ -f "$tlscert" ]; then
if [ "$(stat -c %a $tlscert)" -le 444 ]; then
if [ "$(stat -c %a "$tlscert")" -le 444 ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -337,7 +337,7 @@ check_3_12() {
check_3_13() {
local id="3.13"
local desc="Ensure that the Docker server certificate key file ownership is set to root:root (Scored)"
local desc="Ensure that the Docker server certificate key file ownership is set to root:root (Automated)"
local remediation="You should run the following command: chown root:root <path to Docker server certificate key file>. This sets the individual ownership and group ownership for the Docker server certificate key file to root."
local remediationImpact="None."
local check="$id - $desc"
@ -365,7 +365,7 @@ check_3_13() {
check_3_14() {
local id="3.14"
local desc="Ensure that the Docker server certificate key file permissions are set to 400 (Scored)"
local desc="Ensure that the Docker server certificate key file permissions are set to 400 (Automated)"
local remediation="You should run the following command: chmod 400 <path to Docker server certificate key file>. This sets the Docker server certificate key file permissions to 400."
local remediationImpact="None."
local check="$id - $desc"
@ -376,7 +376,7 @@ check_3_14() {
tlskey=$(get_docker_configuration_file_args 'tlskey')
fi
if [ -f "$tlskey" ]; then
if [ "$(stat -c %a $tlskey)" -eq 400 ]; then
if [ "$(stat -c %a "$tlskey")" -eq 400 ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -393,7 +393,7 @@ check_3_14() {
check_3_15() {
local id="3.15"
local desc="Ensure that the Docker socket file ownership is set to root:docker (Scored)"
local desc="Ensure that the Docker socket file ownership is set to root:docker (Automated)"
local remediation="You should run the following command: chown root:docker /var/run/docker.sock. This sets the ownership to root and group ownership to docker for the default Docker socket file."
local remediationImpact="None."
local check="$id - $desc"
@ -418,7 +418,7 @@ check_3_15() {
check_3_16() {
local id="3.16"
local desc="Ensure that the Docker socket file permissions are set to 660 or more restrictively (Scored)"
local desc="Ensure that the Docker socket file permissions are set to 660 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 660 /var/run/docker.sock. This sets the file permissions of the Docker socket file to 660."
local remediationImpact="None."
local check="$id - $desc"
@ -443,7 +443,7 @@ check_3_16() {
check_3_17() {
local id="3.17"
local desc="Ensure that the daemon.json file ownership is set to root:root (Scored)"
local desc="Ensure that the daemon.json file ownership is set to root:root (Automated)"
local remediation="You should run the following command: chown root:root /etc/docker/daemon.json. This sets the ownership and group ownership for the file to root."
local remediationImpact="None."
local check="$id - $desc"
@ -468,7 +468,7 @@ check_3_17() {
check_3_18() {
local id="3.18"
local desc="Ensure that daemon.json file permissions are set to 644 or more restrictive (Scored)"
local desc="Ensure that daemon.json file permissions are set to 644 or more restrictive (Automated)"
local remediation="You should run the following command: chmod 644 /etc/docker/daemon.json. This sets the file permissions for this file to 644."
local remediationImpact="None."
local check="$id - $desc"
@ -493,7 +493,7 @@ check_3_18() {
check_3_19() {
local id="3.19"
local desc="Ensure that the /etc/default/docker file ownership is set to root:root (Scored)"
local desc="Ensure that the /etc/default/docker file ownership is set to root:root (Automated)"
local remediation="You should run the following command: chown root:root /etc/default/docker. This sets the ownership and group ownership of the file to root."
local remediationImpact="None."
local check="$id - $desc"
@ -518,32 +518,7 @@ check_3_19() {
check_3_20() {
local id="3.20"
local desc="Ensure that the /etc/sysconfig/docker file ownership is set to root:root (Scored)"
local remediation="You should run the following command: chown root:root /etc/sysconfig/docker. This sets the ownership and group ownership for the file to root."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/etc/sysconfig/docker"
if [ -f "$file" ]; then
if [ "$(stat -c %U:%G $file)" = 'root:root' ]; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
warn " * Wrong ownership for $file"
logcheckresult "WARN" "Wrong ownership for $file"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_3_21() {
local id="3.21"
local desc="Ensure that the /etc/sysconfig/docker file permissions are set to 644 or more restrictively (Scored)"
local desc="Ensure that the /etc/sysconfig/docker file permissions are set to 644 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 644 /etc/sysconfig/docker. This sets the file permissions for this file to 644."
local remediationImpact="None."
local check="$id - $desc"
@ -566,9 +541,34 @@ check_3_21() {
logcheckresult "INFO" "File not found"
}
check_3_21() {
local id="3.21"
local desc="Ensure that the /etc/sysconfig/docker file ownership is set to root:root (Automated)"
local remediation="You should run the following command: chown root:root /etc/sysconfig/docker. This sets the ownership and group ownership for the file to root."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/etc/sysconfig/docker"
if [ -f "$file" ]; then
if [ "$(stat -c %U:%G $file)" = 'root:root' ]; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
warn " * Wrong ownership for $file"
logcheckresult "WARN" "Wrong ownership for $file"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_3_22() {
local id="3.22"
local desc="Ensure that the /etc/default/docker file permissions are set to 644 or more restrictively (Scored)"
local desc="Ensure that the /etc/default/docker file permissions are set to 644 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 644 /etc/default/docker. This sets the file permissions for this file to 644."
local remediationImpact="None."
local check="$id - $desc"
@ -591,6 +591,56 @@ check_3_22() {
logcheckresult "INFO" "File not found"
}
check_3_23() {
local id="3.23"
local desc="Ensure that the Containerd socket file ownership is set to root:root (Automated)"
local remediation="You should run the following command: chown root:root /run/containerd/containerd.sock. This sets the ownership and group ownership for the file to root."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/run/containerd/containerd.sock"
if [ -f "$file" ]; then
if [ "$(stat -c %U:%G $file)" = 'root:root' ]; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
warn " * Wrong ownership for $file"
logcheckresult "WARN" "Wrong ownership for $file"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_3_24() {
local id="3.24"
local desc="Ensure that the Containerd socket file permissions are set to 660 or more restrictively (Automated)"
local remediation="You should run the following command: chmod 660 /run/containerd/containerd.sock. This sets the file permissions for this file to 660."
local remediationImpact="None."
local check="$id - $desc"
starttestjson "$id" "$desc"
file="/run/containerd/containerd.sock"
if [ -f "$file" ]; then
if [ "$(stat -c %a $file)" -le 660 ]; then
pass -s "$check"
logcheckresult "PASS"
return
fi
warn -s "$check"
warn " * Wrong permissions for $file"
logcheckresult "WARN" "Wrong permissions for $file"
return
fi
info -c "$check"
info " * File not found"
logcheckresult "INFO" "File not found"
}
check_3_end() {
endsectionjson
}

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_4() {
logit ""
@ -11,7 +11,7 @@ check_4() {
check_4_1() {
local id="4.1"
local desc="Ensure that a user for the container has been created (Scored)"
local desc="Ensure that a user for the container has been created (Automated)"
local remediation="You should ensure that the Dockerfile for each container image contains the information: USER <username or ID>. 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."
local remediationImpact="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."
local check="$id - $desc"
@ -59,7 +59,7 @@ check_4_1() {
check_4_2() {
local id="4.2"
local desc="Ensure that containers use only trusted base images (Not Scored)"
local desc="Ensure that containers use only trusted base images (Manual)"
local remediation="Configure and use Docker Content trust. View the history of each Docker image to evaluate its risk, dependent on the sensitivity of the application you wish to deploy using it. Scan Docker images for vulnerabilities at regular intervals."
local remediationImpact="None."
local check="$id - $desc"
@ -71,7 +71,7 @@ check_4_2() {
check_4_3() {
local id="4.3"
local desc="Ensure that unnecessary packages are not installed in the container (Not Scored)"
local desc="Ensure that unnecessary packages are not installed in the container (Manual)"
local remediation="You should not install anything within the container that is not required. You should consider using a minimal base image if you can. Some of the options available include BusyBox and Alpine. Not only can this trim your image size considerably, but there would also be fewer pieces of software which could contain vectors for attack."
local remediationImpact="None."
local check="$id - $desc"
@ -83,7 +83,7 @@ check_4_3() {
check_4_4() {
local id="4.4"
local desc="Ensure images are scanned and rebuilt to include security patches (Not Scored)"
local desc="Ensure images are scanned and rebuilt to include security patches (Manual)"
local remediation="Images should be re-built ensuring that the latest version of the base images are used, to keep the operating system patch level at an appropriate level. Once the images have been re-built, containers should be re-started making use of the updated images."
local remediationImpact="None."
local check="$id - $desc"
@ -95,13 +95,13 @@ check_4_4() {
check_4_5() {
local id="4.5"
local desc="Ensure Content trust for Docker is Enabled (Scored)"
local desc="Ensure Content trust for Docker is Enabled (Automated)"
local remediation="Add DOCKER_CONTENT_TRUST variable to the /etc/environment file using command echo DOCKER_CONTENT_TRUST=1 | sudo tee -a /etc/environment."
local remediationImpact="This prevents users from working with tagged images unless they contain a signature."
local check="$id - $desc"
starttestjson "$id" "$desc"
if [ "x$DOCKER_CONTENT_TRUST" = "x1" ]; then
if [ "$DOCKER_CONTENT_TRUST" = "1" ]; then
pass -s "$check"
logcheckresult "PASS"
return
@ -112,7 +112,7 @@ check_4_5() {
check_4_6() {
local id="4.6"
local desc="Ensure that HEALTHCHECK instructions have been added to container images (Scored)"
local desc="Ensure that HEALTHCHECK instructions have been added to container images (Automated)"
local remediation="You should follow the Docker documentation and rebuild your container images to include the HEALTHCHECK instruction."
local remediationImpact="None."
local check="$id - $desc"
@ -146,7 +146,7 @@ check_4_6() {
check_4_7() {
local id="4.7"
local desc="Ensure update instructions are not used alone in the Dockerfile (Not Scored)"
local desc="Ensure update instructions are not used alone in the Dockerfile (Manual)"
local remediation="You should use update instructions together with install instructions and version pinning for packages while installing them. This prevent caching and force the extraction of the required versions. Alternatively, you could use the --no-cache flag during the docker build process to avoid using cached layers."
local remediationImpact="None."
local check="$id - $desc"
@ -177,7 +177,7 @@ check_4_7() {
check_4_8() {
local id="4.8"
local desc="Ensure setuid and setgid permissions are removed (Not Scored)"
local desc="Ensure setuid and setgid permissions are removed (Manual)"
local remediation="You should allow setuid and setgid permissions only on executables which require them. You could remove these permissions at build time by adding the following command in your Dockerfile, preferably towards the end of the Dockerfile: RUN find / -perm /6000 -type f -exec chmod a-s {} ; || true"
local remediationImpact="The above command would break all executables that depend on setuid or setgid permissions including legitimate ones. You should therefore be careful to modify the command to suit your requirements so that it does not reduce the permissions of legitimate programs excessively. Because of this, you should exercise a degree of caution and examine all processes carefully before making this type of modification in order to avoid outages."
local check="$id - $desc"
@ -189,7 +189,7 @@ check_4_8() {
check_4_9() {
local id="4.9"
local desc="Ensure that COPY is used instead of ADD in Dockerfiles (Not Scored)"
local desc="Ensure that COPY is used instead of ADD in Dockerfiles (Manual)"
local remediation="You should use COPY rather than ADD instructions in Dockerfiles."
local remediationImpact="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."
local check="$id - $desc"
@ -221,7 +221,7 @@ check_4_9() {
check_4_10() {
local id="4.10"
local desc="Ensure secrets are not stored in Dockerfiles (Not Scored)"
local desc="Ensure secrets are not stored in Dockerfiles (Manual)"
local remediation="Do not store any kind of secrets within Dockerfiles. Where secrets are required during the build process, make use of a secrets management tool, such as the buildkit builder included with Docker."
local remediationImpact="A proper secrets management process will be required for Docker image building."
local check="$id - $desc"
@ -233,7 +233,7 @@ check_4_10() {
check_4_11() {
local id="4.11"
local desc="Ensure only verified packages are are installed (Not Scored)"
local desc="Ensure only verified packages are are installed (Manual)"
local remediation="You should use a secure package distribution mechanism of your choice to ensure the authenticity of software packages."
local remediationImpact="None."
local check="$id - $desc"

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_5() {
logit ""
@ -26,7 +26,7 @@ check_5_1() {
fi
local id="5.1"
local desc="Ensure that, if applicable, an AppArmor Profile is enabled (Scored)"
local desc="Ensure that, if applicable, an AppArmor Profile is enabled (Automated)"
local remediation="If AppArmor is applicable for your Linux OS, you should enable it. Alternatively, Docker's default AppArmor policy can be used."
local remediationImpact="The container will have the security controls defined in the AppArmor profile. It should be noted that if the AppArmor profile is misconfigured, this may cause issues with the operation of the container."
local check="$id - $desc"
@ -65,7 +65,7 @@ check_5_2() {
fi
local id="5.2"
local desc="Ensure that, if applicable, SELinux security options are set (Scored)"
local desc="Ensure that, if applicable, SELinux security options are set (Automated)"
local remediation="Set the SELinux State. Set the SELinux Policy. Create or import a SELinux policy template for Docker containers. Start Docker in daemon mode with SELinux enabled. Start your Docker container using the security options."
local remediationImpact="Any restrictions defined in the SELinux policy will be applied to your containers. It should be noted that if your SELinux policy is misconfigured, this may have an impact on the correct operation of the affected containers."
local check="$id - $desc"
@ -104,7 +104,7 @@ check_5_3() {
fi
local id="5.3"
local desc="Ensure that Linux kernel capabilities are restricted within containers (Scored)"
local desc="Ensure that Linux kernel capabilities are restricted within containers (Automated)"
local remediation="You could remove all the currently configured capabilities and then restore only the ones you specifically use: docker run --cap-drop=all --cap-add={<Capability 1>,<Capability 2>} <Run arguments> <Container Image Name or ID> <Command>"
local remediationImpact="Restrictions on processes within a container are based on which Linux capabilities are in force. Removal of the NET_RAW capability prevents the container from creating raw sockets which is good security practice under most circumstances, but may affect some networking utilities."
local check="$id - $desc"
@ -146,7 +146,7 @@ check_5_4() {
fi
local id="5.4"
local desc="Ensure that privileged containers are not used (Scored)"
local desc="Ensure that privileged containers are not used (Automated)"
local remediation="You should not run containers with the --privileged flag."
local remediationImpact="If you start a container without the --privileged flag, it will not have excessive default capabilities."
local check="$id - $desc"
@ -185,7 +185,7 @@ check_5_5() {
fi
local id="5.5"
local desc="Ensure sensitive host system directories are not mounted on containers (Scored)"
local desc="Ensure sensitive host system directories are not mounted on containers (Automated)"
local remediation="You should not mount directories which are security sensitive on the host within containers, especially in read-write mode."
local remediationImpact="None."
local check="$id - $desc"
@ -243,7 +243,7 @@ check_5_6() {
fi
local id="5.6"
local desc="Ensure sshd is not run within containers (Scored)"
local desc="Ensure sshd is not run within containers (Automated)"
local remediation="Uninstall the SSH daemon from the container and use docker exec to enter a container on the remote host."
local remediationImpact="None."
local check="$id - $desc"
@ -296,7 +296,7 @@ check_5_7() {
fi
local id="5.7"
local desc="Ensure privileged ports are not mapped within containers (Scored)"
local desc="Ensure privileged ports are not mapped within containers (Automated)"
local 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."
local remediationImpact="None."
local check="$id - $desc"
@ -339,7 +339,7 @@ check_5_8() {
fi
local id="5.8"
local desc="Ensure that only needed ports are open on the container (Not Scored)"
local desc="Ensure that only needed ports are open on the container (Manual)"
local remediation="You should ensure that the Dockerfile for each container image only exposes needed ports."
local remediationImpact="None."
local check="$id - $desc"
@ -355,7 +355,7 @@ check_5_9() {
fi
local id="5.9"
local desc="Ensure that the host's network namespace is not shared (Scored)"
local desc="Ensure that the host's network namespace is not shared (Automated)"
local remediation="You should not pass the --net=host option when starting any container."
local remediationImpact="None."
local check="$id - $desc"
@ -394,7 +394,7 @@ check_5_10() {
fi
local id="5.10"
local desc="Ensure that the memory usage for containers is limited (Scored)"
local desc="Ensure that the memory usage for containers is limited (Automated)"
local remediation="You should run the container with only as much memory as it requires by using the --memory argument."
local remediationImpact="If correct memory limits are not set on each container, one process can expand its usage and cause other containers to run out of resources."
local check="$id - $desc"
@ -436,7 +436,7 @@ check_5_11() {
fi
local id="5.11"
local desc="Ensure that CPU priority is set appropriately on containers (Scored)"
local desc="Ensure that CPU priority is set appropriately on containers (Automated)"
local 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."
local remediationImpact="If you do not correctly assign CPU thresholds, the container process may run out of resources and become unresponsive. If CPU resources on the host are not constrainted, CPU shares do not place any restrictions on individual resources."
local check="$id - $desc"
@ -478,7 +478,7 @@ check_5_12() {
fi
local id="5.12"
local desc="Ensure that the container's root filesystem is mounted as read only (Scored)"
local desc="Ensure that the container's root filesystem is mounted as read only (Automated)"
local 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."
local remediationImpact="Enabling --read-only at container runtime may break some container OS packages if a data writing strategy is not defined. You should define what the container's data should and should not persist at runtime in order to decide which strategy to use."
local check="$id - $desc"
@ -517,7 +517,7 @@ check_5_13() {
fi
local id="5.13"
local desc="Ensure that incoming container traffic is bound to a specific host interface (Scored)"
local desc="Ensure that incoming container traffic is bound to a specific host interface (Automated)"
local remediation="You should bind the container port to a specific host interface on the desired host port. Example: docker run --detach --publish 10.2.3.4:49153:80 nginx In this example, 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."
local remediationImpact="None."
local check="$id - $desc"
@ -556,7 +556,7 @@ check_5_14() {
fi
local id="5.14"
local desc="Ensure that the 'on-failure' container restart policy is set to '5' (Scored)"
local desc="Ensure that the 'on-failure' container restart policy is set to '5' (Automated)"
local remediation="If you wish a container to be automatically restarted, a sample command is docker run --detach --restart=on-failure:5 nginx"
local remediationImpact="If this option is set, a container will only attempt to restart itself 5 times."
local check="$id - $desc"
@ -595,7 +595,7 @@ check_5_15() {
fi
local id="5.15"
local desc="Ensure that the host's process namespace is not shared (Scored)"
local desc="Ensure that the host's process namespace is not shared (Automated)"
local remediation="You should not start a container with the --pid=host argument."
local remediationImpact="Container processes cannot see processes on the host system."
local check="$id - $desc"
@ -634,7 +634,7 @@ check_5_16() {
fi
local id="5.16"
local desc="Ensure that the host's IPC namespace is not shared (Scored)"
local desc="Ensure that the host's IPC namespace is not shared (Automated)"
local remediation="You should not start a container with the --ipc=host argument."
local remediationImpact="Shared memory segments are used in order to accelerate interprocess communications, commonly in high-performance applications. If this type of application is containerized into multiple containers, you might need to share the IPC namespace of the containers in order to achieve high performance. Under these circumstances, you should still only share container specific IPC namespaces and not the host IPC namespace."
local check="$id - $desc"
@ -673,7 +673,7 @@ check_5_17() {
fi
local id="5.17"
local desc="Ensure that host devices are not directly exposed to containers (Not Scored)"
local desc="Ensure that host devices are not directly exposed to containers (Manual)"
local 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."
local remediationImpact="You would not be able to use host devices directly within containers."
local check="$id - $desc"
@ -712,7 +712,7 @@ check_5_18() {
fi
local id="5.18"
local desc="Ensure that the default ulimit is overwritten at runtime if needed (Not Scored)"
local desc="Ensure that the default ulimit is overwritten at runtime if needed (Manual)"
local remediation="You should only override the default ulimit settings if needed in a specific case."
local remediationImpact="If ulimits are not set correctly, overutilization by individual containers could make the host system unusable."
local check="$id - $desc"
@ -751,7 +751,7 @@ check_5_19() {
fi
local id="5.19"
local desc="Ensure mount propagation mode is not set to shared (Scored)"
local desc="Ensure mount propagation mode is not set to shared (Automated)"
local remediation="Do not mount volumes in shared mode propagation."
local remediationImpact="None."
local check="$id - $desc"
@ -789,7 +789,7 @@ check_5_20() {
fi
local id="5.20"
local desc="Ensure that the host's UTS namespace is not shared (Scored)"
local desc="Ensure that the host's UTS namespace is not shared (Automated)"
local remediation="You should not start a container with the --uts=host argument."
local remediationImpact="None."
local check="$id - $desc"
@ -828,7 +828,7 @@ check_5_21() {
fi
local id="5.21"
local desc="Ensurethe default seccomp profile is not Disabled (Scored)"
local desc="Ensurethe default seccomp profile is not Disabled (Automated)"
local remediation="By default, seccomp profiles are enabled. You do not need to do anything unless you want to modify and use a modified seccomp profile."
local remediationImpact="With Docker 1.10 and greater, the default seccomp profile blocks syscalls, regardless of -- cap-add passed to the container."
local check="$id - $desc"
@ -866,7 +866,7 @@ check_5_22() {
fi
local id="5.22"
local desc="Ensure that docker exec commands are not used with the privileged option (Scored)"
local desc="Ensure that docker exec commands are not used with the privileged option (Automated)"
local remediation="You should not use the --privileged option in docker exec commands."
local remediationImpact="If you need enhanced capabilities within a container, then run it with all the permissions it requires. These should be specified individually."
local check="$id - $desc"
@ -882,7 +882,7 @@ check_5_23() {
fi
local id="5.23"
local desc="Ensure that docker exec commands are not used with the user=root option (Not Scored)"
local desc="Ensure that docker exec commands are not used with the user=root option (Manual)"
local remediation="You should not use the --user=root option in docker exec commands."
local remediationImpact="None."
local check="$id - $desc"
@ -898,7 +898,7 @@ check_5_24() {
fi
local id="5.24"
local desc="Ensure that cgroup usage is confirmed (Scored)"
local desc="Ensure that cgroup usage is confirmed (Automated)"
local remediation="You should not use the --cgroup-parent option within the docker run command unless strictly required."
local remediationImpact="None."
local check="$id - $desc"
@ -936,7 +936,7 @@ check_5_25() {
return
fi
local id="5.25"
local desc="Ensure that the container is restricted from acquiring additional privileges (Scored)"
local desc="Ensure that the container is restricted from acquiring additional privileges (Automated)"
local remediation="You should start your container with the options: docker run --rm -it --security-opt=no-new-privileges ubuntu bash"
local remediationImpact="The no_new_priv option prevents LSMs like SELinux from allowing processes to acquire new privileges."
local check="$id - $desc"
@ -973,7 +973,7 @@ check_5_26() {
fi
local id="5.26"
local desc="Ensure that container health is checked at runtime (Scored)"
local desc="Ensure that container health is checked at runtime (Automated)"
local remediation="You should run the container using the --health-cmd parameter."
local remediationImpact="None."
local check="$id - $desc"
@ -1008,7 +1008,7 @@ check_5_27() {
fi
local id="5.27"
local desc="Ensure that Docker commands always make use of the latest version of their image (Not Scored)"
local desc="Ensure that Docker commands always make use of the latest version of their image (Manual)"
local remediation="You should use proper version pinning mechanisms (the <latest> tag which is assigned by default is still vulnerable to caching attacks) to avoid extracting cached older versions. Version pinning mechanisms should be used for base images, packages, and entire images. You can customize version pinning rules according to your requirements."
local remediationImpact="None."
local check="$id - $desc"
@ -1024,7 +1024,7 @@ check_5_28() {
fi
local id="5.28"
local desc="Ensure that the PIDs cgroup limit is used (Scored)"
local desc="Ensure that the PIDs cgroup limit is used (Automated)"
local remediation="Use --pids-limit flag with an appropriate value when launching the container."
local remediationImpact="Set the PIDs limit value as appropriate. Incorrect values might leave containers unusable."
local check="$id - $desc"
@ -1063,7 +1063,7 @@ check_5_29() {
fi
local id="5.29"
local desc="Ensure that Docker's default bridge "docker0" is not used (Not Scored)"
local desc="Ensure that Docker's default bridge 'docker0' is not used (Manual)"
local remediation="You should follow the Docker documentation and set up a user-defined network. All the containers should be run in this network."
local remediationImpact="User-defined networks need to be configured and managed in line with organizational security policy."
local check="$id - $desc"
@ -1112,7 +1112,7 @@ check_5_30() {
fi
local id="5.30"
local desc="Ensure that the host's user namespaces are not shared (Scored)"
local desc="Ensure that the host's user namespaces are not shared (Automated)"
local remediation="You should not share user namespaces between host and containers."
local remediationImpact="None."
local check="$id - $desc"
@ -1149,7 +1149,7 @@ check_5_31() {
fi
local id="5.31"
local desc="Ensure that the Docker socket is not mounted inside any containers (Scored)"
local desc="Ensure that the Docker socket is not mounted inside any containers (Automated)"
local remediation="You should ensure that no containers mount docker.sock as a volume."
local remediationImpact="None."
local check="$id - $desc"

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_6() {
logit ""
@ -11,7 +11,7 @@ check_6() {
check_6_1() {
local id="6.1"
local desc="Ensure that image sprawl is avoided (Not Scored)"
local desc="Ensure that image sprawl is avoided (Manual)"
local remediation="You should keep only the images that you actually need and establish a workflow to remove old or stale images from the host. Additionally, you should use features such as pull-by-digest to get specific images from the registry."
local remediationImpact="docker system prune -a removes all exited containers as well as all images and volumes that are not referenced by running containers, including for UCP and DTR."
local check="$id - $desc"
@ -20,7 +20,7 @@ check_6_1() {
images=$(docker images -q | sort -u | wc -l | awk '{print $1}')
active_images=0
for c in $(docker inspect --format "{{.Image}}" $(docker ps -qa) 2>/dev/null); do
for c in $(docker inspect --format "{{.Image}}" "$(docker ps -qa)" 2>/dev/null); do
if docker images --no-trunc -a | grep "$c" > /dev/null ; then
active_images=$(( active_images += 1 ))
fi
@ -37,7 +37,7 @@ check_6_1() {
check_6_2() {
local id="6.2"
local desc="Ensure that container sprawl is avoided (Not Scored)"
local desc="Ensure that container sprawl is avoided (Manual)"
local remediation="You should periodically check your container inventory on each host and clean up containers which are not in active use with the command: docker container prune"
local remediationImpact="You should retain containers that are actively in use, and delete ones which are no longer needed."
local check="$id - $desc"

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_7() {
logit ""
@ -11,7 +11,7 @@ check_7() {
check_7_1() {
local id="7.1"
local desc="Ensure swarm mode is not Enabled, if not needed (Scored)"
local desc="Ensure swarm mode is not Enabled, if not needed (Automated)"
local remediation="If swarm mode has been enabled on a system in error, you should run the command: docker swarm leave"
local remediationImpact="Disabling swarm mode will impact the operation of Docker Enterprise components if these are in use."
local check="$id - $desc"
@ -28,7 +28,7 @@ check_7_1() {
check_7_2() {
local id="7.2"
local desc="Ensure that the minimum number of manager nodes have been created in a swarm (Scored)"
local desc="Ensure that the minimum number of manager nodes have been created in a swarm (Automated)"
local remediation="If an excessive number of managers is configured, the excess nodes can be demoted to workers using command: docker node demote <manager node ID to be demoted>"
local remediationImpact="None."
local check="$id - $desc"
@ -51,7 +51,7 @@ check_7_2() {
check_7_3() {
local id="7.3"
local desc="Ensure that swarm services are bound to a specific host interface (Scored)"
local desc="Ensure that swarm services are bound to a specific host interface (Automated)"
local remediation="Resolving this issues requires re-initialization of the swarm, specifying a specific interface for the --listen-addr parameter."
local remediationImpact="None."
local check="$id - $desc"
@ -74,7 +74,7 @@ check_7_3() {
check_7_4() {
local id="7.4"
local desc="Ensure that all Docker swarm overlay networks are encrypted (Scored)"
local desc="Ensure that all Docker swarm overlay networks are encrypted (Automated)"
local remediation="You should create overlay networks the with --opt encrypted flag."
local remediationImpact="None."
local check="$id - $desc"
@ -105,7 +105,7 @@ check_7_4() {
check_7_5() {
local id="7.5"
local desc="Ensure that Docker's secret management commands are used for managing secrets in a swarm cluster (Not Scored)"
local desc="Ensure that Docker's secret management commands are used for managing secrets in a swarm cluster (Manual)"
local remediation="You should follow the docker secret documentation and use it to manage secrets effectively."
local remediationImpact="None."
local check="$id - $desc"
@ -127,7 +127,7 @@ check_7_5() {
check_7_6() {
local id="7.6"
local desc="Ensure that swarm manager is run in auto-lock mode (Scored)"
local desc="Ensure that swarm manager is run in auto-lock mode (Automated)"
local remediation="If you are initializing a swarm, use the command: docker swarm init --autolock. If you want to set --autolock on an existing swarm manager node, use the command: docker swarm update --autolock."
local remediationImpact="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."
local check="$id - $desc"
@ -149,7 +149,7 @@ check_7_6() {
check_7_7() {
local id="7.7"
local desc="Ensure that the swarm manager auto-lock key is rotated periodically (Not Scored)"
local desc="Ensure that the swarm manager auto-lock key is rotated periodically (Manual)"
local remediation="You should run the command docker swarm unlock-key --rotate to rotate the keys. To facilitate auditing of this recommendation, you should maintain key rotation records and ensure that you establish a pre-defined frequency for key rotation."
local remediationImpact="None."
local check="$id - $desc"
@ -166,7 +166,7 @@ check_7_7() {
check_7_8() {
local id="7.8"
local desc="Ensure that node certificates are rotated as appropriate (Not Scored)"
local desc="Ensure that node certificates are rotated as appropriate (Manual)"
local remediation="You should run the command docker swarm update --cert-expiry 48h to set the desired expiry time on the node certificate."
local remediationImpact="None."
local check="$id - $desc"
@ -188,7 +188,7 @@ check_7_8() {
check_7_9() {
local id="7.9"
local desc="Ensure that CA certificates are rotated as appropriate (Not Scored)"
local desc="Ensure that CA certificates are rotated as appropriate (Manual)"
local remediation="You should run the command docker swarm ca --rotate to rotate a certificate."
local remediationImpact="None."
local check="$id - $desc"
@ -205,7 +205,7 @@ check_7_9() {
check_7_10() {
local id="7.10"
local desc="Ensure that management plane traffic is separated from data plane traffic (Not Scored)"
local desc="Ensure that management plane traffic is separated from data plane traffic (Manual)"
local remediation="You should initialize the swarm with dedicated interfaces for management and data planes respectively. Example: docker swarm init --advertise-addr=192.168.0.1 --data-path-addr=17.1.0.3"
local remediationImpact="This requires two network interfaces per node."
local check="$id - $desc"

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
check_8() {
logit ""
@ -34,7 +34,7 @@ check_8_1_1() {
fi
local id="8.1.1"
local desc="Configure the LDAP authentication service (Scored)"
local desc="Configure the LDAP authentication service (Automated)"
local remediation="You can configure LDAP integration via the UCP Admin Settings UI. LDAP integration can also be enabled via a configuration file"
local remediationImpact="None."
local check="$id - $desc"
@ -50,7 +50,7 @@ check_8_1_2() {
fi
local id="8.1.2"
local desc="Use external certificates (Scored)"
local desc="Use external certificates (Automated)"
local remediation="You can configure your own certificates for UCP either during installation or after installation via the UCP Admin Settings user interface."
local remediationImpact="None."
local check="$id - $desc"
@ -98,7 +98,7 @@ check_8_1_5() {
fi
local id="8.1.5"
local desc="Enable signed image enforcement (Scored)"
local desc="Enable signed image enforcement (Automated)"
local check="$id - $desc"
starttestjson "$id" "$desc"
@ -112,7 +112,7 @@ check_8_1_6() {
fi
local id="8.1.6"
local desc="Set the Per-User Session Limit to a value of '3' or lower (Scored)"
local desc="Set the Per-User Session Limit to a value of '3' or lower (Automated)"
local remediation="Retrieve a UCP API token. Retrieve and save UCP config. Open the ucp-config.toml file, set the per_user_limit entry under the [auth.sessions] section to a value of 3 or lower, but greater than 0. Update UCP with the new configuration."
local remediationImpact="None."
local check="$id - $desc"
@ -128,7 +128,7 @@ check_8_1_7() {
fi
local id="8.1.7"
local desc="Set the 'Lifetime Minutes' and 'Renewal Threshold Minutes' values to '15' or lower and '0' respectively (Scored)"
local desc="Set the 'Lifetime Minutes' and 'Renewal Threshold Minutes' values to '15' or lower and '0' respectively (Automated)"
local remediation="Retrieve a UCP API token. Retrieve and save UCP config. Open the ucp-config.toml file, set the lifetime_minutes and renewal_threshold_minutes entries under the [auth.sessions] section to values of 15 or lower and 0 respectively. Update UCP with the new configuration."
local remediationImpact="Setting the Lifetime Minutes setting to a value that is too lower would result in users having to constantly re-authenticate to their Docker Enterprise cluster."
local check="$id - $desc"
@ -155,7 +155,7 @@ check_8_2_1() {
fi
local id="8.2.1"
local desc="Enable image vulnerability scanning (Scored)"
local desc="Enable image vulnerability scanning (Automated)"
local remediation="You can navigate to DTR Settings UI and select the Security tab to access the image scanning configuration. Select the Enable Scanning slider to enable this functionality."
local remediationImpact="None."
local check="$id - $desc"

View file

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/bash
check_c() {
logit ""
local id="99"
@ -10,9 +11,9 @@ check_c() {
check_c_1() {
local id="C.1"
local desc="This is a example check for a Scored check"
local remediation="This is an example remediation measure for a Scored check"
local remediationImpact="This is an example remediation impact for a Scored check"
local desc="This is a example check for a Automated check"
local remediation="This is an example remediation measure for a Automated check"
local remediationImpact="This is an example remediation impact for a Automated check"
local check="$id - $desc"
starttestjson "$id" "$desc"
@ -32,9 +33,9 @@ check_c_1() {
check_c_1_1() {
local id="C.1.1"
local desc="This is a example check for a Not Scored check"
local remediation="This is an example remediation measure for a Not Scored check"
local remediationImpact="This is an example remediation impact for a Not Scored check"
local desc="This is a example check for a Manual check"
local remediation="This is an example remediation measure for a Manual check"
local remediationImpact="This is an example remediation impact for a Manual check"
local check="$id - $desc"
starttestjson "$id" "$desc"

View file

@ -1,266 +0,0 @@
# Available Checks
Check ID | Category | Subcategory | Check Name
------------ | ------------ | ------------ | ------------
`host_configuration` | Host Configuration
`host_general_configuration` | | General Configuration
`check_1_1_1` | | | Ensure the container host has been Hardened (Not Scored)
`check_1_1_2` | | | Ensure that the version of Docker is up to date (Not Scored)
`linux_hosts_specific_configuration` | | Linux Hosts Specific Configuration
`check_1_2_1` | | | Ensure a separate partition for containers has been created (Scored)
`check_1_2_2` | | | Ensure only trusted users are allowed to control Docker daemon (Scored)
`check_1_2_3` | | | Ensure auditing is configured for the Docker daemon (Scored)
`check_1_2_4` | | | Ensure auditing is configured for Docker files and directories - /var/lib/docker (Scored)
`check_1_2_5` | | | Ensure auditing is configured for Docker files and directories - /etc/docker (Scored)
`check_1_2_6` | | | Ensure auditing is configured for Docker files and directories - docker.service (Scored)
`check_1_2_7` | | | Ensure auditing is configured for Docker files and directories - docker.socket (Scored)
`check_1_2_8` | | | Ensure auditing is configured for Docker files and directories - /etc/default/docker (Scored)
`check_1_2_9` | | | Ensure auditing is configured for Docker files and directories - /etc/sysconfig/docker (Scored)
`check_1_2_10` | | | Ensure auditing is configured for Docker files and directories - /etc/docker/daemon.json (Scored)
`check_1_2_11` | | | Ensure auditing is configured for Docker files and directories - /usr/bin/containerd (Scored)
`check_1_2_12` | | | Ensure auditing is configured for Docker files and directories - /usr/sbin/runc (Scored)
`docker_daemon_configuration` | Docker daemon configuration
`check_2_1` | | Ensure network traffic is restricted between containers on the default bridge (Scored)
`check_2_2` | | Ensure the logging level is set to 'info' (Scored)
`check_2_3` | | Ensure Docker is allowed to make changes to iptables (Scored)
`check_2_4` | | Ensure insecure registries are not used (Scored)
`check_2_5` | | Ensure aufs storage driver is not used (Scored)
`check_2_6` | | Ensure TLS authentication for Docker daemon is configured (Scored)
`check_2_7` | | Ensure the default ulimit is configured appropriately (Not Scored)
`check_2_8` | | Enable user namespace support (Scored)
`check_2_9` | | Ensure the default cgroup usage has been confirmed (Scored)
`check_2_10` | | Ensure base device size is not changed until needed (Scored)
`check_2_11` | | Ensure that authorization for Docker client commands is enabled (Scored)
`check_2_12` | | Ensure centralized and remote logging is configured (Scored)
`check_2_13` | | Ensure live restore is enabled (Scored)
`check_2_14` | | Ensure Userland Proxy is Disabled (Scored)
`check_2_15` | | Ensure that a daemon-wide custom seccomp profile is applied if appropriate (Not Scored)
`check_2_16` | | Ensure that experimental features are not implemented in production (Scored)
`check_2_17` | | Ensure containers are restricted from acquiring new privileges (Scored)
`docker_daemon_files` | Docker daemon configuration files
`check_3_1` | | Ensure that the docker.service file ownership is set to root:root (Scored)
`check_3_2` | | Ensure that docker.service file permissions are appropriately set (Scored)
`check_3_3` | | Ensure that docker.socket file ownership is set to root:root (Scored)
`check_3_4` | | Ensure that docker.socket file permissions are set to 644 or more restrictive (Scored)
`check_3_5` | | Ensure that the /etc/docker directory ownership is set to root:root (Scored)
`check_3_6` | | Ensure that /etc/docker directory permissions are set to 755 or more restrictively (Scored)
`check_3_7` | | Ensure that registry certificate file ownership is set to root:root (Scored)
`check_3_8` | | Ensure that registry certificate file permissions are set to 444 or more restrictively (Scored)
`check_3_9` | | Ensure that TLS CA certificate file ownership is set to root:root (Scored)
`check_3_10` | | Ensure that TLS CA certificate file permissions are set to 444 or more restrictively (Scored)
`check_3_11` | | Ensure that Docker server certificate file ownership is set to root:root (Scored)
`check_3_12` | | Ensure that the Docker server certificate file permissions are set to 444 or more restrictively (Scored)
`check_3_13` | | Ensure that the Docker server certificate key file ownership is set to root:root (Scored)
`check_3_14` | | Ensure that the Docker server certificate key file permissions are set to 400 (Scored)
`check_3_15` | | Ensure that the Docker socket file ownership is set to root:docker (Scored)
`check_3_16` | | Ensure that the Docker socket file permissions are set to 660 or more restrictively (Scored)
`check_3_17` | | Ensure that the daemon.json file ownership is set to root:root (Scored)
`check_3_18` | | Ensure that daemon.json file permissions are set to 644 or more restrictive (Scored)
`check_3_19` | | Ensure that the /etc/default/docker file ownership is set to root:root (Scored)
`check_3_20` | | Ensure that the /etc/sysconfig/docker file ownership is set to root:root (Scored)
`check_3_21` | | Ensure that the /etc/sysconfig/docker file permissions are set to 644 or more restrictively (Scored)
`check_3_22` | | Ensure that the /etc/default/docker file permissions are set to 644 or more restrictively (Scored)
`container_images` | Container Images and Build File
`check_4.1` | | Ensure that a user for the container has been created (Scored)
`check_4.2` | | Ensure that containers use only trusted base images (Not Scored)
`check_4.3` | | Ensure that unnecessary packages are not installed in the container (Not Scored)
`check_4.4` | | Ensure images are scanned and rebuilt to include security patches (Not Scored)
`check_4.5` | | Ensure Content trust for Docker is Enabled (Scored)
`check_4.6` | | Ensure that HEALTHCHECK instructions have been added to container images (Scored)
`check_4.7` | | Ensure update instructions are not used alone in the Dockerfile (Not Scored)
`check_4.8` | | Ensure setuid and setgid permissions are removed (Not Scored)
`check_4.9` | | Ensure that COPY is used instead of ADD in Dockerfiles (Not Scored)
`check_4.10` | | Ensure secrets are not stored in Dockerfiles (Not Scored)
`check_4.11` | | Ensure only verified packages are are installed (Not Scored)
`container_runtime` | Container Runtime
`check_running_containers` | | Check if exists running containers
`check_5_1` | | Ensure that, if applicable, an AppArmor Profile is enabled (Scored)
`check_5_2` | | Ensure that, if applicable, SELinux security options are set (Scored)
`check_5_3` | | Ensure that Linux kernel capabilities are restricted within containers (Scored)
`check_5_4` | | Ensure that privileged containers are not used (Scored)
`check_5_5` | | Ensure sensitive host system directories are not mounted on containers (Scored)
`check_5_6` | | Ensure sshd is not run within containers (Scored)
`check_5_7` | | Ensure privileged ports are not mapped within containers (Scored)
`check_5_8` | | Ensure that only needed ports are open on the container (Not Scored)
`check_5_9` | | Ensure that the host's network namespace is not shared (Scored)
`check_5_10` | | Ensure that the memory usage for containers is limited (Scored)
`check_5_11` | | Ensure that CPU priority is set appropriately on containers (Scored)
`check_5_12` | | Ensure that the container's root filesystem is mounted as read only (Scored)
`check_5_13` | | Ensure that incoming container traffic is bound to a specific host interface (Scored)
`check_5_14` | | Ensure that the 'on-failure' container restart policy is set to '5' (Scored)
`check_5_15` | | Ensure that the host's process namespace is not shared (Scored)
`check_5_16` | | Ensure that the host's IPC namespace is not shared (Scored)
`check_5_17` | | Ensure that host devices are not directly exposed to containers (Not Scored)
`check_5_18` | | Ensure that the default ulimit is overwritten at runtime if needed (Not Scored)
`check_5_19` | | Ensure mount propagation mode is not set to shared (Scored)
`check_5_20` | | Ensure that the host's UTS namespace is not shared (Scored)
`check_5_21` | | Ensurethe default seccomp profile is not Disabled (Scored)
`check_5_22` | | Ensure that docker exec commands are not used with the privileged option (Scored)
`check_5_23` | | Ensure that docker exec commands are not used with the user=root option (Not Scored)
`check_5_24` | | Ensure that cgroup usage is confirmed (Scored)
`check_5_25` | | Ensure that the container is restricted from acquiring additional privileges (Scored)
`check_5_26` | | Ensure that container health is checked at runtime (Scored)
`check_5_27` | | Ensure that Docker commands always make use of the latest version of their image (Not Scored)
`check_5_28` | | Ensure that the PIDs cgroup limit is used (Scored)
`check_5_29` | | Ensure that Docker's default bridge docker0 is not used (Not Scored)
`check_5_30` | | Ensure that the host's user namespaces are not shared (Scored)
`check_5_31` | | Ensure that the Docker socket is not mounted inside any containers (Scored)
`docker_security_operations` | Docker Security Operations
`check_6.1` | | Ensure that image sprawl is avoided (Not Scored)
`check_6.2` | | Ensure that container sprawl is avoided (Not Scored)
`docker_swarm_configuration` | Docker Swarm Configuration
`check_7.1` | | Ensure swarm mode is not Enabled, if not needed (Scored)
`check_7.2` | | Ensure that the minimum number of manager nodes have been created in a swarm (Scored) (Swarm mode not enabled)
`check_7.3` | | Ensure that swarm services are bound to a specific host interface (Scored) (Swarm mode not enabled)
`check_7.4` | | Ensure that all Docker swarm overlay networks are encrypted (Scored)
`check_7.5` | | Ensure that Docker's secret management commands are used for managing secrets in a swarm cluster (Not Scored) (Swarm mode not enabled)
`check_7.6` | | Ensure that swarm manager is run in auto-lock mode (Scored) (Swarm mode not enabled)
`check_7.7` | | Ensure that the swarm manager auto-lock key is rotated periodically (Not Scored) (Swarm mode not enabled)
`check_7.8` | | Ensure that node certificates are rotated as appropriate (Not Scored) (Swarm mode not enabled)
`check_7.9` | | Ensure that CA certificates are rotated as appropriate (Not Scored) (Swarm mode not enabled)
`check_7.10` | | Ensure that management plane traffic is separated from data plane traffic (Not Scored) (Swarm mode not enabled)
`docker_enterprise_configuration` | Docker Enterprise Configuration
`check_product_license` | | Check Docker license
`universal_control_plane_configuration` | | Universal Control Plane Configuration
`check_8.1.1` | | | Configure the LDAP authentication service (Scored)
`check_8.1.2` | | | Use external certificates (Scored)
`check_8.1.3` | | | Enforce the use of client certificate bundles for unprivileged users (Not Scored)
`check_8.1.4` | | | Configure applicable cluster role-based access control policies (Not Scored)
`check_8.1.5` | | | Enable signed image enforcement (Scored)
`check_8.1.6` | | | Set the Per-User Session Limit to a value of '3' or lower (Scored)
`check_8.1.7` | | | Set the 'Lifetime Minutes' and 'Renewal Threshold Minutes' values to '15' or lower and '0' respectively (Scored)
`docker_trusted_registry_configuration` | | Docker Trusted Registry Configuration
`check_8.2.1` | | | Enable image vulnerability scanning (Scored)
`community_checks` | Community contributed checks
`check_c_1` | | This is a example check
`check_c_2` | | Ensure operations on legacy registry (v1) are Disabled (Deprecated)
## Another Check ID are:
- `community_checks` -> Run all community checks
- `community` -> Is an alias for `community_checks`
- `cis` -> Run all bellow checks category:
- `host_configuration`
- `docker_daemon_configuration`
- `docker_daemon_files`
- `container_images`
- `container_runtime`
- `docker_security_operations`
- `docker_swarm_configuration`
- `docker_enterprise_configuration`
- `all` -> Run all bellow checks category:
- `cis`
- `community`
- `cis_level1` -> Run all bellow checks:
- `host_configuration_level1`
- `docker_daemon_configuration_level1`
- `docker_daemon_files_level1`
- `container_images_level1`
- `container_runtime_level1`
- `docker_security_operations_level1`
- `docker_swarm_configuration_level1`
- `docker_enterprise_configuration_level1`
- `host_configuration_level1` -> Run all bellow checks:
- `check_1_1_1`
- `check_1_1_2`
- `check_1_2_1`
- `check_1_2_2`
- `check_1_2_3`
- `check_1_2_5`
- `check_1_2_6`
- `check_1_2_7`
- `check_1_2_8`
- `check_1_2_9`
- `check_1_2_10`
- `check_1_2_11`
- `check_1_2_12`
- `docker_daemon_configuration_level1` -> Run all bellow checks:
- `check_2_1`
- `check_2_2`
- `check_2_3`
- `check_2_4`
- `check_2_5`
- `check_2_6`
- `check_2_7`
- `check_2_13`
- `check_2_14`
- `check_2_16`
- `check_2_17`
- `docker_daemon_files_level1` -> Run all bellow checks:
- `check_3_1`
- `check_3_2`
- `check_3_3`
- `check_3_4`
- `check_3_5`
- `check_3_6`
- `check_3_7`
- `check_3_8`
- `check_3_9`
- `check_3_10`
- `check_3_11`
- `check_3_12`
- `check_3_13`
- `check_3_14`
- `check_3_15`
- `check_3_16`
- `check_3_17`
- `check_3_18`
- `check_3_19`
- `check_3_20`
- `check_3_21`
- `check_3_22`
- `container_images_level1` -> Run all bellow checks:
- `check_4_1`
- `check_4_2`
- `check_4_3`
- `check_4_4`
- `check_4_6`
- `check_4_7`
- `check_4_9`
- `check_4_10`
- `container_runtime_level1` -> Run all bellow checks:
- `check_running_containers`
- `check_5_1`
- `check_5_3`
- `check_5_4`
- `check_5_5`
- `check_5_6`
- `check_5_7`
- `check_5_8`
- `check_5_9`
- `check_5_10`
- `check_5_11`
- `check_5_12`
- `check_5_13`
- `check_5_14`
- `check_5_15`
- `check_5_16`
- `check_5_17`
- `check_5_18`
- `check_5_19`
- `check_5_20`
- `check_5_21`
- `check_5_24`
- `check_5_25`
- `check_5_26`
- `check_5_27`
- `check_5_28`
- `check_5_30`
- `check_5_31`
- `docker_security_operations_level1` -> Run all bellow checks:
- `check_6_1`
- `check_6_2`
- `docker_swarm_configuration_level1` -> Run all bellow checks:
- `check_7_1`
- `check_7_2`
- `check_7_3`
- `check_7_4`
- `check_7_7`
- `docker_enterprise_configuration_level1` -> Run all bellow checks:
- `check_product_license`
- `check_8_1_1`
- `check_8_1_2`
- `check_8_1_3`
- `check_8_1_4`
- `check_8_1_5`
- `check_8_1_6`
- `check_8_1_7`
- `check_8_2_1`