diff --git a/easytls-client-connect.sh b/easytls-client-connect.sh index 7c2bd4f..442340b 100755 --- a/easytls-client-connect.sh +++ b/easytls-client-connect.sh @@ -179,7 +179,7 @@ conn_trac_connect () update_status "TLS-Crypt-V2 key added to conn-trac" fi unset file_data -} +} # => conn_trac_connect () # Update connection tacking - disconnect conn_trac_disconnect () @@ -187,7 +187,8 @@ conn_trac_disconnect () [ $ENABLE_CONN_TRAC ] || return 0 "${EASYTLS_SED}" -i "/^${tlskey_serial}\$/d" "${EASYTLS_CONN_TRAC}" update_status "TLS-Crypt-V2 key removed from conn-trac" -} + [ -s "${EASYTLS_CONN_TRAC}" ] || "${EASYTLS_RM}" -f "${EASYTLS_CONN_TRAC}" +} # => conn_trac_disconnect () # Initialise init () @@ -375,10 +376,12 @@ if [ -f "${TCV2KEY_SERIAL_FILE}" ] then tlskey_serial="$("${EASYTLS_CAT}" "${TCV2KEY_SERIAL_FILE}")" || \ die "Failed to set tlskey_serial" + update_status "Found tlskey-serial" "${EASYTLS_RM}" "${TCV2KEY_SERIAL_FILE}" else # Not using TLS-Crypt-V2 key tlskey_serial="00000000000000000000000000000000" + update_status "NO TLSKEY SERIAL" fi # easytls client metadata file diff --git a/easytls-client-disconnect.sh b/easytls-client-disconnect.sh index 2c3e0a9..759c546 100755 --- a/easytls-client-disconnect.sh +++ b/easytls-client-disconnect.sh @@ -167,7 +167,8 @@ conn_trac_disconnect () [ $ENABLE_CONN_TRAC ] || return 0 "${EASYTLS_SED}" -i "/^${tlskey_serial}\$/d" "${EASYTLS_CONN_TRAC}" update_status "TLS-Crypt-V2 key removed from conn-trac" -} + [ -s "${EASYTLS_CONN_TRAC}" ] || "${EASYTLS_RM}" -f "${EASYTLS_CONN_TRAC}" +} # => conn_trac_disconnect () # Initialise init () diff --git a/easytls-cryptv2-verify.sh b/easytls-cryptv2-verify.sh index 921968b..29a6705 100755 --- a/easytls-cryptv2-verify.sh +++ b/easytls-cryptv2-verify.sh @@ -442,7 +442,7 @@ conn_trac_connect () [ $ENABLE_CONN_TRAC ] || return 0 [ -f "${EASYTLS_CONN_TRAC}" ] && \ file_data="$("${EASYTLS_CAT}" "${EASYTLS_CONN_TRAC}")" - if "${EASYTLS_GREP}" "^${tlskey_serial}$" "${EASYTLS_CONN_TRAC}" + if "${EASYTLS_GREP}" -q "^${tlskey_serial}$" "${EASYTLS_CONN_TRAC}" then # Already connected don't add another update_status "TLS-key serial is already registered in conn-trac" @@ -454,7 +454,7 @@ conn_trac_connect () update_status "TLS-Crypt-V2 key added to conn-trac" fi unset file_data -} +} # => conn_trac_connect () # Initialise init () @@ -1018,9 +1018,10 @@ else die "Failed to create client_metadata_file" 89 update_status "Created client_metadata_file" - # Ugly generic_metadata_file hack + # Unfortunate generic_metadata_file hack if [ -f "${generic_metadata_file}" ] then + #die "Why This File - generic_metadata_file" "${EASYTLS_RM}" -f "${generic_metadata_file}" update_status "Deleted generic_metadata_file" "${EASYTLS_CP}" "${OPENVPN_METADATA_FILE}" "${generic_metadata_file}" || \ diff --git a/easytls-verify.sh b/easytls-verify.sh index d51087f..6626b90 100755 --- a/easytls-verify.sh +++ b/easytls-verify.sh @@ -189,7 +189,8 @@ conn_trac_disconnect () [ $ENABLE_CONN_TRAC ] || return 0 "${EASYTLS_SED}" -i "/^${tlskey_serial}\$/d" "${EASYTLS_CONN_TRAC}" update_status "TLS-Crypt-V2 key removed from conn-trac" -} + [ -s "${EASYTLS_CONN_TRAC}" ] || "${EASYTLS_RM}" -f "${EASYTLS_CONN_TRAC}" +} # => conn_trac_disconnect () # Create stage-1 file create_stage1_file ()