fix(server): ignore datagrams that are not named HTB/PLG messages

A scanner's SIP INVITE on the public UDP port was parsed as a message without
a name and signed on a host called "unknown". Non-client datagrams are still
journaled but no longer create hosts or get an ACK.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 04:46:40 -04:00
co-authored by Claude Sonnet 5.5
parent 3e2d343fe7
commit 952adb68f8
2 changed files with 47 additions and 1 deletions
+7 -1
View File
@@ -422,6 +422,12 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
except Exception as e:
logger.debug(f"Failed to log message to journal: {e}")
# Only named HTB/PLG datagrams come from clients; anything else (e.g. an internet scanner's
# SIP probe) is journaled above but must not sign on a host.
if msg.get("ID") not in ("HTB", "PLG") or not msg.get("name"):
logger.debug("Ignoring non-client datagram from %s", addr)
return
cfg = ctx.get("config", {})
hbdcls = ctx.get("hbdclass")
msg_to_websockets = ctx.get("msg_to_websockets")
@@ -430,7 +436,7 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
# normalize addr (ip, port)
ip = addr[0] if isinstance(addr, (list, tuple)) else addr
name = msg.get("name", "unknown")
name = msg["name"]
from ..common.utils import shortname
from . import config as config_mod