diff --git a/extras/ikev2setup.sh b/extras/ikev2setup.sh index 77247f5..0268800 100755 --- a/extras/ikev2setup.sh +++ b/extras/ikev2setup.sh @@ -601,7 +601,7 @@ check_config_password() { use_config_password=1 ;; *) - if grep -qs '^IKEV2_CONFIG_PASSWORD=.\+' "$CONFIG_FILE"; then + if grep -qs '^IKEV2_CONFIG_PASSWORD=.\+' "$CONF_FILE"; then use_config_password=1 fi ;; @@ -719,13 +719,13 @@ get_p12_password() { if [ "$use_config_password" = "0" ]; then create_p12_password else - p12_password=$(grep -s '^IKEV2_CONFIG_PASSWORD=.\+' "$CONFIG_FILE" | tail -n 1 | cut -f2- -d= | sed -e "s/^'//" -e "s/'$//") + p12_password=$(grep -s '^IKEV2_CONFIG_PASSWORD=.\+' "$CONF_FILE" | tail -n 1 | cut -f2- -d= | sed -e "s/^'//" -e "s/'$//") if [ -z "$p12_password" ]; then create_p12_password - if [ -n "$CONFIG_FILE" ] && [ -n "$CONFIG_DIR" ]; then - mkdir -p "$CONFIG_DIR" - printf '%s\n' "IKEV2_CONFIG_PASSWORD='$p12_password'" >> "$CONFIG_FILE" - chmod 600 "$CONFIG_FILE" + if [ -n "$CONF_FILE" ] && [ -n "$CONF_DIR" ]; then + mkdir -p "$CONF_DIR" + printf '%s\n' "IKEV2_CONFIG_PASSWORD='$p12_password'" >> "$CONF_FILE" + chmod 600 "$CONF_FILE" fi fi fi @@ -1291,8 +1291,8 @@ delete_certificates() { crlutil -D -d "$CERT_DB" -n "$CA_NAME" 2>/dev/null certutil -F -d "$CERT_DB" -n "$CA_NAME" certutil -D -d "$CERT_DB" -n "$CA_NAME" 2>/dev/null - if grep -qs '^IKEV2_CONFIG_PASSWORD=.\+' "$CONFIG_FILE"; then - sed -i '/IKEV2_CONFIG_PASSWORD=/d' "$CONFIG_FILE" + if grep -qs '^IKEV2_CONFIG_PASSWORD=.\+' "$CONF_FILE"; then + sed -i '/IKEV2_CONFIG_PASSWORD=/d' "$CONF_FILE" fi } @@ -1358,8 +1358,8 @@ ikev2setup() { CA_NAME="IKEv2 VPN CA" CERT_DB="sql:/etc/ipsec.d" - CONFIG_DIR="/etc/ipsec.d" - CONFIG_FILE="/etc/ipsec.d/.vpnconfig" + CONF_DIR="/etc/ipsec.d" + CONF_FILE="/etc/ipsec.d/.vpnconfig" IKEV2_CONF="/etc/ipsec.d/ikev2.conf" IPSEC_CONF="/etc/ipsec.conf"