mirror of
				https://github.com/docker/docker-bench-security.git
				synced 2025-11-04 02:58:59 +00:00 
			
		
		
		
	update info messages, not scored
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
This commit is contained in:
		
					parent
					
						
							
								ceb516fc29
							
						
					
				
			
			
				commit
				
					
						77617321df
					
				
			
		
					 5 changed files with 73 additions and 23 deletions
				
			
		| 
						 | 
				
			
			@ -1,10 +1,22 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
logit "\n"
 | 
			
		||||
info "6  - Docker Security Operations"
 | 
			
		||||
info "6 - Docker Security Operations"
 | 
			
		||||
 | 
			
		||||
# 6.1
 | 
			
		||||
check_6_1="6.1  - Perform regular security audits of your host system and containers"
 | 
			
		||||
info "$check_6_1"
 | 
			
		||||
 | 
			
		||||
# 6.2
 | 
			
		||||
check_6_2="6.2  - Monitor Docker containers usage, performance and metering"
 | 
			
		||||
info "$check_6_2"
 | 
			
		||||
 | 
			
		||||
# 6.3
 | 
			
		||||
check_6_3="6.3  - Backup container data"
 | 
			
		||||
info "$check_6_3"
 | 
			
		||||
 | 
			
		||||
# 6.4
 | 
			
		||||
check_6_4="6.4 - Avoid image sprawl"
 | 
			
		||||
check_6_4="6.4  - Avoid image sprawl"
 | 
			
		||||
images=$(docker images -q | sort -u | wc -l | awk '{print $1}')
 | 
			
		||||
active_images=0
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -14,26 +26,21 @@ for c in $(docker inspect -f "{{.Image}}" $(docker ps -qa)); do
 | 
			
		|||
  fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
if [ "$images" -gt 100 ]; then
 | 
			
		||||
  warn "$check_6_4"
 | 
			
		||||
  warn "     * There are currently: $images images"
 | 
			
		||||
else
 | 
			
		||||
  info "$check_6_4"
 | 
			
		||||
  info "     * There are currently: $images images"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "$active_images" -lt "$((images / 2))" ]; then
 | 
			
		||||
  warn "     * Only $active_images out of $images are in use"
 | 
			
		||||
  info "     * Only $active_images out of $images are in use"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# 6.5
 | 
			
		||||
check_6_5="6.5 - Avoid container sprawl"
 | 
			
		||||
check_6_5="6.5  - 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))"
 | 
			
		||||
if [ "$diff" -gt 25 ]; then
 | 
			
		||||
  warn "$check_6_5"
 | 
			
		||||
  warn "     * There are currently a total of $total_containers containers, with only $running_containers of them currently running"
 | 
			
		||||
  info "$check_6_5"
 | 
			
		||||
  info "     * There are currently a total of $total_containers containers, with only $running_containers of them currently running"
 | 
			
		||||
else
 | 
			
		||||
  info "$check_6_5"
 | 
			
		||||
  info "     * There are currently a total of $total_containers containers, with $running_containers of them currently running"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue