config script

master
Fabien Benetou 1 year ago
commit b753c467cc
  1. 41
      cloudinit
  2. 16
      spawn

@ -0,0 +1,41 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
cd /root
echo "---------------------- installing OpenVPN"
curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
chmod +x openvpn-install.sh
echo "---------------------- starting OpenVPN"
AUTO_INSTALL=y ./openvpn-install.sh
echo "---------------------- reconfiguring OpenVPN"
echo client-to-client >> /etc/openvpn/server.conf
systemctl stop iptables-openvpn
sed "s/tun0 -o eth0 -j ACCEPT/tun0 -o eth0 -j REJECT/" -i /etc/iptables/add-openvpn-rules.sh
sed "s/tun0 -o eth0 -j ACCEPT/tun0 -o eth0 -j REJECT/" -i /etc/iptables/rm-openvpn-rules.sh
systemctl start iptables-openvpn
echo "---------------------- adding another account for OpenVPN"
export MENU_OPTION="1"
export CLIENT="client-other"
export PASS="1"
./openvpn-install.sh
export CLIENT="client-yet-another"
./openvpn-install.sh
echo "---------------------- installing git"
sudo apt install -y git
echo "---------------------- installing offline modified NAF"
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&apt-get install -y nodejs
git clone https://git.benetou.fr/utopiah/local-metaverse-tooling
cd local-metaverse-tooling/
./get_local_aframe
./get_local_naf
mkdir /root/local-metaverse-tooling/networked-aframe/examples/vpnclients
mv *ovpn /root/local-metaverse-tooling/networked-aframe/examples/vpnclients/
echo "---------------------- adding to cron for reboot"
echo '@reboot cd ~/local-metaverse-tooling/networked-aframe/ && $(which node) server/easyrtc-server.js' > cron
crontab cron
echo "---------------------- all done, configured VPN client files available at /vpnclients/*.ovpn"
echo "---------------------- starting offline modified NAF"
cd ~/local-metaverse-tooling/networked-aframe/ && $(which node) server/easyrtc-server.js

16
spawn

@ -0,0 +1,16 @@
#!/bin/bash
export TOKEN=dop_v1_...
# see https://cloud.digitalocean.com/account/api/tokens
# this is an example, you MUST adjust to YOUR values
curl -X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer '$TOKEN'' \
-d '{"name":"metaversevpn-debian-s-1vcpu-1gb-fra1-01",
"size":"s-1vcpu-1gb",
"region":"fra1",
"image":"debian-11-x64",
"ssh_keys":[ "'"$(ssh-keygen -l -E md5 -f ~/.ssh/id_rsa_corsair_linux.pub | awk '{print $2}'| sed 's|MD5:||')"'" ],
"user_data": "'"$(cat cloudinit)"'",
"vpc_uuid":"072c13c7-da6d-4347-b40c-603821d1a8a2"}' \
"https://api.digitalocean.com/v2/droplets"
Loading…
Cancel
Save