improved logging

This commit is contained in:
DJ2LS 2023-08-26 16:13:51 +02:00
parent b382d37f20
commit 9a9f636562
3 changed files with 9 additions and 2 deletions

View file

@ -921,8 +921,14 @@ class DATA:
# check if hmac signing enabled
if TNC.enable_hmac:
self.log.info(
"[TNC] [HMAC] Enabled",
)
# now check if we have valid hmac signature - returns salt or bool
salt_found = helpers.search_hmac_salt(self.dxcallsign, self.mycallsign, data_frame_crc, data_frame, token_iters=100)
self.log.info(
"[TNC] [HMAC] Salt found", salt=salt_found
)
if salt_found:
# hmac digest received
self.arq_process_received_data_frame(data_frame, snr, signed=True)

View file

@ -531,6 +531,7 @@ def get_hmac_salt(dxcallsign: bytes, mycallsign: bytes):
return False
def search_hmac_salt(dxcallsign: bytes, mycallsign: bytes, search_token, data_frame, token_iters):
filename = f"freedata_hmac_STATION_{dxcallsign.decode('utf-8')}_REMOTE_{mycallsign.decode('utf-8')}.txt"
if sys.platform == "linux":
@ -570,7 +571,7 @@ def search_hmac_salt(dxcallsign: bytes, mycallsign: bytes, search_token, data_fr
if search_token == search_digest:
token_position = len(token_list) - _
delete_last_line_from_hmac_list(filepath, token_position)
log.warning(
log.info(
"[TNC] [HMAC] Signature found", expected=search_token,
)
return True

View file

@ -129,7 +129,7 @@ class TCIParam:
@dataclass
class TNC:
version = "0.10.3-alpha.1-hmac-exp2"
version = "0.10.3-alpha.1-hmac-exp3"
host: str = "0.0.0.0"
port: int = 3000
SOCKET_TIMEOUT: int = 1 # seconds