amavisd-milter(8)

πŸ’Œ amavisd-milter(8) β€” the sendmail milter for amavis, bestie edition

okay so picture this: it's amavisd-milter(8), a System Manager's Manual page, and it's about to become your new fav thing. sit down, grab a snack πŸ“


✨ NAME ✨

amavisd-milter β€” the sendmail milter for amavis. yes. that's the whole vibe. πŸŽ€


🌸 SYNOPSIS 🌸

amavisd-milter [-Bfhv] [-d debug-level] [-D delivery-care-of] [-m max-
conns] [-M max-wait] [-p pidfile] [-P] [-q backlog] [-s socket]
[-t timeout] [-S socket] [-T timeout] [-w directory]

like, that's it. that's the whole invocation. icons only πŸ’…


πŸ’– DESCRIPTION πŸ’–

So amavisd-milter is a sendmail milter β€” that's a mail filter, iykyk β€” built for amavis 2.4.3 and above and sendmail 8.13 and above. no cap.

The way that this slaps is: with amavisd-milter, you get the full amavis functionality, including:

  • adding spam and virus information header fields πŸ”₯
  • modifying the Subject ✏️
  • adding address extensions
  • removing certain recipients from delivery… while still delivering the same message to the rest 🫢

For more info you can literally just go visit the amavisd-milter website:

https://github.com/prehor/amavisd-milter

πŸ¦‹ OPTIONS πŸ¦‹

