From d19283c46ffe5333639a9fb6bf275326fc78102b Mon Sep 17 00:00:00 2001 From: Angristan Date: Thu, 25 Jan 2018 12:23:25 +0100 Subject: [PATCH] Optmize vars I'm not removing the PiVPN mention because I don't want to credit them, but to not bloat the script. Their contribution will be available via git blame + https://github.com/Angristan/OpenVPN-install/pull/151 :) --- openvpn-install.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 4553502..338a544 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -469,12 +469,9 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables.service chown -R root:root /etc/openvpn/easy-rsa/ rm -rf ~/EasyRSA-3.0.3.tgz cd /etc/openvpn/easy-rsa/ - # Generate a random, alphanumeric identifier of 16 characters for CN and one for server name => - ### => FROM https://github.com/pivpn/pivpn/blob/master/auto_install/install.sh ### - NEW_UUID_CN=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) - NEW_UUID_SERVER=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) - SERVER_CN="cn_$NEW_UUID_CN" - SERVER_NAME="server_$NEW_UUID_SERVER" + # Generate a random, alphanumeric identifier of 16 characters for CN and one for server name + SERVER_CN="cn_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)" + SERVER_NAME="server_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)" echo "set_var EASYRSA_KEY_SIZE $RSA_KEY_SIZE" > vars echo "set_var EASYRSA_REQ_CN $SERVER_CN" >> vars # Create the PKI, set up the CA, the DH params and the server + client certificates