1
0
mirror of https://github.com/Nyr/openvpn-install.git synced 2024-11-27 15:36:07 +03:00

Generation of client WITH password

You can now generate a new client with a password.
This commit is contained in:
Thomas 2018-09-17 16:14:51 +02:00 committed by GitHub
parent 22adb31b2e
commit fb573d281a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,11 +67,21 @@ if [[ -e /etc/openvpn/server.conf ]]; then
case $option in
1)
echo
read -p "Do you want create user with password ? (y/n)" -e PASSWORD
while [[ $PASSWORD != "y" && $PASSWORD != "n" ]]
do
read -p "Please type only y or n (For Yes or No) : " -e PASSWORD
done
echo "Tell me a name for the client certificate."
echo "Please, use one word only, no special characters."
read -p "Client name: " -e CLIENT
cd /etc/openvpn/easy-rsa/
./easyrsa build-client-full $CLIENT nopass
if [ $PASSWORD == "n" ]
then
./easyrsa build-client-full $CLIENT nopass
else
./easyrsa build-client-full $CLIENT
fi
# Generates the custom client.ovpn
newclient "$CLIENT"
echo
@ -179,7 +189,7 @@ else
# Autodetect IP address and pre-fill for the user
IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
read -p "IP address: " -e -i $IP IP
# If $IP is a private IP address, the server must be behind NAT
# If $IP is a private IP address, the server must be behind NAT
if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then
echo
echo "This server is behind NAT. What is the public IPv4 address or hostname?"