# info > ANVIL

---
type: CommandReference
command: anvil
mode: man
section: 8
source: man-pages
---

## Quick Reference

- `anvil` — Postfix session count and request rate control daemon
- Register a connect: `request=connect&ident=string` → returns `count` and `rate`
- Register a disconnect: `request=disconnect&ident=string` → returns `status=0`
- Register a message delivery: `request=message&ident=string` → returns `rate`
- Register a recipient: `request=recipient&ident=string` → returns `rate`
- Register a new TLS session: `request=newtls&ident=string` → returns `rate`
- Query TLS rate without updating: `request=newtls_report&ident=string` → returns `rate`
- Register an AUTH request: `request=auth&ident=string` → returns `rate`
- Configuration: `anvil_rate_time_unit` (default 60s), `anvil_status_update_time` (default 600s)

## Name

`anvil` — Postfix session count and request rate control

## Synopsis

`anvil [generic Postfix daemon options]`

## Description

The Postfix [anvil(8)](http://localhost/phpMan.php/man/anvil/8/markdown) server maintains statistics about client connection counts or client request rates. It defends against clients that hammer a server with too many simultaneous sessions or too many successive requests within a configurable time interval. It runs under the [master(8)](http://localhost/phpMan.php/man/master/8/markdown) server.

The `ident` parameter specifies a `(service, client)` combination; the exact syntax is application-dependent.

## Options

The following configuration parameters are relevant (see [postconf(5)](http://localhost/phpMan.php/man/postconf/5/markdown) for details):

- `anvil_rate_time_unit` (default: 60s) — Time unit over which client connection rates and other rates are calculated.
- `anvil_status_update_time` (default: 600s) — How frequently the server logs peak usage information.
- `config_directory` — Default location of Postfix configuration files.
- `daemon_timeout` (default: 18000s) — Time limit for a daemon process to handle a request before termination.
- `ipc_timeout` (default: 3600s) — Time limit for internal communication.
- `max_idle` (default: 100s) — Maximum idle time before voluntary termination.
- `max_use` (default: 100) — Maximum number of incoming connections before voluntary termination.
- `process_id` (read-only) — Process ID of the daemon.
- `process_name` (read-only) — Process name of the daemon.
- `syslog_facility` (default: mail) — Syslog facility.
- `syslog_name` — Prefix for process name in syslog records.
- `service_name` (Postfix 3.3+) — master.cf service name (read-only).

## Examples

The following examples show the request/response protocol used by other Postfix services to communicate with `anvil`.

### Connection count/rate control

To register a new connection:
text
request=connect
ident=string
Response:
text
status=0
count=number
rate=number
To register a disconnect:
text
request=disconnect
ident=string
Response:
text
status=0
### Message rate control

To register a message delivery:
text
request=message
ident=string
Response:
text
status=0
rate=number
### Recipient rate control

To register a recipient request:
text
request=recipient
ident=string
Response:
text
status=0
rate=number
### TLS session negotiation rate control

To register a new TLS session request:
text
request=newtls
ident=string
Response:
text
status=0
rate=number
To query TLS rate without updating counter:
text
request=newtls_report
ident=string
Response:
text
status=0
rate=number
### AUTH rate control

To register an AUTH request:
text
request=auth
ident=string
Response:
text
status=0
rate=number
## See Also

- [smtpd(8)](http://localhost/phpMan.php/man/smtpd/8/markdown) — Postfix SMTP server
- [postconf(5)](http://localhost/phpMan.php/man/postconf/5/markdown) — configuration parameters
- [master(5)](http://localhost/phpMan.php/man/master/5/markdown) — generic daemon options
- [master(8)](http://localhost/phpMan.php/man/master/8/markdown) — Postfix master daemon
- [syslogd(8)](http://localhost/phpMan.php/man/syslogd/8/markdown), [postlogd(8)](http://localhost/phpMan.php/man/postlogd/8/markdown) — logging daemons
- TUNING_README — performance tuning (use `postconf readme_directory` or `postconf html_directory`)

## Exit Codes

Not documented.