mirror of
				https://github.com/docker/docker-bench-security.git
				synced 2025-11-04 02:58:59 +00:00 
			
		
		
		
	fail=1 when Docker exec fails
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
This commit is contained in:
		
					parent
					
						
							
								d964e084fc
							
						
					
				
			
			
				commit
				
					
						643beee453
					
				
			
		
					 1 changed files with 14 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -61,6 +61,13 @@ else
 | 
			
		|||
 | 
			
		||||
  fail=0
 | 
			
		||||
  for c in $containers; do
 | 
			
		||||
    exec_check=`docker exec $c ps -el 2>/dev/null`
 | 
			
		||||
    if [ $? -eq 255 ]; then
 | 
			
		||||
      warn "$check_5_3"
 | 
			
		||||
      warn "      * Docker exec fails: $c"
 | 
			
		||||
      fail=1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    processes=`docker exec $c ps -el 2>/dev/null | wc -l | awk '{print $1}'`
 | 
			
		||||
    if [ $processes -gt 5 ]; then
 | 
			
		||||
      # If it's the first container, fail the test
 | 
			
		||||
| 
						 | 
				
			
			@ -165,8 +172,14 @@ else
 | 
			
		|||
 | 
			
		||||
  fail=0
 | 
			
		||||
  for c in $containers; do
 | 
			
		||||
    processes=`docker exec $c ps -el 2>/dev/null | grep sshd | wc -l | awk '{print $1}'`
 | 
			
		||||
    exec_check=`docker exec $c ps -el 2>/dev/null`
 | 
			
		||||
    if [ $? -eq 255 ]; then
 | 
			
		||||
      warn "$check_5_7"
 | 
			
		||||
      warn "     * Docker exec failed: $c"
 | 
			
		||||
      fail=1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    processes=`docker exec $c ps -el 2>/dev/null | grep sshd | wc -l | awk '{print $1}'`
 | 
			
		||||
    if [ $processes -gt 1 ]; then
 | 
			
		||||
      # If it's the first container, fail the test
 | 
			
		||||
      if [ $fail -eq 0 ]; then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue