vpnmanager/setup.sh

33 lines
1.3 KiB
Bash

#!/bin/bash
sudo apt update
sudo apt install -y python3-pip npm openvpn easy-rsa postfix rabbitmq-server bridge-utils
sudo pip3 install -U django django-password-reset django-cron uwsgi celery django-celery-results django-two-factor-auth django-bootstrap-form twilio argon2_cffi GitPython
sudo useradd vpn
git submodule init
git submodule update
cd lib/jq/
npm run build
cd ../..
chmod +x manage.py
sudo make-cadir /etc/openvpn/ca
chmod +x misc/generate-key
sudo cp misc/generate-key /etc/openvpn/ca
mkdir images
./manage.py collectstatic
./manage.py migrate
sudo chown vpn.vpn . /etc/openvpn/ca -R
sudo cp misc/vpnmanager.service misc/celery.service /etc/systemd/system/
chmod +x misc/cron
sudo cp misc/cron /etc/cron.d/vpnmanager
sudo mkdir -p /etc/openvpn/client-configs/files
chmod +x misc/make_config
sudo cp misc/make_config misc/base.conf /etc/openvpn/client-configs
openvpn --genkey --secret /etc/openvpn/ca/keys/ta.key
sudo chown vpn.vpn /etc/openvpn/client-configs -R
sudo systemctl daemon-reload
sudo systemctl enable vpnmanager
sudo systemctl start vpnmanager
sudo systemctl enable celery
sudo systemctl start celery
echo "This should be working so far. Now point your webserver to uwsgi.sock using its WSGI options. Be sure to include the static files at static/static_root/"