From db8a8c0d96ae03bbdb8d23c51eddc5e53412535f Mon Sep 17 00:00:00 2001 From: Cheng-Li Jerry Ma Date: Thu, 8 Nov 2018 14:06:33 -0700 Subject: [PATCH 1/3] Fix -e option always skipping check_1, check_2, check_3 and ... this also caused the output json to be malformed without proper grouping/nesting Signed-off-by: Cheng-Li Jerry Ma --- docker-bench-security.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-bench-security.sh b/docker-bench-security.sh index 43d5846..4a4a4ff 100755 --- a/docker-bench-security.sh +++ b/docker-bench-security.sh @@ -126,7 +126,7 @@ main () { cis elif [ -z "$check" ] && [ "$checkexclude" ]; then checkexcluded="$(echo ",$checkexclude" | sed -e 's/^/\^/g' -e 's/,/\$|/g' -e 's/$/\$/g')" - grep 'check_[0-9]_' functions_lib.sh | grep -vE "\'$checkexcluded\'" | while read -r c; do + grep 'check_[0-9]' functions_lib.sh | grep -vE "\'$checkexcluded\'" | while read -r c; do "$c" done else From 37ccf4dbcf740998cc1ff51d7b3f3b81690612e6 Mon Sep 17 00:00:00 2001 From: Cheng-Li Jerry Ma Date: Thu, 8 Nov 2018 15:05:28 -0700 Subject: [PATCH 2/3] Fix -e option last entry is not excluded in docker Signed-off-by: Cheng-Li Jerry Ma --- docker-bench-security.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-bench-security.sh b/docker-bench-security.sh index 4a4a4ff..b850f00 100755 --- a/docker-bench-security.sh +++ b/docker-bench-security.sh @@ -126,7 +126,7 @@ main () { cis elif [ -z "$check" ] && [ "$checkexclude" ]; then checkexcluded="$(echo ",$checkexclude" | sed -e 's/^/\^/g' -e 's/,/\$|/g' -e 's/$/\$/g')" - grep 'check_[0-9]' functions_lib.sh | grep -vE "\'$checkexcluded\'" | while read -r c; do + grep 'check_[0-9]' functions_lib.sh | grep -vE "$checkexcluded" | while read -r c; do "$c" done else From 304094cbb23840000d0d0b3ed7013e55310ef572 Mon Sep 17 00:00:00 2001 From: Cheng-Li Jerry Ma Date: Thu, 8 Nov 2018 15:09:34 -0700 Subject: [PATCH 3/3] Fix -e option totalChecks and currentScore always 0 Signed-off-by: Cheng-Li Jerry Ma --- docker-bench-security.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-bench-security.sh b/docker-bench-security.sh index b850f00..dbb4640 100755 --- a/docker-bench-security.sh +++ b/docker-bench-security.sh @@ -126,7 +126,7 @@ main () { cis elif [ -z "$check" ] && [ "$checkexclude" ]; then checkexcluded="$(echo ",$checkexclude" | sed -e 's/^/\^/g' -e 's/,/\$|/g' -e 's/$/\$/g')" - grep 'check_[0-9]' functions_lib.sh | grep -vE "$checkexcluded" | while read -r c; do + for c in $(grep 'check_[0-9]' functions_lib.sh | grep -vE "$checkexcluded"); do "$c" done else