From 30e2af962b69fc97b6bb8d2ecfed55d9e980b139 Mon Sep 17 00:00:00 2001
From: TBF + Partner AG <118551945+tbfpartner@users.noreply.github.com>
Date: Tue, 19 Nov 2024 23:13:23 +0100
Subject: [PATCH] fix: check_2_7 not working as intended

- #L152 use jq on first if statement, as it is used on the second if statement too (dependency already given)
- #L154 fixed key which is searched for
- fixed several wrongly placed closing brackets
---
 tests/2_docker_daemon_configuration.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/2_docker_daemon_configuration.sh b/tests/2_docker_daemon_configuration.sh
index 000381f..13922bf 100644
--- a/tests/2_docker_daemon_configuration.sh
+++ b/tests/2_docker_daemon_configuration.sh
@@ -149,16 +149,16 @@ check_2_7() {
   local check="$id - $desc"
   starttestjson "$id" "$desc"
 
-  if $(grep -qE "host.*tcp://" "$CONFIG_FILE") || \
-    [ $(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
+  if $(get_docker_configuration_file_args 'hosts' | grep 'tcp://' > /dev/null 2>&1) || \
+    [ $(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
       pass -s "$check"
       logcheckresult "PASS"
       return
     fi
     if [ $(get_docker_configuration_file_args '"tls":' | grep 'true') ] || \
-        [ $(get_docker_cumulative_command_line_args '--tls' | grep 'tls$') >/dev/null 2>&1 ]; then
+        [ $(get_docker_cumulative_command_line_args '--tls' | grep 'tls$' >/dev/null 2>&1) ]; then
       warn -s "$check"
       warn "     * Docker daemon currently listening on TCP with TLS, but no verification"
       logcheckresult "WARN" "Docker daemon currently listening on TCP with TLS, but no verification"