mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-31 06:22:32 +01:00
Updated mountpoint check to support user namespace
This commit is contained in:
parent
919816dbbf
commit
d85c73316a
1 changed files with 6 additions and 3 deletions
|
@ -73,9 +73,12 @@ check_1_2_1() {
|
||||||
starttestjson "$id_1_2_1" "$desc_1_2_1"
|
starttestjson "$id_1_2_1" "$desc_1_2_1"
|
||||||
|
|
||||||
totalChecks=$((totalChecks + 1))
|
totalChecks=$((totalChecks + 1))
|
||||||
local system_partition=$(df / --output=source 2> /dev/null | sed -n 2p)
|
docker_root_dir=$(docker info -f '{{ .DockerRootDir }}')
|
||||||
local docker_partition=$(df "$(docker info -f '{{ .DockerRootDir }}')" --output=source 2> /dev/null | sed -n 2p)
|
if docker info | grep -q userns ; then
|
||||||
if [ "$system_partition" != "$docker_partition" ] && [ ! -z "$docker_partition" ] ; then
|
docker_root_dir=$(readlink -f "$docker_root_dir/..")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if mountpoint -q -- "$docker_root_dir" >/dev/null 2>&1; then
|
||||||
pass "$check_1_2_1"
|
pass "$check_1_2_1"
|
||||||
resulttestjson "PASS"
|
resulttestjson "PASS"
|
||||||
currentScore=$((currentScore + 1))
|
currentScore=$((currentScore + 1))
|
||||||
|
|
Loading…
Reference in a new issue