ANVIL(8)
π ANVIL(8) π
okay so bestie, you've stumbled into the System Manager's Manual, section 8, and the star of the show is anvil. sit down, grab a snack, we're doing this π
β¨ NAME β¨
anvil β Postfix session count and request rate control π
πΈ SYNOPSIS πΈ
anvil [generic Postfix daemon options]
π¦ DESCRIPTION π¦
okay so the Postfix anvil(8) server is basically the bouncer at the club πͺ it keeps statistics about client connection counts, or about client request rates. and why do we care? because that info is what lets you defend against clients that hammer a server β either with too many simultaneous sessions, or with too many successive requests inside a configurable time interval. rude behavior, honestly. not on our watch π
and listen, this server is designed to run under control by the Postfix master(8) server. it does not freelance. it does not go rogue. it has a manager and it respects them.
now, throughout this whole page, ident means a (service, client) combination. the exact syntax of that info is application-dependent β and here's the gag β the anvil(8) server literally does not care π it just passes it along like a good little relay. iconic.
π₯ CONNECTION COUNT/RATE CONTROL π₯
wanna register a new connection? send this to the anvil(8) server:
request=connect
ident=string
and the anvil(8) server hits you back with the number of simultaneous connections AND the number of connections per unit time for that (service, client) combo you specified with ident:
status=0
count=number
rate=number
now to register a disconnect event, send:
request=disconnect
ident=string
and the anvil(8) server replies with:
status=0
no notes. clean. periodt β¨
π MESSAGE RATE CONTROL π
to register a message delivery request, send this:
request=message
ident=string
the anvil(8) server answers with the number of message delivery requests per unit time for the (service, client) combination specified with ident:
status=0
rate=number
π RECIPIENT RATE CONTROL π
to register a recipient request, send:
request=recipient
ident=string
the anvil(8) server answers with the number of recipient addresses per unit time for the (service, client) combination specified with ident:
status=0
rate=number
π TLS SESSION NEGOTIATION RATE CONTROL π
heads up bestie: everything in this section is available with Postfix 2.3 and later. if you're on something older, this part is not for you, sorry π
to register a request for a new (i.e. not cached) TLS session, send:
request=newtls
ident=string
the anvil(8) server answers with the number of new TLS session requests per unit time for the (service, client) combination specified with ident:
status=0
rate=number
and now β and this is the good part β if you wanna retrieve new TLS session request rate info without updating the counter information, you send:
request=newtls_report
ident=string
and the anvil(8) server answers with the number of new TLS session requests per unit time for the (service, client) combination specified with ident:
status=0
rate=number
look at you, reading without writing. main character energy π
π AUTH RATE CONTROL π
to register an AUTH request, send:
request=auth
ident=string
the anvil(8) server answers with the number of auth requests per unit time for the (service, client) combination specified with ident:
status=0
rate=number
π SECURITY π
the anvil(8) server does not talk to the network and does not talk to local users, and it can run chrooted at fixed low privilege. it's giving "minding its own business" and honestly? we stan π«Ά
the anvil(8) server maintains an in-memory table with information about recent clients requests. and no, nothing gets written down permanently β no persistent state is kept, because standard system library routines are not sufficiently robust for update-intensive applications. that's not a vibe, that's just the truth.
β οΈ even though the in-memory state is kept only temporarily, this may require a lot of memory on systems that handle connections from many remote clients. so if your box is sweating π the move is: reduce the time unit over which state is kept. less time kept = less memory held. simple math, slay.
π©Ί DIAGNOSTICS π©Ί
problems and transactions get logged to syslogd(8) or postlogd(8). that's the diary, basically π
upon exit, and every anvil_status_update_time seconds, the server logs the maximal count and rate values measured, together with (service, client) information and the time of day associated with those events. receipts. timestamps. the whole package.
and to avoid unnecessary overhead, no measurements are done for activity that isn't concurrency limited or rate limited. efficiency queen. she does not do unpaid labor π
π BUGS π
okay so this is the part where we're honest. here we go:
- systems behind network address translating routers or proxies appear to have the same client address and can run into connection count and/or rate limits falsely. not their fault, but the damage is real π
- in this preliminary implementation, a count (or rate) limited server process can have only one remote client at a time. and if a server process reports multiple simultaneous clients, state is kept only for the last reported client. yeah. only the last one. the others get ghosted π
- the
anvil(8)server automatically discards client request information after it expires. and to stop theanvil(8)server from discarding client request rate information too early or too late, a rate limited service should always register connect/disconnect events even when it does not explicitly limit them. yes, even then. always. i said what i said π
βοΈ CONFIGURATION PARAMETERS βοΈ
on low-traffic mail systems, changes to main.cf get picked up automatically, because anvil(8) processes run for only a limited amount of time. on other mail systems, run the command postfix reload to speed up a change. faster. better. reloaded β¨
and just so we're clear: the text below is only a parameter summary. for more details, including examples, go read postconf(5). iykyk.
anvil_rate_time_unit(60s) β the time unit over which client connection rates and other rates are calculated.anvil_status_update_time(600s) β how frequently theanvil(8)connection and rate limiting server logs peak usage information.config_directory(see'postconf -d'output) β the default location of the Postfixmain.cfandmaster.cfconfiguration files.daemon_timeout(18000s) β how much time a Postfix daemon process may take to handle a request before it is terminated by a built-in watchdog timer.ipc_timeout(3600s) β the time limit for sending or receiving information over an internal communication channel.max_idle(100s) β the maximum amount of time that an idle Postfix daemon process waits for an incoming connection before terminating voluntarily.max_use(100) β the maximal number of incoming connections that a Postfix daemon process will service before terminating voluntarily.process_id(read-only) β the process ID of a Postfix command or daemon process.process_name(read-only) β the process name of a Postfix command or daemon process.syslog_facility(mail) β the syslog facility of Postfix logging.syslog_name(see'postconf -d'output) β a prefix that is prepended to the process name in syslog records, so that, for example,"smtpd"becomes"prefix/smtpd".
available in Postfix 3.3 and later:
service_name(read-only) β themaster.cfservice name of a Postfix daemon process.
π«Ά SEE ALSO π«Ά
smtpd(8), Postfix SMTP serverpostconf(5), configuration parametersmaster(5), generic daemon options
π README FILES π
use "postconf readme_directory" or "postconf html_directory" to locate this information.
TUNING_README, performance tuning
π LICENSE π
the Secure Mailer license must be distributed with this software. not optional. read it, bestie π
π°οΈ HISTORY π°οΈ
the anvil service is available in Postfix 2.2 and later. she's been around. she's seen things. she's still serving π
π AUTHOR(S) π
- Wietse Venema
- IBM T.J. Watson Research
- P.O. Box 704
- Yorktown Heights, NY 10598, USA
- Wietse Venema
- Google, Inc.
- 111 8th Avenue
- New York, NY 10011, USA
and that's the whole page, bestie π it's ANVIL(8) out of the System Manager's Manual β go forth, rate limit responsibly, and remember: no measurements are done for activity that isn't concurrency limited or rate limited β¨π¦πΈ
π¦ where this page comes from
- alpine 3.22: postfix-doc 3.10.13-r0 Β· IPL-1.0 EPL-2.0
- alpine 3.23: postfix-doc 3.10.13-r0 Β· IPL-1.0 EPL-2.0
- alpine 3.24: postfix-doc 3.11.7-r0 Β· IPL-1.0 EPL-2.0
- arch rolling: postfix 3.11.7-1 Β· EPL-2.0 OR IPL-1.0 AND BSD-4-Clause-UC
- centos-stream 10: postfix 2:3.8.5-11.el10 Β· (IPL-1.0 OR EPL-2.0) AND GPL-2.0-or-later AND BSD-4-Clause-UC
- centos-stream 9: postfix 2:3.5.25-3.el9 Β· (IBM and GPLv2+) or (EPL-2.0 and GPLv2+)
- debian trixie: postfix 3.10.13-0+deb13u1
- fedora 43: postfix 2:3.10.14-1.fc43 Β· (IPL-1.0 OR EPL-2.0) AND GPL-2.0-or-later AND BSD-4-Clause-UC
- fedora 43: postfix 2:3.10.3-3.fc43 Β· (IPL-1.0 OR EPL-2.0) AND GPL-2.0-or-later AND BSD-4-Clause-UC
- fedora 44: postfix 2:3.10.14-1.fc44 Β· (IPL-1.0 OR EPL-2.0) AND GPL-2.0-or-later AND BSD-4-Clause-UC
- fedora 44: postfix 2:3.10.7-2.fc44 Β· (IPL-1.0 OR EPL-2.0) AND GPL-2.0-or-later AND BSD-4-Clause-UC
- nixos 26.05: postfix 3.11.7
- nixpkgs unstable: postfix 3.11.7
- opensuse-leap 16.0: postfix 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- opensuse-leap 16.0: postfix 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- opensuse-leap 16.0: postfix 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- opensuse-leap 16.0: postfix 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- opensuse-leap 16.0: postfix-bdb 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- opensuse-leap 16.0: postfix-bdb 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- opensuse-leap 16.0: postfix-bdb 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- opensuse-leap 16.0: postfix-bdb 3.10.2-160000.3.1 Β· EPL-2.0 OR IPL-1.0
- ubuntu questing: postfix 3.10.2-1ubuntu2
- ubuntu questing: postfix 3.10.2-1ubuntu2.1
- ubuntu resolute: postfix 3.10.6-4ubuntu2
- ubuntu resolute: postfix 3.10.6-4ubuntu2.1
- ubuntu resolute: postfix 3.10.6-4ubuntu2.2
- ubuntu stonking: postfix 3.11.7-1ubuntu2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms