mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-06-20 05:39:08 +00:00
fixes systemctl issue in get_systemd_service_file for containerized scan which cannot run systemctl show -p FragmentPath. Includes improvement when reporting Files not found.
This commit is contained in:
parent
8a0852e17f
commit
bd5d2e82ba
3 changed files with 46 additions and 44 deletions
|
@ -105,6 +105,8 @@ get_systemd_service_file() {
|
|||
echo "/etc/systemd/system/$SERVICE"
|
||||
elif systemctl show -p FragmentPath "$SERVICE" 2> /dev/null 1>&2; then
|
||||
systemctl show -p FragmentPath "$SERVICE" | sed 's/.*=//'
|
||||
elif [ -f "/lib/systemd/system/$SERVICE" ]; then
|
||||
echo "/lib/systemd/system/$SERVICE"
|
||||
else
|
||||
echo "/usr/lib/systemd/system/$SERVICE"
|
||||
fi
|
||||
|
|
|
@ -147,8 +147,8 @@ check_1_6() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_6"
|
||||
info " * Directory not found"
|
||||
resulttestjson "INFO" "Directory not found"
|
||||
info " * Directory $directory not found"
|
||||
resulttestjson "INFO" "Directory $directory not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -184,8 +184,8 @@ check_1_7() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_7"
|
||||
info " * Directory not found"
|
||||
resulttestjson "INFO" "Directory not found"
|
||||
info " * Directory $directory not found"
|
||||
resulttestjson "INFO" "Directory $directory not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -221,8 +221,8 @@ check_1_8() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_8"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -258,8 +258,8 @@ check_1_9() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_9"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -295,8 +295,8 @@ check_1_10() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_10"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -332,8 +332,8 @@ check_1_11() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_11"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -369,8 +369,8 @@ check_1_12() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_12"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -406,8 +406,8 @@ check_1_13() {
|
|||
fi
|
||||
else
|
||||
info "$check_1_13"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ check_3_1() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_1"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ check_3_2() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_2"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ check_3_3() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_3"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ check_3_4() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_4"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -143,8 +143,8 @@ check_3_5() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_5"
|
||||
info " * Directory not found"
|
||||
resulttestjson "INFO" "Directory not found"
|
||||
info " * Directory $directory not found"
|
||||
resulttestjson "INFO" "Directory $directory not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -171,8 +171,8 @@ check_3_6() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_6"
|
||||
info " * Directory not found"
|
||||
resulttestjson "INFO" "Directory not found"
|
||||
info " * Directory $directory not found"
|
||||
resulttestjson "INFO" "Directory $directory not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -206,8 +206,8 @@ check_3_7() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_7"
|
||||
info " * Directory not found"
|
||||
resulttestjson "INFO" "Directory not found"
|
||||
info " * Directory $directory not found"
|
||||
resulttestjson "INFO" "Directory $directory not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -241,8 +241,8 @@ check_3_8() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_8"
|
||||
info " * Directory not found"
|
||||
resulttestjson "INFO" "Directory not found"
|
||||
info " * Directory $directory not found"
|
||||
resulttestjson "INFO" "Directory $directory not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -461,8 +461,8 @@ check_3_15() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_15"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -489,8 +489,8 @@ check_3_16() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_16"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -517,8 +517,8 @@ check_3_17() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_17"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -545,8 +545,8 @@ check_3_18() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_18"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -573,8 +573,8 @@ check_3_19() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_19"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
@ -601,8 +601,8 @@ check_3_20() {
|
|||
fi
|
||||
else
|
||||
info "$check_3_20"
|
||||
info " * File not found"
|
||||
resulttestjson "INFO" "File not found"
|
||||
info " * File $file not found"
|
||||
resulttestjson "INFO" "File $file not found"
|
||||
currentScore=$((currentScore + 0))
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue