docker-bench-security icon indicating copy to clipboard operation
docker-bench-security copied to clipboard

Test 2.18 passes if 'no-new-privileges' is set or not

Open nbrownuk opened this issue 8 years ago • 1 comments

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
}

nbrownuk avatar Feb 08 '18 16:02 nbrownuk

Thanks @nbrownuk, I'll have a look at it.

konstruktoid avatar Feb 09 '18 09:02 konstruktoid