From 8b0efa170f9f75bd4d9f1a10220a913ea78d7861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Fri, 10 Jul 2015 01:30:38 +0200 Subject: [PATCH 1/3] split cmdline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- tests/3_docker_daemon_configuration_files.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/3_docker_daemon_configuration_files.sh b/tests/3_docker_daemon_configuration_files.sh index 491f538..fca90a1 100644 --- a/tests/3_docker_daemon_configuration_files.sh +++ b/tests/3_docker_daemon_configuration_files.sh @@ -292,7 +292,7 @@ fi # 3.19 check_3_19="3.19 - Verify that TLS CA certificate file ownership is set to root:root" -tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscacert=\([^s]\)/\1/p' | cut -d " " -f 1) +tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscacert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlscacert" ]; then if [ "$(stat -c %u%g $file)" -eq 00 ]; then pass "$check_3_19" @@ -307,7 +307,7 @@ fi # 3.20 check_3_20="3.20 - Verify that TLS CA certificate file permissions are set to 444" -tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscacert=\([^s]\)/\1/p' | cut -d " " -f 1) +tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscacert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlscacert" ]; then perms=$(ls -ld "$tlscacert" | awk '{print $1}') if [ "$perms" = "-r--r--r--" ]; then @@ -323,7 +323,7 @@ fi # 3.21 check_3_21="3.21 - Verify that Docker server certificate file ownership is set to root:root" -tlscert=$(get_command_line_args docker | sed -n 's/.*tlscert=\([^s]\)/\1/p' | cut -d " " -f 1) +tlscert=$(get_command_line_args docker | sed -n 's/.*tlscert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlscert" ]; then if [ "$(stat -c %u%g $file)" -eq 00 ]; then pass "$check_3_21" @@ -338,7 +338,7 @@ fi # 3.22 check_3_22="3.22 - Verify that Docker server certificate file permissions are set to 444" -tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscert=\([^s]\)/\1/p' | cut -d " " -f 1) +tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlscert" ]; then perms=$(ls -ld "$tlscert" | awk '{print $1}') if [ "$perms" = "-r--r--r--" ]; then @@ -354,7 +354,7 @@ fi # 3.23 check_3_23="3.23 - Verify that Docker server key file ownership is set to root:root" -tlskey=$(get_command_line_args docker | sed -n 's/.*tlskey=\([^s]\)/\1/p' | cut -d " " -f 1) +tlskey=$(get_command_line_args docker | sed -n 's/.*tlskey=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlskey" ]; then if [ "$(stat -c %u%g $file)" -eq 00 ]; then pass "$check_3_23" @@ -369,7 +369,7 @@ fi # 3.24 check_3_24="3.24 - Verify that Docker server key file permissions are set to 400" -tlskey=$(get_command_line_args docker | sed -n 's/.*tlskey=\([^s]\)/\1/p' | cut -d " " -f 1) +tlskey=$(get_command_line_args docker | sed -n 's/.*tlskey=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlskey" ]; then perms=$(ls -ld "$tlskey" | awk '{print $1}') if [ "$perms" = "-r--------" ]; then From b3fd225df87271f996fb0f96b109672820af767f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Fri, 10 Jul 2015 01:43:11 +0200 Subject: [PATCH 2/3] fix incorrect file variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- tests/1_host_configuration.sh | 2 +- tests/3_docker_daemon_configuration_files.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/1_host_configuration.sh b/tests/1_host_configuration.sh index 9d0b72d..66bc1ee 100644 --- a/tests/1_host_configuration.sh +++ b/tests/1_host_configuration.sh @@ -74,7 +74,7 @@ fi # 1.9 check_1_9="1.9 - Audit Docker files and directories - /var/lib/docker" directory="/var/lib/docker" -if [ -d "$file" ]; then +if [ -d "$directory" ]; then command -v auditctl >/dev/null 2>&1 if [ $? -eq 0 ]; then auditctl -l | grep $directory >/dev/null 2>&1 diff --git a/tests/3_docker_daemon_configuration_files.sh b/tests/3_docker_daemon_configuration_files.sh index fca90a1..ce0ecd6 100644 --- a/tests/3_docker_daemon_configuration_files.sh +++ b/tests/3_docker_daemon_configuration_files.sh @@ -294,7 +294,7 @@ fi check_3_19="3.19 - Verify that TLS CA certificate file ownership is set to root:root" tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscacert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlscacert" ]; then - if [ "$(stat -c %u%g $file)" -eq 00 ]; then + if [ "$(stat -c %u%g "$tlscacert")" -eq 00 ]; then pass "$check_3_19" else warn "$check_3_19" @@ -325,7 +325,7 @@ fi check_3_21="3.21 - Verify that Docker server certificate file ownership is set to root:root" tlscert=$(get_command_line_args docker | sed -n 's/.*tlscert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlscert" ]; then - if [ "$(stat -c %u%g $file)" -eq 00 ]; then + if [ "$(stat -c %u%g "$tlscert")" -eq 00 ]; then pass "$check_3_21" else warn "$check_3_21" @@ -356,7 +356,7 @@ fi check_3_23="3.23 - Verify that Docker server key file ownership is set to root:root" tlskey=$(get_command_line_args docker | sed -n 's/.*tlskey=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlskey" ]; then - if [ "$(stat -c %u%g $file)" -eq 00 ]; then + if [ "$(stat -c %u%g "$tlskey")" -eq 00 ]; then pass "$check_3_23" else warn "$check_3_23" From 6fca0428e7c5ecc6b57b0ea574af3ce21fe03345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Fri, 10 Jul 2015 02:10:26 +0200 Subject: [PATCH 3/3] missed one tls* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- tests/3_docker_daemon_configuration_files.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/3_docker_daemon_configuration_files.sh b/tests/3_docker_daemon_configuration_files.sh index ce0ecd6..18af6e8 100644 --- a/tests/3_docker_daemon_configuration_files.sh +++ b/tests/3_docker_daemon_configuration_files.sh @@ -338,7 +338,7 @@ fi # 3.22 check_3_22="3.22 - Verify that Docker server certificate file permissions are set to 444" -tlscacert=$(get_command_line_args docker | sed -n 's/.*tlscert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) +tlscert=$(get_command_line_args docker | sed -n 's/.*tlscert=\([^s]\)/\1/p' | sed 's/--/ --/g' | cut -d " " -f 1) if [ -f "$tlscert" ]; then perms=$(ls -ld "$tlscert" | awk '{print $1}') if [ "$perms" = "-r--r--r--" ]; then