docker-bench-security
docker-bench-security copied to clipboard
Test 2.18 passes if 'no-new-privileges' is set or not
The success or failure of test 2.18 is independent of the setting of the no-new-privileges configuration. The checks work as expected, if the function looks like this:
# 2.18
check_2_18() {
check_2_18="2.18 - Ensure containers are restricted from acquiring new privileges"
totalChecks=$((totalChecks + 1))
if get_docker_effective_command_line_args '--no-new-privileges' | grep "no-new-privileges" >/dev/null 2>&1; then
pass "$check_2_18"
logjson "2.18" "PASS"
currentScore=$((currentScore + 1))
elif get_docker_configuration_file_args 'no-new-privileges' | grep true >/dev/null 2>&1; then
pass "$check_2_18"
logjson "2.18" "PASS"
currentScore=$((currentScore + 1))
else
warn "$check_2_18"
logjson "2.18" "WARN"
currentScore=$((currentScore - 1))
fi
}
Thanks @nbrownuk, I'll have a look at it.