ANVIL(8postfix)
π ANVIL π
okay bestie, sit down, because we're talking about anvil β the Postfix session count and request rate control daemon, from the 8postfix manual. she's a background girlie but she's everything. π
β¨ NAME β¨
anvil β Postfix session count and request rate control πΈ
π¦ SYNOPSIS π¦
anvil [generic Postfix daemon options]
π DESCRIPTION π
The Postfix anvil(8) server keeps statistics β about how many client connections are happening, or how fast clients are making requests. and likeβ¦ why do we care? because this info is literally how 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. no cap. π‘οΈβ¨
This server is designed to run under control by the Postfix master(8) server. she does not freelance, she does not do her own thing, she reports to master. periodt.
In the following text, ident specifies a (service, client) combination. the exact syntax of that information is application-dependent β the anvil(8) server genuinely does not care. she's not nosy like that. π
π₯ CONNECTION COUNT/RATE CONTROL π₯
To register a new connection, send the following request to the anvil(8) server:
request=connect
ident=string
The anvil(8) server answers with the number of simultaneous connections and the number of connections per unit time for the (service, client) combination specified with ident:
status=0
count=number
rate=number
To register a disconnect event, send the following request to the anvil(8) server:
request=disconnect
ident=string
The anvil(8) server replies with:
status=0
π MESSAGE RATE CONTROL π
To register a message delivery request, send the following request to the anvil(8) server:
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 the following request to the anvil(8) server:
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: the features in this section are available with Postfix 2.3 and later. π«
To register a request for a new (i.e. not cached) TLS session, send the following request to the anvil(8) server:
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
To retrieve new TLS session request rate information without updating the counter information, send:
request=newtls_report
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
like, she'll read the rate to you but she will NOT touch the counter. consent matters. ππ
π AUTH RATE CONTROL π
To register an AUTH request, send the following request to the anvil(8) server:
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 or to local users, and can run chrooted at fixed low privilege. she's locked in her room, she's safe, she's unbothered. π§
The anvil(8) server maintains an in-memory table with information about recent clients requests. 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 a fact. π
Although the in-memory state is kept only temporarily, this may require a lot of memory on systems that handle connections from many remote clients. To reduce memory usage, reduce the time unit over which state is kept.
πΈ DIAGNOSTICS πΈ
Problems and transactions are logged to syslogd(8) or postlogd(8). π
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. In order to avoid unnecessary overhead, no measurements are done for activity that isn't concurrency limited or rate limited. she's efficient, she's not doing extra credit. β¨
π BUGS π
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. ngl that's a jumpscare for everyone involved.
In this preliminary implementation, a count (or rate) limited server process can have only one remote client at a time. If a server process reports multiple simultaneous clients, state is kept only for the last reported client. π
The anvil(8) server automatically discards client request information after it expires. To prevent the anvil(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. even if you think you don't need to. do it. π«Ά
β CONFIGURATION PARAMETERS β
On low-traffic mail systems, changes to main.cf are picked up automatically, because anvil(8) processes run for only a limited amount of time. On other mail systems, use the command postfix reload to speed up a change. πββοΈπ¨
The text below provides only a parameter summary. See postconf(5) for more details including examples.
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. periodt.
π¦ HISTORY π¦
The anvil service is available in Postfix 2.2 and later. she's an icon, she's a legend, and she's been here a minute. π
π 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!! π this one's from the ANVIL(8postfix) manual β that's the source and the version right there in the name, no cap β and it was dated on the footer as ANVIL(8postfix), which is very demure, very mindful of her to repeat. go forth and rate-limit responsibly. mwah π
β¨π
π¦ where this page comes from
- debian bookworm: postfix 3.7.11-0+deb12u1
- ubuntu jammy: postfix 3.6.4-1ubuntu1
- ubuntu jammy: postfix 3.6.4-1ubuntu1.4
- ubuntu noble: postfix 3.8.6-1build2
- ubuntu noble: postfix 3.8.6-1ubuntu0.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms