Scripts to make metaverse (as in social responsive VR-optional) work privately within a VPN
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vpn-metaverse-tooling/cloudinit

42 lines
1.8 KiB

2 years ago
#!/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