-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_openvpn_ce_server.sh
52 lines (36 loc) · 1.4 KB
/
install_openvpn_ce_server.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
################ SERVER CONFIGURATION ##########################
user=$1
sudo apt-get update
sudo apt-get install openvpn easy-rsa -y
make-cadir /home/$user/openvpn-ca
cd /home/$user/openvpn-ca
rm vars
wget -c https://raw.githubusercontent.com/ahmddp/Misc/master/vars
source vars
./clean-all
./pkitool --initca
./pkitool client1
./pkitool --server vpnserver
./build-dh
openvpn --genkey --secret keys/ta.key
cd /home/$user/openvpn-ca/keys/
sudo cp ca.crt vpnserver.crt vpnserver.key ta.key dh2048.pem /etc/openvpn
cd /etc/openvpn
sudo wget -c https://raw.githubusercontent.com/ahmddp/Misc/master/vpnserver.conf
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
sudo apt install python-pip -y
sudo -H pip install backports.pbkdf2
sudo -H pip install adal
sudo -H pip install PyYAML
sudo wget -c https://raw.githubusercontent.com/ahmddp/openvpn-azure-ad-auth/master/openvpn-azure-ad-auth.py
sudo chmod +x openvpn-azure-ad-auth.py
sudo mkdir -p /home/$user/client-configs/files
sudo chmod 700 /home/$user/client-configs/files
cd /home/$user/client-configs
sudo wget -c https://raw.githubusercontent.com/ahmddp/Misc/master/base.conf
sudo wget -c https://raw.githubusercontent.com/ahmddp/Misc/master/make_config.sh
sudo chmod 700 /home/$user/client-configs/make_config.sh
sudo systemctl start openvpn@vpnserver