From 958281204175d7315ac3a62b0b6eb0656864e0ca Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 23 Aug 2023 13:48:09 -0400 Subject: [PATCH] RPC Server logs the client IP on failed auth this patch adds an error log for the client IP of who connects to the rpc server without proper auth key. --- aprsd/rpc/server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aprsd/rpc/server.py b/aprsd/rpc/server.py index 2e053f9..37803e2 100644 --- a/aprsd/rpc/server.py +++ b/aprsd/rpc/server.py @@ -16,8 +16,13 @@ LOG = logging.getLogger("APRSD") def magic_word_authenticator(sock): + client_ip = sock.getpeername()[0] magic = sock.recv(len(CONF.rpc_settings.magic_word)).decode() if magic != CONF.rpc_settings.magic_word: + LOG.error( + f"wrong magic word passed from {client_ip} " + "'{magic}' != '{CONF.rpc_settings.magic_word}'", + ) raise AuthenticationError( f"wrong magic word passed in '{magic}'" f" != '{CONF.rpc_settings.magic_word}'",