mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-21 21:04:46 +02:00
Split of Docker tests
This commit is contained in:
parent
285dde402f
commit
1ea2578494
@ -26,6 +26,8 @@
|
||||
#
|
||||
#################################################################################
|
||||
#
|
||||
DOCKER_CONTAINERS_RUNNING=0
|
||||
DOCKER_CONTAINERS_TOTAL=0
|
||||
DOCKER_FILE_PERMISSIONS_WARNINGS=0
|
||||
RUN_DOCKER_TESTS=0
|
||||
#
|
||||
@ -134,7 +136,7 @@
|
||||
|
||||
# Check total of containers
|
||||
LogText "Test: checking total amount of Docker containers"
|
||||
DOCKER_CONTAINERS_TOTAL=`${DOCKERBINARY} info 2> /dev/null | ${GREPBINARY} "^Containers: " | ${AWKBINARY} '{ print $2 }'`
|
||||
DOCKER_CONTAINERS_TOTAL=$(${DOCKERBINARY} info 2> /dev/null | ${GREPBINARY} "^Containers: " | ${AWKBINARY} '{ print $2 }')
|
||||
if [ "${DOCKER_CONTAINERS_TOTAL}" = "" ]; then
|
||||
DOCKER_CONTAINERS_TOTAL=0
|
||||
fi
|
||||
@ -159,7 +161,16 @@
|
||||
LogText "Result: no active containers"
|
||||
Report "docker_containers_running=0"
|
||||
fi
|
||||
|
||||
fi
|
||||
#
|
||||
#################################################################################
|
||||
#
|
||||
# Test : CONT-8107
|
||||
# Description : Checking Docker number of unused containers
|
||||
# Notes : Hardening points are awarded, if there aren't a lot of stopped containers
|
||||
if [ ! "${DOCKERBINARY}" = "" -a ${RUN_DOCKER_TESTS} -eq 1 ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
||||
Register --test-no CONT-8107 --preqs-met ${PREQS_MET} --weight L --network NO --category performance --description "Check number of Docker containers"
|
||||
if [ ${SKIPTEST} -eq 0 ]; then
|
||||
# Check if there aren't too many unused containers on the system
|
||||
if [ ${DOCKER_CONTAINERS_TOTAL} -gt 0 ]; then
|
||||
DOCKER_CONTAINERS_UNUSED=$((DOCKER_CONTAINERS_TOTAL - DOCKER_CONTAINERS_RUNNING))
|
||||
|
Loading…
x
Reference in New Issue
Block a user