1
0
mirror of https://github.com/Nyr/openvpn-install.git synced 2024-11-23 21:46:08 +03:00

TCP support

Also, my English sucks.
This commit is contained in:
Nyr 2017-01-04 03:41:47 +01:00
parent c6880407dd
commit 0e4bba792b

View File

@ -181,10 +181,15 @@ else
echo "listening to." echo "listening to."
read -p "IP address: " -e -i $IP IP read -p "IP address: " -e -i $IP IP
echo "" echo ""
echo "What port do you want for OpenVPN?" echo "Which protocol do you want for OpenVPN connections?"
echo " 1) UDP (recommended)"
echo " 2) TCP"
read -p "Protocol [1-2]: " -e -i 1 PROTOCOL
echo ""
echo "What port do you want OpenVPN listening to?"
read -p "Port: " -e -i 1194 PORT read -p "Port: " -e -i 1194 PORT
echo "" echo ""
echo "What DNS do you want to use with the VPN?" echo "Which DNS do you want to use with the VPN?"
echo " 1) Current system resolvers" echo " 1) Current system resolvers"
echo " 2) Google" echo " 2) Google"
echo " 3) OpenDNS" echo " 3) OpenDNS"
@ -233,9 +238,16 @@ else
# Generate key for tls-auth # Generate key for tls-auth
openvpn --genkey --secret /etc/openvpn/ta.key openvpn --genkey --secret /etc/openvpn/ta.key
# Generate server.conf # Generate server.conf
echo "port $PORT echo "port $PORT" > /etc/openvpn/server.conf
proto udp case $PROTOCOL in
dev tun 1)
echo "proto udp" >> /etc/openvpn/server.conf
;;
2)
echo "proto tcp" >> /etc/openvpn/server.conf
;;
esac
echo "dev tun
sndbuf 0 sndbuf 0
rcvbuf 0 rcvbuf 0
ca ca.crt ca ca.crt
@ -245,7 +257,7 @@ dh dh.pem
tls-auth ta.key 0 tls-auth ta.key 0
topology subnet topology subnet
server 10.8.0.0 255.255.255.0 server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt" > /etc/openvpn/server.conf ifconfig-pool-persist ipp.txt" >> /etc/openvpn/server.conf
echo 'push "redirect-gateway def1 bypass-dhcp"' >> /etc/openvpn/server.conf echo 'push "redirect-gateway def1 bypass-dhcp"' >> /etc/openvpn/server.conf
# DNS # DNS
case $DNS in case $DNS in
@ -359,9 +371,16 @@ crl-verify crl.pem" >> /etc/openvpn/server.conf
fi fi
# client-common.txt is created so we have a template to add further users later # client-common.txt is created so we have a template to add further users later
echo "client echo "client
dev tun dev tun" > /etc/openvpn/client-common.txt
proto udp case $PROTOCOL in
sndbuf 0 1)
echo "proto udp" >> /etc/openvpn/client-common.txt
;;
2)
echo "proto tcp" >> /etc/openvpn/client-common.txt
;;
esac
echo "sndbuf 0
rcvbuf 0 rcvbuf 0
remote $IP $PORT remote $IP $PORT
resolv-retry infinite resolv-retry infinite
@ -373,7 +392,7 @@ cipher AES-256-CBC
comp-lzo comp-lzo
setenv opt block-outside-dns setenv opt block-outside-dns
key-direction 1 key-direction 1
verb 3" > /etc/openvpn/client-common.txt verb 3" >> /etc/openvpn/client-common.txt
# Generates the custom client.ovpn # Generates the custom client.ovpn
newclient "$CLIENT" newclient "$CLIENT"
echo "" echo ""