From ce9b8dfffcfea8d825f27b203140fe2f14622c75 Mon Sep 17 00:00:00 2001 From: IcedComputer <31418197+IcedComputer@users.noreply.github.com> Date: Wed, 19 Jun 2019 15:48:46 -0700 Subject: [PATCH 1/6] Leverage the Hostname of the Server Historic versions leveraged a format of "server_$UUID" to name of the VPN server certificate for X509 verification. This seems very impersonal. The new code pulls the existing hostname of the machines and appends the 16 character UUID. The new format is $hostname_$UUID. Example: A machine named "Martian" with a UUID of 1234567890123456 would change from server_1234567890123456 to Martian_1234567890123456 --- auto_install/install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 59a3c3b..4cd6730 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -745,9 +745,12 @@ setCustomDomain() { } confOpenVPN() { - # Generate a random, alphanumeric identifier of 16 characters for this server so that we can use verify-x509-name later that is unique for this server installation. Source: Earthgecko (https://gist.github.com/earthgecko/3089509) + # Grab the existing Hostname + HOST_NAME=$(hostname) + # Generate a random, alphanumeric identifier of 16 characters for this server so that we can use verify-x509-name later that is unique for this server installation. Source: Earthgecko (https://gist.github.com/earthgecko/3089509) NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) - SERVER_NAME="server_${NEW_UUID}" + # Create a unique server name using the host name and UUID + SERVER_NAME="${HOST_NAME}_${NEW_UUID}" if [[ ${useUpdateVars} == false ]]; then # Ask user for desired level of encryption From 2e5a344c82ec6672f28ec314768eae0bd5afab4e Mon Sep 17 00:00:00 2001 From: IcedComputer <31418197+IcedComputer@users.noreply.github.com> Date: Thu, 20 Jun 2019 17:37:56 -0700 Subject: [PATCH 2/6] Fixed issue with grabbing hostname Per comments and recommendations, added the "-s" when grabbing the hostname. This will ensure uniform performance across various platforms. --- auto_install/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 4cd6730..dac2fea 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -746,7 +746,7 @@ setCustomDomain() { confOpenVPN() { # Grab the existing Hostname - HOST_NAME=$(hostname) + HOST_NAME=$(hostname -s) # Generate a random, alphanumeric identifier of 16 characters for this server so that we can use verify-x509-name later that is unique for this server installation. Source: Earthgecko (https://gist.github.com/earthgecko/3089509) NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) # Create a unique server name using the host name and UUID From 09c518408e9e702ae9e6b8b7f25a13a1526820a0 Mon Sep 17 00:00:00 2001 From: IcedComputer <31418197+IcedComputer@users.noreply.github.com> Date: Tue, 27 Aug 2019 12:50:34 -0700 Subject: [PATCH 3/6] Update install.sh --- auto_install/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index dac2fea..3a6c978 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -747,8 +747,8 @@ setCustomDomain() { confOpenVPN() { # Grab the existing Hostname HOST_NAME=$(hostname -s) - # Generate a random, alphanumeric identifier of 16 characters for this server so that we can use verify-x509-name later that is unique for this server installation. Source: Earthgecko (https://gist.github.com/earthgecko/3089509) - NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) + # Generate a random UUID for this server so that we can use verify-x509-name later that is unique for this server installation. + NEW_UUID=$uuidgen -r # Create a unique server name using the host name and UUID SERVER_NAME="${HOST_NAME}_${NEW_UUID}" From efb845365159c72970c6adc7b74ce19be88e1533 Mon Sep 17 00:00:00 2001 From: IcedComputer <31418197+IcedComputer@users.noreply.github.com> Date: Tue, 27 Aug 2019 12:54:59 -0700 Subject: [PATCH 4/6] Update install.sh added uuidgen dependency and changed method of server name generation. --- auto_install/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 3a6c978..c3b64c0 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -21,7 +21,7 @@ PKG_CACHE="/var/lib/apt/lists/" UPDATE_PKG_CACHE="${PKG_MANAGER} update" PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install" PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true" -PIVPN_DEPS=(openvpn git tar wget grep iptables-persistent dnsutils expect whiptail net-tools) +PIVPN_DEPS=(openvpn git tar wget grep iptables-persistent dnsutils expect whiptail net-tools uuidgen) ### ### pivpnGitUrl="https://github.com/pivpn/pivpn.git" From 64353e337b8ed4419e57b714f7feffe5fa472181 Mon Sep 17 00:00:00 2001 From: IcedComputer <31418197+IcedComputer@users.noreply.github.com> Date: Tue, 27 Aug 2019 15:20:00 -0700 Subject: [PATCH 5/6] Update install.sh --- auto_install/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 71bd0f3..5e4354b 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -21,7 +21,7 @@ PKG_CACHE="/var/lib/apt/lists/" UPDATE_PKG_CACHE="${PKG_MANAGER} update" PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install" PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true" -PIVPN_DEPS=(openvpn git tar wget grep iptables-persistent dnsutils expect whiptail net-tools grepcidr jq uuidgen) +PIVPN_DEPS=(openvpn git tar wget grep iptables-persistent dnsutils expect whiptail net-tools grepcidr jq) ### ### @@ -763,7 +763,7 @@ confOpenVPN() { # Grab the existing Hostname HOST_NAME=$(hostname -s) # Generate a random UUID for this server so that we can use verify-x509-name later that is unique for this server installation. - NEW_UUID=$uuidgen -r + $NEW_UUID=$( Date: Tue, 27 Aug 2019 15:46:56 -0700 Subject: [PATCH 6/6] Update install.sh --- auto_install/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 5e4354b..fd96ff0 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -763,8 +763,8 @@ confOpenVPN() { # Grab the existing Hostname HOST_NAME=$(hostname -s) # Generate a random UUID for this server so that we can use verify-x509-name later that is unique for this server installation. - $NEW_UUID=$(