ANVIL(8postfix)

πŸ“¦ version 3.8.6, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’… 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 the anvil(8) connection and rate limiting server logs peak usage information. πŸ“Š
  • config_directory (see 'postconf -d' output) β€” The default location of the Postfix main.cf and master.cf configuration 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) β€” The master.cf service name of a Postfix daemon process. 🧾

🫢 SEE ALSO 🫢


πŸ“š 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