Auth mechanism not supported (smtp.auth-mechanism-not-supported) does not result in banning

Issue Description

Excessive failed SMTP authentication attempts (smtp.auth-mechanism-not-supported) does not result in banning the remote IP.

Expected Behavior

The remote IP attempting this should be banned using the existing Authentication failure ban.

Actual Behavior

Remote IP is not banned and continues attempts.

Reproduction Steps

Unable to reproduce as the log does not show which authentication method is attempted.

Relevant Log Output

2026-10-18T20:14:34Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 52354, domain = “User”
2026-10-18T20:14:34Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 52354
2026-10-18T20:14:41Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 54734, domain = “User”
2026-10-18T20:14:41Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 54734
2026-10-18T20:14:52Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 57436, domain = “User”
2026-10-18T20:14:52Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 57436
2026-10-18T20:14:58Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 51288, domain = “User”
2026-10-18T20:14:58Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 51288
2026-10-18T20:15:04Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 50226, domain = “User”
2026-10-18T20:15:04Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 50226
2026-10-18T20:15:09Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 59820, domain = “User”
2026-10-18T20:15:10Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 59820
2026-10-18T20:15:15Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 50199, domain = “User”
2026-10-18T20:15:15Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 50199
2026-10-18T20:15:20Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 55765, domain = “User”
2026-10-18T20:15:20Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 55765
2026-10-18T20:15:26Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 64371, domain = “User”
2026-10-18T20:15:26Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 64371
2026-10-18T20:15:32Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 63641, domain = “User”
2026-10-18T20:15:32Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 63641
2026-10-18T20:15:42Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 64175, domain = “User”
2026-10-18T20:15:42Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 64175
2026-10-18T20:15:48Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 53073, domain = “User”
2026-10-18T20:15:48Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 53073
2026-10-18T20:15:54Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 64767, domain = “User”
2026-10-18T20:15:54Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 64767
2026-10-18T20:15:59Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 53054, domain = “User”
2026-10-18T20:15:59Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 53054
2026-10-18T20:16:11Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 51397, domain = “User”
2026-10-18T20:16:12Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 51397
2026-10-18T20:16:18Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 55880, domain = “User”
2026-10-18T20:16:18Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 55880
2026-10-18T20:16:24Z INFO SMTP EHLO command (smtp.ehlo) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 52367, domain = “User”
2026-10-18T20:16:24Z INFO Auth mechanism not supported (smtp.auth-mechanism-not-supported) listenerId = “submission”, localPort = 587, remoteIp = 31.70.76.30, remotePort = 52367

Stalwart Version

v0.16.x

Installation Method

Binary (FreeBSD)

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Confirmed in the source: AuthMechanismNotSupported is handled separately from normal authentication failures and never goes through the fail2ban counter.

In crates/smtp/src/inbound/session.rs, when the client requests an AUTH mechanism that isn’t offered, the server just logs smtp.auth-mechanism-not-supported and replies 554 5.7.8 directly — it never calls self.server.authenticate(). The authentication-ban logic lives inside Server::authenticate() (crates/common/src/auth/authentication.rs), which only increments the fail2ban counter when the error is auth.failed or security.ip-unauthorized. Since this rejection happens before any credentials are even submitted, it never reaches that code path, so it is not counted toward authBanRate and the IP is never banned by the authentication-failure category.

This matches what the auto-ban docs describe: only genuine authentication failures (auth.failed) across services feed the shared authBanRate counter. Repeated AUTH attempts with an unsupported mechanism currently fall outside that counter, which is why you’re seeing the behavior in your logs. This looks like a gap worth a human follow-up to confirm whether it should be folded into the auth-failure ban category.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

That client never gets as far as a password. It asks for a mechanism the listener doesn’t offer (on 587 that means anything outside PLAIN, LOGIN, OAUTHBEARER and XOAUTH2, so probably CRAM-MD5 or NTLM), Stalwart answers 554 before reading any credentials, and the auth ban only counts failed sign-ins (Auto-banning | Stalwart). The scan ban doesn’t catch it either, since AUTH with an unknown mechanism is still a well-formed command.

Block 31.70.76.30 by hand (your other topic covers why that needed a reload), or add an inbound throttle keyed on remoteIp for port 587 so a client opening a new session every few seconds gets slowed down. Counting repeated unsupported-mechanism attempts toward the ban is a reasonable request, and I’ve noted it.