mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-25 05:38:18 +00:00
abb2372550
Problem scenario: you have defined an automation rule with the unanchored regex `detected an unusual rate` that triggers a suspension. What happens: when the remote host initially responds and that rule matches, a suspension will be created. When subsequent messages are checked against that rule, the message will not be attempted (good), but we will generate and log a transient failure response of the form: `KumoMTA internal: suspended, rule: detected an unusual rate`. When that response is presented to TSA, since the regex is unanchored, the original rule will also match it, and that will cause the duration to be reset, effectively perpetuating the suspension until the combination of ingress and the retry window exceeds the duration specified in the rule (bad). You can explicity mark up your regex with an anchor to prevent this sort of matching, but it is a PITA to do that for every suspension rule. This commit resolves this issue by recognizing that the default should be to not match internally generated rules. The newly introduced `match_internal` boolean defaults to false and controls whether we should consider these internal messages, and allows the matching to be turned on when needed. We use this in one of the default shaping rules that is used to disable the use of tls for broken hosts.