#!/bin/sh # ------------------------------------------------------------------------------ # Docker Bench for Security v1.1.0 # # Docker, Inc. (c) 2015- # # Checks for dozens of common best-practices around deploying Docker containers in production. # Inspired by the CIS Docker 1.11 Benchmark: # https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=docker16.110 # # ------------------------------------------------------------------------------ # Setup the paths this_path=$(dirname "${0}") ## Path of this file including filenamel myname=$(basename "${this_path}") ## file name of this script. # Load dependencies . ${this_path}/output_lib.sh . ${this_path}/helper_lib.sh export PATH=/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin/ # Check for required program(s) req_progs='awk docker grep netstat stat' for p in $req_progs; do command -v "$p" >/dev/null 2>&1 || { printf "%s command not found.\n" "$p"; exit 1; } done # Ensure we can connect to docker daemon docker ps -q >/dev/null 2>&1 if [ $? -ne 0 ]; then printf "Error connecting to docker daemon (does docker ps work?)\n" exit 1 fi usage () { cat <