Closed
Description
Hi,
While running the scan, my result for 2.6 is as per below.
{"id": "2.6", "desc": "Ensure TLS authentication for Docker daemon is configured", "result": "INFO", "details": "Docker daemon not listening on TCP"},
But my daemon.json has been configured to listen on tcp.
"hosts": ["unix:///var/run/docker.sock", "tcp://xx.xx.xx.xx:2376"],
"tls": true,
"tlsverify": true,
"tlscacert":"/var/lib/docker/certs/ca.pem",
"tlscert":"/var/lib/docker/certs/server-cert.pem",
"tlskey":"/var/lib/docker/certs/server-key.pem",
I noticed that in 2_docker_daemon_configuration.sh, line, 153, the $CONFIG_FILE
will always be null. Seems like u need to call the method get_docker_configuration_file_args
to set the variable.
Also, seems like encapsulating the grep
command with square brackets will regard the command as string instead. I tested with below.
$ if [ grep -i 'tcp://'"$CONFIG_FILE" 2>/dev/null 1>&2 ]; then echo hello; fi
$ if grep -i 'tcp://'"$CONFIG_FILE" 2>/dev/null 1>&2 ; then echo hello; fi
hello
I modified 2_docker_daemon_configuration.sh as per below to get the result I want.
echo "config file is $CONFIG_FILE"
get_docker_configuration_file_args "NA"
echo "config file is $CONFIG_FILE again"
totalChecks=$((totalChecks + 1))
if grep -i 'tcp://' "$CONFIG_FILE" 2>/dev/null 1>&2 || \
[ $(get_docker_cumulative_command_line_args '-H' | grep -vE '(unix|fd)://') >/dev/null 2>&1 ]; then
echo "passed the first if?";
My log result is as per below:
# ./docker-bench-security.sh -l 2.6.log -c check_2_6
# ------------------------------------------------------------------------------
# Docker Bench for Security v1.3.5
#
# Docker, Inc. (c) 2015-
#
# Checks for dozens of common best-practices around deploying Docker containers in production.
# Inspired by the CIS Docker Benchmark v1.2.0.
# ------------------------------------------------------------------------------
Initializing Thu Dec 12 14:40:33 +08 2019
config file is
config file is /etc/docker/daemon.json again
passed the first if?
[PASS] 2.6 - Ensure TLS authentication for Docker daemon is configured
[INFO] Checks: 1
[INFO] Score: 1
Thanks!
Metadata
Metadata
Assignees
Labels
No labels