The options are as follows, bestie β€” every single one:

  • -B β€” uses the milter macro {daemon_name} as the policy bank name (peep POLICY BANKS below πŸ‘€).
  • -d debug-level β€” sets the debug level. the higher you go, the more detailed the debugging traces get. maximum is 9. go off πŸ”
  • -D delivery-care-of β€” sets the AM.PDP request attribute delivery_care_of to client (that's the default) or server.

When the client method is used, then amavisd-milter is the one responsible for forwarding the message to the recipients. this method does not allow personalized header or body modification. sorry girl πŸ’€

When the server method is used, then amavis is responsible for forwarding the message to the recipients and may personalize the headers and the body of the messages. heads up: the $forward_method variable in amavisd.conf must point to a place willing to accept the message without further checking in amavis. πŸ’œ

  • -f β€” run amavisd-milter in the foreground (i.e. do not daemonize). prints debugging messages to the terminal. main character energy, no backgrounding 🌈
  • -h β€” print the help page and exit. short & sweet πŸŽ€
  • -m max-conns β€” maximum concurrent amavis connections (default 0 = unlimited number of connections). it must be the same as the $max_servers variable in amavisd.conf. fr fr, they gotta match.
  • -M timeout β€” timeout for message processing in seconds (default 300 seconds = 5 minutes). must be less then the timeout for a response to the final . that terminates a message on the sending MTA. Sendmail uses default value 1 hour, postfix 10 minutes and qmail 20 minutes. recommended value is less than 10 minutes. ⏰

If you use other milters (especially time-consuming ones), the timeout must be sufficient to process the message in all milters. like, all of them. no skipping.

  • -p pidfile β€” use this pid file. πŸ—‚οΈ
  • -P β€” when the amavis fails, the message will be passed through unchecked. yes, that's a real thing, and yes, it's a vibe you should think carefully about πŸ™ˆ
  • -q backlog β€” sets the incoming socket backlog used by listen(2). if it is not set or set to zero, the operating system default is used.
  • -s socket β€” the communication socket between sendmail and amavisd-milter. the protocol spoken over this socket is MILTER (Mail FILTER). it must have the same value as the INPUT_MAIL_FILTER macro in sendmail.mc. ⭐

The socket must be in format proto:address:

  • {unix|local}:/path/to/file β€” a named pipe.
  • inet:port@{hostname|ip-address} β€” an IPV4 socket.
  • inet6:port@{hostname|ip-address} β€” an IPV6 socket.
  • -S socket β€” the communication socket between amavisd-milter and amavis. the protocol spoken over this socket is AM.PDP (AMavis Policy Delegation Protocol). it must have the same value as the $unix_socketname variable in amavisd.conf. πŸ’«

The socket must be in format proto:address:

  • {unix|local}:/path/to/file β€” a named pipe.
  • inet:port@{hostname|ip-address} β€” an IPV4 socket.
  • inet6:port@{hostname|ip-address} β€” an IPV6 socket.
  • -t timeout β€” sendmail connection timeout in seconds (default 600 = 10 minutes). it must have the same value as the INPUT_MAIL_FILTER macro in sendmail.mc and must be greater than or equal to the amavis connection timeout. πŸ”—

If you use other milters (especially time-consuming ones), the timeout must be sufficient to process the message in all milters. again. say it with me.

  • -T timeout β€” amavis connection timeout in seconds (default 600 = 10 minutes). must be sufficient to process the message in amavis. usually, it is a good idea to set them to the same value as the sendmail connection timeout. πŸ‘‘
  • -v β€” report the version number and exit. 🏷️
  • -w directory β€” set the working directory. πŸ“

πŸ‘‘ POLICY BANKS πŸ‘‘

If the option -B is enabled, amavisd-milter uses the value of the milter macro {daemon_name} as the name of the amavis policy bank. usually, this milter macro is set to the name of the MTA. cute, right?

When the remote client is authenticated, amavisd-milter uses the authentication information as the name of the amavis policy banks:

  • SMTP_AUTH β€” the remote client has been authenticated. βœ…
  • SMTP_AUTH_<MECH> β€” the remote client authentication mechanism.
  • SMTP_AUTH_<MECH>_<BITS> β€” the number of bits used for the key of the symmetric cipher when the authentication mechanism uses it. πŸ”

🧚 EXAMPLES 🧚

Configuring amavis

In the amavisd.conf file set protocol and amavis socket to:

$protocol = "AM.PDP";                      # Use AM.PDP protocol
$unix_socketname = "$MYHOME/amavisd.sock"; # Listen on Unix socket
### $inet_socket_port = 10024;             # Do not listen on TCP port

Then (re)start the amavisd daemon. πŸš€

Configuring Postfix

Add the following entries to Postfix main.cf*:

smtpd_milters = local:<AMAVISD_MILTER.SOCK>
milter_connect_macros = j {client_name} {daemon_name} v
milter_protocol = 6

Then (re)start the Postfix daemon. ✨

Configuring sendmail

Add the following entries to file sendmail.mc:

define(`confMILTER_MACROS_CONNECT',
  confMILTER_MACROS_CONNECT`, {client_resolve}')
define(`confMILTER_MACROS_ENVFROM',
  confMILTER_MACROS_ENVFROM`, r, b')
INPUT_MAIL_FILTER(`amavisd-milter',
  `S=local:<AMAVISD_MILTER.SOCK>, F=T, T=S:10m;R:10m;E:10m')

Then rebuild the sendmail.cf file, install it and (re)start the sendmail daemon. πŸ› οΈ

Running amavisd-milter

This examples assumes that amavis is running as user vscan. the actual name is shown in the $daemon_user variable in amavisd.conf. don't @ me, check your config πŸ’…

Limiting maximum concurrent connections to amavisd

To limit the maximum concurrent connections to amavis, run amavisd-milter with this options:

su - vscan -c "amavisd-milter -m 4"

Troubleshooting

For troubleshooting, run amavisd-milter in the foreground and set the debug level to the appropriate value:

su - vscan -c "amavisd-milter -f -d 4"

Debug levels are:

  • 1 β€” Not errors but unexpected states (connection abort etc).
  • 2 β€” Main states in message processing.
  • 3 β€” All amavisd-milter debug messages.
  • 4-9 β€” Milter communication debugging (set smfi_setdbg to 1-6). πŸ”

🌈 SEE ALSO 🌈


- ```text
https://www.ijs.si/software/amavisd/

---

# πŸ’œ AUTHORS πŸ’œ

This manual page was written by **Petr Rehor** and is based on **Jerzy Sakol** initial work. give them their flowers πŸ’

---

# 😭 BUGS 😭

Issues can be reported by using GitHub at:

https://github.com/prehor/amavisd-milter/issues


Full detailed information on how to report issues, please see the Contribution Guidelines at:

https://github.com/prehor/amavisd-milter/blob/master/CONTRIBUTING.md


Enhancements, requests and problem reports are welcome. 🫢 we want them, actually.

If you run into problems, first check the GitHub issues before creating a new one. it is very likely that someone has encountered the same problem and it has already been solved. (this is the way.)

---

> <rainbow>Version 1.7.2</rainbow> β€” and that's the whole page, bestie!! `amavisd-milter(8)` said what it said, slayed, and logged off. bye icon πŸ‘‹πŸ’–
πŸ“¦ where this page comes from