forked from metalstormbass/Snyk-Cloud-Demo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vuln_bootstrap.sh
49 lines (35 loc) · 892 Bytes
/
vuln_bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Update and download Nginx
until sudo apt-get update && sudo apt-get -y install nginx;do
sleep 1
done
# Update and download docker
until sudo apt-get -y install docker.io;do
sleep 1
done
# Pull Juice Repository
until sudo docker pull bkimminich/juice-shop;do
sleep 1
done
# Start Docker
sudo service nginx stop
sudo docker run --rm -d -p 3000:3000 bkimminich/juice-shop:latest
# Gather IP address
ip_address=$(dig +short myip.opendns.com @resolver1.opendns.com)
# Modify Nginx Config to allow access to Juice Store
sudo touch /etc/nginx/conf.d/juice.conf
sudo chmod a+w /etc/nginx/conf.d/juice.conf
sudo cat <<EOT >> /etc/nginx/conf.d/juice.conf
server {
listen 80;
listen [::]:80;
server_name $ip_address;
location / {
proxy_pass http://localhost:3000/;
}
}
EOT
sudo service nginx restart
sleep 2
sudo nginx -s reload
dir=home/ubuntu/