1
0
mirror of https://github.com/Nyr/openvpn-install.git synced 2025-02-17 22:13:18 +03:00

This is beta. The script works for own dns input. However, it needs testing at least on the different distros.

This commit is contained in:
Richard Skumat 2016-02-28 15:42:30 +00:00
parent 471649fd54
commit 1a494cd70f
2 changed files with 59 additions and 10 deletions

View File

@ -193,12 +193,13 @@ else
echo " 4) NTT"
echo " 5) Hurricane Electric"
echo " 6) You specify the DNS server IP-s"
read -p "DNS [1-6]: " -e -i 1 DNS
if [[ "$DNS" = '6' ]]; then
read -p "Specify the DNS server IP-s. Space is the separator" -e -i 8.8.8.8 8.8.4.4 OWNDNS
else
echo ""
fi
read -p "DNS [1-6]: " -e -i 6 DNS
if [[ "$DNS" = '6' ]]; then
echo "Please leave a space between DNS IP entries"
read -e -p "Specify the DNS server IP-s. Space is the separator: " OWNDNS
else
echo ""
fi
echo "Finally, tell me your name for the client cert"
echo "Please, use one word only, no special characters"
read -p "Client name: " -e -i client CLIENT
@ -272,10 +273,10 @@ ifconfig-pool-persist ipp.txt" > /etc/openvpn/server.conf
echo 'push "dhcp-option DNS 74.82.42.42"' >> /etc/openvpn/server.conf
;;
6)
for var in $OWNDNS;
do
echo 'push "dhcp-option OWNDNS"' >> /etc/openvpn/server.conf;
done
for i in `echo $OWNDNS|tr " " "\n"`;
do
echo 'push "dhcp-option DNS '"$i"'"' >> ./server.conf
done
;;
esac
echo "keepalive 10 120

48
test Normal file
View File

@ -0,0 +1,48 @@
#!/bin/bash
echo "What DNS do you want to use with the VPN?"
echo " 1) Current system resolvers"
echo " 2) Google"
echo " 3) OpenDNS"
echo " 4) NTT"
echo " 5) Hurricane Electric"
echo " 6) You specify the DNS server IP-s"
read -p "DNS [1-6]: " -e -i 6 DNS
if [[ "$DNS" = '6' ]]; then
echo "Please leave a space between DNS IP entries"
read -e -p "Specify the DNS server IP-s. Space is the separator: " OWNDNS
else
echo ""
fi
# DNS
case $DNS in
1)
# Obtain the resolvers from resolv.conf and use them for OpenVPN
grep -v '#' /etc/resolv.conf | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read line; do
echo "push \"dhcp-option DNS $line\"" >> ./server.conf
done
;;
2)
echo 'push "dhcp-option DNS 8.8.8.8"' >> ./server.conf
echo 'push "dhcp-option DNS 8.8.4.4"' >> ./server.conf
;;
3)
echo 'push "dhcp-option DNS 208.67.222.222"' >> ./server.conf
echo 'push "dhcp-option DNS 208.67.220.220"' >> ./server.conf
;;
4)
echo 'push "dhcp-option DNS 129.250.35.250"' >> ./server.conf
echo 'push "dhcp-option DNS 129.250.35.251"' >> ./server.conf
;;
5)
echo 'push "dhcp-option DNS 74.82.42.42"' >> ./server.conf
;;
6)
for i in `echo $OWNDNS|tr " " "\n"`;
do
echo 'push "dhcp-option DNS '"$i"'"' >> ./server.conf
done
;;
esac
cat ./server.conf
rm -f ./server.conf