mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-24 05:56:08 +03:00
Generation of client WITH password
You can now generate a new client with a password.
This commit is contained in:
parent
22adb31b2e
commit
fb573d281a
@ -67,11 +67,21 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
|||||||
case $option in
|
case $option in
|
||||||
1)
|
1)
|
||||||
echo
|
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 "Tell me a name for the client certificate."
|
||||||
echo "Please, use one word only, no special characters."
|
echo "Please, use one word only, no special characters."
|
||||||
read -p "Client name: " -e CLIENT
|
read -p "Client name: " -e CLIENT
|
||||||
cd /etc/openvpn/easy-rsa/
|
cd /etc/openvpn/easy-rsa/
|
||||||
|
if [ $PASSWORD == "n" ]
|
||||||
|
then
|
||||||
./easyrsa build-client-full $CLIENT nopass
|
./easyrsa build-client-full $CLIENT nopass
|
||||||
|
else
|
||||||
|
./easyrsa build-client-full $CLIENT
|
||||||
|
fi
|
||||||
# Generates the custom client.ovpn
|
# Generates the custom client.ovpn
|
||||||
newclient "$CLIENT"
|
newclient "$CLIENT"
|
||||||
echo
|
echo
|
||||||
@ -179,7 +189,7 @@ else
|
|||||||
# Autodetect IP address and pre-fill for the user
|
# 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)
|
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
|
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
|
if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then
|
||||||
echo
|
echo
|
||||||
echo "This server is behind NAT. What is the public IPv4 address or hostname?"
|
echo "This server is behind NAT. What is the public IPv4 address or hostname?"
|
||||||
|
Loading…
Reference in New Issue
Block a user