From b71c67c78a0dbb0bf5e426c93e3dc41acf2a8f3e Mon Sep 17 00:00:00 2001 From: Orazio <orazioedoardo@users.noreply.github.com> Date: Tue, 6 Aug 2019 10:02:28 +0200 Subject: [PATCH] Recreate ovpn folder if deleted --- scripts/makeOVPN.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/makeOVPN.sh b/scripts/makeOVPN.sh index 7e88ad7..c945703 100755 --- a/scripts/makeOVPN.sh +++ b/scripts/makeOVPN.sh @@ -228,12 +228,12 @@ if [ ! -f "${CA}" ]; then fi echo "CA public Key found: $CA" -#Confirm the tls-auth ta key file exists +#Confirm the tls key file exists if [ ! -f "${TA}" ]; then - echo "[ERROR]: tls-auth Key not found: $TA" + echo "[ERROR]: tls Private Key not found: $TA" exit fi -echo "tls-auth Private Key found: $TA" +echo "tls Private Key found: $TA" #Ready to make a new .ovpn file { @@ -255,7 +255,7 @@ echo "tls-auth Private Key found: $TA" cat "private/${NAME}${KEY}" echo "</key>" - #Finally, append the TA Private Key + #Finally, append the tls Private Key if [ -f /etc/pivpn/TWO_POINT_FOUR ]; then echo "<tls-crypt>" cat "${TA}" @@ -268,6 +268,11 @@ echo "tls-auth Private Key found: $TA" } > "${NAME}${FILEEXT}" +if [ ! -d "/home/$INSTALL_USER/ovpns" ]; then + mkdir "/home/$INSTALL_USER/ovpns" + chmod 0777 -R "/home/$INSTALL_USER/ovpns" +fi + # Copy the .ovpn profile to the home directory for convenient remote access cp "/etc/openvpn/easy-rsa/pki/$NAME$FILEEXT" "/home/$INSTALL_USER/ovpns/$NAME$FILEEXT" chown "$INSTALL_USER" "/home/$INSTALL_USER/ovpns/$NAME$FILEEXT"