Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker-bench-security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ beginjson "$version" "$(date +%s)"

# Load all the tests from tests/ and run them
main () {
# Get configuration location
get_docker_configuration_file

# If there is a container with label docker_bench_security, memorize it:
benchcont="nil"
for c in $(docker ps | sed '1d' | awk '{print $NF}'); do
Expand Down
9 changes: 7 additions & 2 deletions helper_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ get_docker_effective_command_line_args() {
get_docker_cumulative_command_line_args "$OPTION" | tail -n1
}

get_docker_configuration_file_args() {
OPTION="$1"
get_docker_configuration_file() {
FILE="$(get_docker_effective_command_line_args '--config-file' | \
sed 's/.*=//g')"

Expand All @@ -94,6 +93,12 @@ get_docker_configuration_file_args() {
else
CONFIG_FILE='/dev/null'
fi
}

get_docker_configuration_file_args() {
OPTION="$1"

get_docker_configuration_file

grep "$OPTION" "$CONFIG_FILE" | sed 's/.*://g' | tr -d '" ',
}
Expand Down
2 changes: 1 addition & 1 deletion tests/2_docker_daemon_configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ check_2_6() {
starttestjson "$id_2_6" "$desc_2_6"

totalChecks=$((totalChecks + 1))
if grep -qi 'tcp://' "$CONFIG_FILE" || \
if [ $(get_docker_configuration_file_args 'tcp://') ] || \
[ $(get_docker_cumulative_command_line_args '-H' | grep -vE '(unix|fd)://') >/dev/null 2>&1 ]; then
if [ $(get_docker_configuration_file_args '"tlsverify":' | grep 'true') ] || \
[ $(get_docker_cumulative_command_line_args '--tlsverify' | grep 'tlsverify') >/dev/null 2>&1 ]; then
Expand Down