Skip to content

Commit 45b0716

Browse files
Merge pull request #31 from ModusCreateOrg/gauntlt-refactor-scripts-and-readme
Refactor Vagrant scripts and readme for gauntlt
2 parents e0d0939 + bb42a2e commit 45b0716

File tree

3 files changed

+74
-11
lines changed

3 files changed

+74
-11
lines changed

Vagrantfile

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
Vagrant.configure("2") do |config|
22
config.vm.box = "bento/centos-7.5"
33
config.vm.synced_folder ".", "/app"
4+
config.vm.provision "shell", inline: "/app/bin/install-gauntlt.sh", upload_path: "/home/vagrant/install-gauntlt.sh"
45
config.vm.provision "shell", inline: "/app/bin/install-ansible.sh", upload_path: "/home/vagrant/install-ansible.sh"
56
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"
6-
config.vm.provision "shell", inline: "curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -"
7-
config.vm.provision "shell", inline: "curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -"
8-
config.vm.provision "shell", inline: "curl -L get.rvm.io | bash -s stable"
9-
config.vm.provision "shell", inline: "source /etc/profile.d/rvm.sh"
10-
config.vm.provision "shell", inline: "rvm reload"
11-
config.vm.provision "shell", inline: "rvm requirements run"
12-
config.vm.provision "shell", inline: "rvm install 2.6"
13-
config.vm.provision "shell", inline: "rvm alias create default ruby-2.6.0"
14-
config.vm.provision "shell", inline: "rvm list && rvm use 2.6 --default && ruby --version"
15-
config.vm.provision "shell", inline: "yum -y install ruby-devel && gem install gauntlt"
16-
config.vm.provision "shell", inline: "yum -y install nmap"
177
config.vm.network "forwarded_port", guest: 80, host: 6080, auto_correct: true
188
end

bin/install-gauntlt.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
# Install gauntlt using rvm
3+
4+
# Set bash unofficial strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
5+
set -euo pipefail
6+
IFS=$'\n\t'
7+
8+
# Set DEBUG to true for enhanced debugging: run prefixed with "DEBUG=true"
9+
${DEBUG:-false} && set -vx
10+
# Credit to https://stackoverflow.com/a/17805088
11+
# and http://wiki.bash-hackers.org/scripting/debuggingtips
12+
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
13+
14+
# Credit to http://stackoverflow.com/a/246128/424301
15+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
16+
#shellcheck disable=SC1090
17+
. "$DIR/common.sh"
18+
19+
function quick_yum_install() {
20+
declare package
21+
package=${1?"You must specify a package to install"}
22+
if ! rpm -q "$package" > /dev/null; then
23+
sudo yum -y -q install "$package"
24+
else
25+
echo "$package already installed, skipping"
26+
fi
27+
}
28+
29+
quick_yum_install ruby-devel
30+
quick_yum_install nmap
31+
32+
if [[ ! -f /etc/profile.d/rvm.sh ]]; then
33+
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
34+
curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
35+
curl -L get.rvm.io | bash -s stable
36+
# rvm hates the bash options -eu
37+
set +eu
38+
#shellcheck disable=SC1091
39+
source /etc/profile.d/rvm.sh
40+
rvm reload
41+
rvm requirements run
42+
else
43+
echo "rvm already installed"
44+
fi
45+
# rvm hates the bash options -eu
46+
set +eu
47+
#shellcheck disable=SC1091
48+
source /etc/profile.d/rvm.sh
49+
rvm reload
50+
rvm install 2.6.0
51+
rvm alias create default ruby-2.6.0
52+
rvm list
53+
rvm use 2.6 --default
54+
set -eu
55+
if is_ec2; then
56+
usermod -a -G rvm centos
57+
else
58+
usermod -a -G rvm vagrant
59+
fi
60+
ruby --version
61+
62+
if ! (gem list gauntlt | grep gauntlt > /dev/null); then
63+
echo 'gem: --no-rdoc --no-ri' > ~/.gemrc
64+
gem install gauntlt
65+
fi

gauntlt/readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Running gauntlt
2+
3+
## Vagrant
4+
You can run gauntlt through Vagrant:
5+
6+
vagrant up --provision
7+
vagrant ssh -c "cd /app/gauntlt && gauntlt"
8+
19
##Attacks
210

311
NMAP attacks taken from here:

0 commit comments

Comments
 (0)