mirror of
https://github.com/docker/docker-bench-security.git
synced 2025-01-19 00:32:34 +01:00
Merge pull request #34 from CtrlZvi/5.14_multiport_support
Fix test 5.14 to not always pass when multiple ports are published.
This commit is contained in:
commit
0cbb99d1f1
1 changed files with 11 additions and 10 deletions
|
@ -319,17 +319,18 @@ else
|
||||||
|
|
||||||
fail=0
|
fail=0
|
||||||
for c in $containers; do
|
for c in $containers; do
|
||||||
ip=$(docker port "$c" | awk '{print $3}' | cut -d ':' -f1)
|
for ip in $(docker port "$c" | awk '{print $3}' | cut -d ':' -f1); do
|
||||||
if [ "$ip" = "0.0.0.0" ]; then
|
if [ "$ip" = "0.0.0.0" ]; then
|
||||||
# If it's the first container, fail the test
|
# If it's the first container, fail the test
|
||||||
if [ $fail -eq 0 ]; then
|
if [ $fail -eq 0 ]; then
|
||||||
warn "$check_5_14"
|
warn "$check_5_14"
|
||||||
warn " * Port being bound to wildcard IP: $ip in $c"
|
warn " * Port being bound to wildcard IP: $ip in $c"
|
||||||
fail=1
|
fail=1
|
||||||
else
|
else
|
||||||
warn " * Port being bound to wildcard IP: $ip in $c"
|
warn " * Port being bound to wildcard IP: $ip in $c"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
done
|
done
|
||||||
# We went through all the containers and found no ports bound to 0.0.0.0
|
# We went through all the containers and found no ports bound to 0.0.0.0
|
||||||
if [ $fail -eq 0 ]; then
|
if [ $fail -eq 0 ]; then
|
||||||
|
|
Loading…
Reference in a new issue