1
0
mirror of https://github.com/Nyr/openvpn-install.git synced 2024-11-24 05:56:08 +03:00

Adds --silent parameter which uses the default values for everything and a name of 'client'

This commit is contained in:
Claude Henchoz 2017-10-29 13:55:30 +01:00
parent 0397827abe
commit c137f57ab4

View File

@ -187,11 +187,14 @@ else
echo "" echo ""
echo "First I need to know the IPv4 address of the network interface you want OpenVPN" echo "First I need to know the IPv4 address of the network interface you want OpenVPN"
echo "listening to." echo "listening to."
if [ $1 != "--silent" ]; then
read -p "IP address: " -e -i $IP IP read -p "IP address: " -e -i $IP IP
fi
echo "" echo ""
echo "Which protocol do you want for OpenVPN connections?" echo "Which protocol do you want for OpenVPN connections?"
echo " 1) UDP (recommended)" echo " 1) UDP (recommended)"
echo " 2) TCP" echo " 2) TCP"
if [ $1 != "--silent" ]; then
read -p "Protocol [1-2]: " -e -i 1 PROTOCOL read -p "Protocol [1-2]: " -e -i 1 PROTOCOL
case $PROTOCOL in case $PROTOCOL in
1) 1)
@ -201,9 +204,16 @@ else
PROTOCOL=tcp PROTOCOL=tcp
;; ;;
esac esac
else
PROTOCOL=udp
fi
echo "" echo ""
echo "What port do you want OpenVPN listening to?" echo "What port do you want OpenVPN listening to?"
if [ $1 != "--silent" ]; then
read -p "Port: " -e -i 1194 PORT read -p "Port: " -e -i 1194 PORT
else
PORT=1194
fi
echo "" echo ""
echo "Which 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"
@ -212,14 +222,24 @@ else
echo " 4) NTT" echo " 4) NTT"
echo " 5) Hurricane Electric" echo " 5) Hurricane Electric"
echo " 6) Verisign" echo " 6) Verisign"
if [ $1 != "--silent" ]; then
read -p "DNS [1-6]: " -e -i 1 DNS read -p "DNS [1-6]: " -e -i 1 DNS
else
DNS=1
fi
echo "" echo ""
echo "Finally, tell me your name for the client certificate" echo "Finally, tell me your name for the client certificate"
echo "Please, use one word only, no special characters" echo "Please, use one word only, no special characters"
if [ $1 != "--silent" ]; then
read -p "Client name: " -e -i client CLIENT read -p "Client name: " -e -i client CLIENT
else
CLIENT=client
fi
echo "" echo ""
echo "Okay, that was all I needed. We are ready to setup your OpenVPN server now" echo "Okay, that was all I needed. We are ready to setup your OpenVPN server now"
if [ $1 != "--silent" ]; then
read -n1 -r -p "Press any key to continue..." read -n1 -r -p "Press any key to continue..."
fi
if [[ "$OS" = 'debian' ]]; then if [[ "$OS" = 'debian' ]]; then
apt-get update apt-get update
apt-get install openvpn iptables openssl ca-certificates -y apt-get install openvpn iptables openssl ca-certificates -y