mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-03-13 14:13:14 +01:00
Update openvpn-install.sh
This commit is contained in:
parent
423419de74
commit
ae6e832873
@ -703,12 +703,12 @@ function installOpenVPN() {
|
||||
esac
|
||||
|
||||
# Generate a random, alphanumeric identifier of 16 characters for CN and one for server name
|
||||
SERVER_CN="cn_$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
|
||||
echo "$SERVER_CN" >SERVER_CN_GENERATED
|
||||
SERVER_CON="con_$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
|
||||
echo "$SERVER_CON" >SERVER_CON_GENERATED
|
||||
SERVER_NAME="server_$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)"
|
||||
echo "$SERVER_NAME" >SERVER_NAME_GENERATED
|
||||
|
||||
echo "set_var EASYRSA_REQ_CN $SERVER_CN" >>vars
|
||||
echo "set_var EASYRSA_REQ_CON $SERVER_CON" >>vars
|
||||
|
||||
# Create the PKI, set up the CA, the DH params and the server certificate
|
||||
./easyrsa init-pki
|
||||
@ -1061,7 +1061,7 @@ function newClient() {
|
||||
read -rp "Select an option [1-2]: " -e -i 1 PASS
|
||||
done
|
||||
|
||||
CLIENTEXISTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c -E "/CN=$CLIENT\$")
|
||||
CLIENTEXISTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c -E "/CON=$CLIENT\$")
|
||||
if [[ $CLIENTEXISTS == '1' ]]; then
|
||||
echo ""
|
||||
echo "The specified client CN was already found in easy-rsa, please choose another name."
|
||||
|
Loading…
x
Reference in New Issue
Block a user