Skip to content

Commit

Permalink
Merge pull request #5 from jasonkoon/master
Browse files Browse the repository at this point in the history
Ability to specify dns servers via vpn.env file.
  • Loading branch information
fcojean authored Jan 6, 2018
2 parents 3294ccb + 7bd46ba commit 3649eb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 13 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ if [ -z "$VPN_NETWORK_INTERFACE" ]; then
VPN_NETWORK_INTERFACE="eth0"
fi

if [ -z "$VPN_DNS1" ]; then
VPN_DNS1="8.8.8.8"
fi

if [ -z "$VPN_DNS2" ]; then
VPN_DNS2="8.8.4.4"
fi

if [ `cat /sys/class/net/$VPN_NETWORK_INTERFACE/operstate` == "down" ]; then
echo "Network interface '$VPN_NETWORK_INTERFACE' is not available. Aborting."
exit 1
Expand Down Expand Up @@ -109,8 +117,8 @@ conn xauth-psk
auto=add
leftsubnet=0.0.0.0/0
rightaddresspool=192.168.43.10-192.168.43.250
modecfgdns1=8.8.8.8
modecfgdns2=8.8.4.4
modecfgdns1=$VPN_DNS1
modecfgdns2=$VPN_DNS2
leftxauthserver=yes
rightxauthclient=yes
leftmodecfgserver=yes
Expand Down Expand Up @@ -148,8 +156,8 @@ EOF
cat > /etc/ppp/options.xl2tpd <<EOF
ipcp-accept-local
ipcp-accept-remote
ms-dns 8.8.8.8
ms-dns 8.8.4.4
ms-dns $VPN_DNS1
ms-dns $VPN_DNS2
noccp
auth
crtscts
Expand Down Expand Up @@ -230,6 +238,7 @@ IPsec VPN server is now ready for use!
Connect to your new VPN with these details:
DNS: $VPN_DNS1
Server IP: $PUBLIC_IP
IPsec PSK: $VPN_IPSEC_PSK
Users credentials :
Expand Down
2 changes: 2 additions & 0 deletions vpn.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ VPN_IPSEC_PSK=test_shared_secret_key
# Table of user object with login and password attribute in Json format
VPN_USER_CREDENTIAL_LIST=[{"login":"userTest1","password":"test1"},{"login":"userTest2","password":"test2"}]
VPN_NETWORK_INTERFACE=eth0
#VPN_DNS1=192.168.0.1
#VPN_DNS2=192.168.0.1

0 comments on commit 3649eb4

Please sign in to comment.