2021-04-11 19:42:08 -04:00
|
|
|
#!/bin/bash
|
|
|
|
# A simple script to install Chef inspec and the CIS Docker Benchmark InSpec Profile
|
2021-04-11 19:45:56 -04:00
|
|
|
# Runs on Ubuntu, Debian, Parrot, and Kali Linux
|
2021-04-11 19:42:08 -04:00
|
|
|
# Author: Omar Santos @santosomar
|
2022-02-22 11:36:16 -05:00
|
|
|
# version 0.2
|
2021-04-11 19:42:08 -04:00
|
|
|
|
2021-04-11 20:22:14 -04:00
|
|
|
#color settings
|
2021-04-11 19:45:56 -04:00
|
|
|
red=$(tput setaf 1)
|
|
|
|
green=$(tput setaf 2)
|
|
|
|
reset=$(tput sgr0)
|
2021-04-11 19:55:35 -04:00
|
|
|
clear
|
|
|
|
|
2021-04-11 20:22:14 -04:00
|
|
|
#welcome screen
|
2021-04-11 20:45:19 -04:00
|
|
|
echo "🔥🔥🔥 ${green} R U N C I S D O C K E R B E N C H M A R K ${reset} 🔥🔥🔥
|
|
|
|
|
2021-04-11 19:55:35 -04:00
|
|
|
Author: Omar Ωr Santos
|
|
|
|
Twitter: @santosomar
|
2022-02-22 11:36:16 -05:00
|
|
|
Version: 0.2
|
2021-04-11 19:55:35 -04:00
|
|
|
|
|
|
|
${red}This script will automatically install or upgrade InSpec and will run the latest CIS Docker Benchmark from github/dev-sec/cis-docker-benchmark
|
|
|
|
"
|
|
|
|
read -n 1 -s -r -p "Press any key to continue the setup..."
|
2021-04-11 19:45:56 -04:00
|
|
|
|
2021-04-11 20:22:14 -04:00
|
|
|
#installing InSpec
|
2021-04-11 19:45:56 -04:00
|
|
|
echo "${green}Installing InSpec"
|
|
|
|
echo "${reset}========================="
|
2021-04-11 19:42:08 -04:00
|
|
|
|
|
|
|
curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P inspec
|
2021-04-11 20:53:04 -04:00
|
|
|
|
|
|
|
inspec --chef-license=accept
|
|
|
|
|
2021-04-11 19:57:02 -04:00
|
|
|
clear
|
2021-04-11 20:22:14 -04:00
|
|
|
|
|
|
|
#running CIS Docker Benchmark directly from GitHub locally
|
2021-04-11 20:19:24 -04:00
|
|
|
echo "${red}>> Running CIS Docker Benchmark ${reset}locally on $(hostname)"
|
2021-04-11 19:51:03 -04:00
|
|
|
inspec exec https://github.com/dev-sec/cis-docker-benchmark > cis_benchmark_results.txt
|
|
|
|
|
|
|
|
printf -- '\n';
|
|
|
|
echo "${red}REPORT SUMMARY:"
|
|
|
|
tail -n 2 cis_benchmark_results.txt
|
|
|
|
|
2021-04-11 20:22:14 -04:00
|
|
|
#printing the results
|
2021-04-11 19:51:03 -04:00
|
|
|
printf -- '\n';
|
2021-04-11 20:44:18 -04:00
|
|
|
echo "✅ ${reset}The complete results have been stored at:
|
2021-04-11 20:29:13 -04:00
|
|
|
${green}$(pwd)/cis_benchmark_results.txt "
|