mirror of
https://github.com/docker/docker-bench-security.git
synced 2024-11-01 08:31:44 +01:00
shellcheck fixes
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
This commit is contained in:
parent
62a903246c
commit
b5c571df18
3 changed files with 4 additions and 4 deletions
|
@ -40,7 +40,7 @@ fi
|
|||
# 1.6
|
||||
check_1_6="1.6 - Keep Docker up to date"
|
||||
docker_version=$(docker version | grep 'Server version' | awk '{print $3}')
|
||||
do_version_check 1.6.2 $docker_version
|
||||
do_version_check 1.6.2 "$docker_version"
|
||||
if [ $? -eq 11 ]; then
|
||||
warn "$check_1_6"
|
||||
else
|
||||
|
|
|
@ -180,7 +180,7 @@ else
|
|||
fi
|
||||
|
||||
processes=$(docker exec "$c" ps -el 2>/dev/null | grep -c sshd | awk '{print $1}')
|
||||
if [ $processes -gt 1 ]; then
|
||||
if [ "$processes" -gt 1 ]; then
|
||||
# If it's the first container, fail the test
|
||||
if [ $fail -eq 0 ]; then
|
||||
warn "$check_5_7"
|
||||
|
|
|
@ -40,7 +40,7 @@ images=$(docker images -q | wc -l | awk '{print $1}')
|
|||
active_images=0
|
||||
|
||||
for c in $(docker inspect -f "{{.Image}}" $(docker ps -qa)); do
|
||||
if docker images --no-trunc -a | grep $c > /dev/null ; then
|
||||
if docker images --no-trunc -a | grep "$c" > /dev/null ; then
|
||||
active_images=$(( active_images += 1 ))
|
||||
fi
|
||||
done
|
||||
|
@ -61,7 +61,7 @@ fi
|
|||
check_6_7="6.7 - Avoid container sprawl"
|
||||
total_containers=$(docker info 2>/dev/null | grep "Containers" | awk '{print $2}')
|
||||
running_containers=$(docker ps -q | wc -l | awk '{print $1}')
|
||||
diff="$(($total_containers - $running_containers))"
|
||||
diff="$((total_containers - running_containers))"
|
||||
if [ "$diff" -gt 25 ]; then
|
||||
warn "$check_6_7"
|
||||
warn " * There are currently a total of $total_containers containers, with only $running_containers of them currently running"
|
||||
|
|
Loading…
Reference in a new issue