2018-11-26 08:21:49 +00:00
#!/bin/bash
2019-01-25 20:34:27 +00:00
sudo apt update
2019-02-07 15:51:10 +00:00
sudo apt install -y python3-pip npm openvpn easy-rsa postfix rabbitmq-server bridge-utils
2019-03-15 18:07:43 +00:00
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 django-macaddress
2019-01-26 09:11:58 +00:00
sudo useradd vpn
2019-01-17 19:09:26 +00:00
git submodule init
git submodule update
2019-01-25 20:34:27 +00:00
cd lib/jq/
2019-01-17 19:09:26 +00:00
npm run build
2019-01-25 20:34:27 +00:00
cd ../..
2019-02-01 09:09:35 +00:00
chmod +x manage.py
2019-01-26 09:11:58 +00:00
sudo make-cadir /etc/openvpn/ca
chmod +x misc/generate-key
sudo cp misc/generate-key /etc/openvpn/ca
mkdir images
2018-11-26 08:21:49 +00:00
./manage.py collectstatic
2019-01-09 18:46:03 +00:00
./manage.py migrate
2019-01-26 09:11:58 +00:00
sudo chown vpn.vpn . /etc/openvpn/ca -R
2019-02-01 16:57:57 +00:00
sudo cp misc/vpnmanager.service misc/celery.service /etc/systemd/system/
2019-01-31 18:43:53 +00:00
chmod +x misc/cron
sudo cp misc/cron /etc/cron.d/vpnmanager
2019-02-01 15:12:12 +00:00
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
2019-02-02 15:18:57 +00:00
openvpn --genkey --secret /etc/openvpn/ca/keys/ta.key
2019-02-01 15:12:51 +00:00
sudo chown vpn.vpn /etc/openvpn/client-configs -R
2019-02-07 19:14:22 +00:00
sudo mkdir /etc/openvpn/ccd
2019-02-07 16:11:45 +00:00
cp manager/hostname.dist.py manager/hostname.py
sudo chown vpn.vpn . -R
2018-11-26 08:21:49 +00:00
sudo systemctl daemon-reload
sudo systemctl enable vpnmanager
sudo systemctl start vpnmanager
2019-02-01 16:57:57 +00:00
sudo systemctl enable celery
sudo systemctl start celery
2019-02-07 19:15:28 +00:00
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/ and don't forget to set the hostname in manager/hostname.py and create necessary server certs and DH parameters"