-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainer-config.yml
29 lines (26 loc) · 1.27 KB
/
container-config.yml
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
#cloud-config
package_update: true
package_upgrade: true
package_reboot_if_required: false
packages:
- net-tools
- openfortivpn
- dnsmasq
runcmd:
- ifconfig > /home/ubuntu/start_if
- cat /etc/resolv.conf > /home/ubuntu/start_resolv
- route -n > /home/ubuntu/start_table
- echo "**** Setup folder structure *****"
- sudo ln -s /opt/init/switch-dns.sh /usr/local/bin/switch-dns
- sudo ln -s /opt/openfortivpn/openforti.sh /usr/local/bin/openforti
- sudo ln -s /opt/nat/nat-init.sh /usr/local/bin/nat-init
- sudo rm /etc/ppp/ip-up.d/*
- sudo rm /etc/ppp/ip-down.d/*
- sudo ln -s /opt/ppp/ip-up.d/0000usepeerdns.sh /etc/ppp/ip-up.d/0000usepeerdns
- sudo ln -s /opt/ppp/ip-down.d/0000usepeerdns.sh /etc/ppp/ip-down.d/0000usepeerdns
- echo "**** Setup DNSMasq *****"
- DNS1=$(grep -E '^nameserver ' /etc/resolv.conf | head -1 | awk '{print $2}') && echo "server=192.168.64.1" | sudo tee /etc/dnsmasq.d/server.conf
- IPv4=$(ifconfig ens3 | grep -E 'inet ' | awk '{print $2}') && printf "listen-address=127.0.0.1\nlisten-address=$IPv4\n" | sudo tee -a /etc/dnsmasq.conf
- echo "conf-dir=/etc/dnsmasq.d/,*.conf" | sudo tee -a /etc/dnsmasq.conf
- echo "no-resolv" | sudo tee -a /etc/dnsmasq.conf
final_message: "VPN container successfully initialized in $UPTIME seconds"