diff --git a/Vagrantfile b/Vagrantfile index 2f84769..eeda2ac 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,18 +1,8 @@ Vagrant.configure("2") do |config| config.vm.box = "bento/centos-7.5" config.vm.synced_folder ".", "/app" + config.vm.provision "shell", inline: "/app/bin/install-gauntlt.sh", upload_path: "/home/vagrant/install-gauntlt.sh" config.vm.provision "shell", inline: "/app/bin/install-ansible.sh", upload_path: "/home/vagrant/install-ansible.sh" config.vm.provision "shell", inline: "cd /app/ansible && ansible-playbook -l localhost bakery.yml app-AfterInstall.yml app-StartServer.yml", upload_path: "/home/vagrant/apl.sh" - config.vm.provision "shell", inline: "curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -" - config.vm.provision "shell", inline: "curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -" - config.vm.provision "shell", inline: "curl -L get.rvm.io | bash -s stable" - config.vm.provision "shell", inline: "source /etc/profile.d/rvm.sh" - config.vm.provision "shell", inline: "rvm reload" - config.vm.provision "shell", inline: "rvm requirements run" - config.vm.provision "shell", inline: "rvm install 2.6" - config.vm.provision "shell", inline: "rvm alias create default ruby-2.6.0" - config.vm.provision "shell", inline: "rvm list && rvm use 2.6 --default && ruby --version" - config.vm.provision "shell", inline: "yum -y install ruby-devel && gem install gauntlt" - config.vm.provision "shell", inline: "yum -y install nmap" config.vm.network "forwarded_port", guest: 80, host: 6080, auto_correct: true end diff --git a/bin/install-gauntlt.sh b/bin/install-gauntlt.sh new file mode 100755 index 0000000..843d51c --- /dev/null +++ b/bin/install-gauntlt.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +# Install gauntlt using rvm + +# Set bash unofficial strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/ +set -euo pipefail +IFS=$'\n\t' + +# Set DEBUG to true for enhanced debugging: run prefixed with "DEBUG=true" +${DEBUG:-false} && set -vx +# Credit to https://stackoverflow.com/a/17805088 +# and http://wiki.bash-hackers.org/scripting/debuggingtips +export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' + +# Credit to http://stackoverflow.com/a/246128/424301 +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +#shellcheck disable=SC1090 +. "$DIR/common.sh" + +function quick_yum_install() { + declare package + package=${1?"You must specify a package to install"} + if ! rpm -q "$package" > /dev/null; then + sudo yum -y -q install "$package" + else + echo "$package already installed, skipping" + fi +} + +quick_yum_install ruby-devel +quick_yum_install nmap + +if [[ ! -f /etc/profile.d/rvm.sh ]]; then + curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - + curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - + curl -L get.rvm.io | bash -s stable + # rvm hates the bash options -eu + set +eu + #shellcheck disable=SC1091 + source /etc/profile.d/rvm.sh + rvm reload + rvm requirements run +else + echo "rvm already installed" +fi +# rvm hates the bash options -eu +set +eu +#shellcheck disable=SC1091 +source /etc/profile.d/rvm.sh +rvm reload +rvm install 2.6.0 +rvm alias create default ruby-2.6.0 +rvm list +rvm use 2.6 --default +set -eu +if is_ec2; then + usermod -a -G rvm centos +else + usermod -a -G rvm vagrant +fi +ruby --version + +if ! (gem list gauntlt | grep gauntlt > /dev/null); then + echo 'gem: --no-rdoc --no-ri' > ~/.gemrc + gem install gauntlt +fi diff --git a/gauntlt/readme.md b/gauntlt/readme.md index c415246..65b4825 100644 --- a/gauntlt/readme.md +++ b/gauntlt/readme.md @@ -1,3 +1,11 @@ +# Running gauntlt + +## Vagrant +You can run gauntlt through Vagrant: + + vagrant up --provision + vagrant ssh -c "cd /app/gauntlt && gauntlt" + ##Attacks NMAP attacks taken from here: