From: Vsevolod Stakhov Date: Fri, 24 Jul 2026 15:27:56 +0000 (+0100) Subject: [Fix] fuzzy_check: log rule and server for error replies X-Git-Tag: 4.1.3~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8a53d0495cfa1dfcab84a8695954278121af843;p=thirdparty%2Frspamd.git [Fix] fuzzy_check: log rule and server for error replies 403 (rate limit), 503 (access denied) and 415 (encryption required) replies used to insert their symbols silently; with several rules configured there was no way to tell from the logs which rule and which server produced the error. Log an info message with the rule name and the upstream in both the UDP and TCP reply paths. --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 20743b189d..9175623b4a 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -115,9 +115,9 @@ struct fuzzy_rule { gboolean skip_unknown; gboolean no_share; gboolean no_subject; - gboolean html_shingles; /* Enable HTML fuzzy hashing */ - gboolean text_hashes; /* Enable/disable generation of text hashes */ - unsigned int min_html_tags; /* Minimum tags for HTML hash */ + gboolean html_shingles; /* Enable HTML fuzzy hashing */ + gboolean text_hashes; /* Enable/disable generation of text hashes */ + unsigned int min_html_tags; /* Minimum tags for HTML hash */ gboolean html_ignore_domains; /* Ignore link domains in HTML structural tokens */ int learn_condition_cb; uint32_t retransmits; @@ -1554,14 +1554,24 @@ fuzzy_tcp_process_reply(struct fuzzy_tcp_connection *conn, } else if (rep->v1.value == 403) { /* In fact, it should be 429, but we preserve compatibility */ + msg_info_task("fuzzy rule %s: rate limit reached on %s", + rule->name, + rspamd_upstream_name(conn->server)); rspamd_task_insert_result(task, RSPAMD_FUZZY_SYMBOL_RATELIMITED, 1.0, rule->name); } else if (rep->v1.value == 503) { + msg_info_task("fuzzy rule %s: access denied by %s", + rule->name, + rspamd_upstream_name(conn->server)); rspamd_task_insert_result(task, RSPAMD_FUZZY_SYMBOL_FORBIDDEN, 1.0, rule->name); } else if (rep->v1.value == 415) { + msg_info_task("fuzzy rule %s: encryption is required by %s; " + "add encryption_key option to the rule", + rule->name, + rspamd_upstream_name(conn->server)); rspamd_task_insert_result(task, RSPAMD_FUZZY_SYMBOL_ENCRYPTION_REQUIRED, 1.0, rule->name); } @@ -4730,14 +4740,24 @@ fuzzy_check_try_read(struct fuzzy_client_session *session) } else if (rep->v1.value == 403) { /* In fact, it should be 429, but we preserve compatibility */ + msg_info_task("fuzzy rule %s: rate limit reached on %s", + session->rule->name, + rspamd_upstream_name(session->server)); rspamd_task_insert_result(task, RSPAMD_FUZZY_SYMBOL_RATELIMITED, 1.0, session->rule->name); } else if (rep->v1.value == 503) { + msg_info_task("fuzzy rule %s: access denied by %s", + session->rule->name, + rspamd_upstream_name(session->server)); rspamd_task_insert_result(task, RSPAMD_FUZZY_SYMBOL_FORBIDDEN, 1.0, session->rule->name); } else if (rep->v1.value == 415) { + msg_info_task("fuzzy rule %s: encryption is required by %s; " + "add encryption_key option to the rule", + session->rule->name, + rspamd_upstream_name(session->server)); rspamd_task_insert_result(task, RSPAMD_FUZZY_SYMBOL_ENCRYPTION_REQUIRED, 1.0, session->rule->name); }