Fix: auto-revoke forged license passcodes and stop auth log flooding

A trial user's serial was alternating between the built-in trial
passcode (authorized) and a forged 50-year/1000-host passcode (rejected)
on every heartbeat. ShouldLogAuth keyed its throttle on the serial alone
and logged every status flip, so the rate limit was defeated and the
master log filled with alternating success/failure lines.

ShouldLogAuth now tracks the success and failure states independently
per serial and source IP: each logs on first sight and then at most once
per hour, with a bounded cache. Keying only by serial would collapse the
many normal trial users that share one serial into a single line.

AutoRevokeForgedAuth handles the offending connection itself. Integrity
failures (V1 codes 2/3, V2 code 4) are counted per connection context,
and three within 60 seconds send the same days=0 CMD_AUTHORIZATION as
the manual "revoke authorization" menu, with a 10-minute cooldown. It
acts only when the same serial also had a successful auth in the last
two minutes, which is the observed abuse pattern; a batch of failures
after a password rotation or a client pointed at another master has no
success event and is left alone. Expired and already-revoked licences
never trigger it. Without a configured super password it only warns.

Translations added. Debug x64 server builds; not runtime-tested.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-12-06 21:44:31 +01:00
1 parent e265527610
commit a32219f05c
5 files changed
+186 -20

No files matched your search

+2
View File
@@ -1576,6 +1576,8 @@ IP %s DLL
V1 授权失败: = V1-Autorisierung fehlgeschlagen:
V2 授权成功: = V2 autorisiert:
V2 授权失败: = V2-Autorisierung fehlgeschlagen:
使用伪造口令,已自动撤销授权=Gefaelschter Lizenzcode; Autorisierung automatisch widerrufen
检测到伪造口令,但未配置超管密码,无法自动撤销=Gefaelschter Lizenzcode erkannt, aber Super-Passwort ist nicht gesetzt; automatischer Widerruf nicht moeglich
监听端口和文件下载服务端口冲突!=Abhoerport steht im Konflikt mit dem Dateiserver-Port!