Amavis...dClient(3pm)

🌸 NAME 🌸

okay so bestie, welcome to Amavis...dClient(3pm) β€” that's the manual page, and the actual star of the show is Amavis::SpamControl::RspamdClient, which is an Amavis extension module to use Rspamd as a spam checker. That's the whole plot. πŸ’–


✨ DESCRIPTION ✨

The module goes in your Amavis @spam_scanners config and hands your spam-checking over to Rspamd. It's giving "I'll handle the vibes, you handle the mail". πŸ¦‹

Copyright (c) 2019 Ralph Seichter, partially based on the SpamdClient extension. Released under GNU General Public License; see the Amavis LICENSE file for details. πŸ“œ


πŸ’… Example configuration #1 (local Rspamd)

This one's for when Rspamd is literally right there on the same box as Amavis. It's a situationship, but a healthy one. πŸ‘‘

# Rspamd running on the same machine as Amavis. Default URL
# is http://127.0.0.1:11333/checkv2 , matching Rspamd's
# "normal" worker defaults.
@spam_scanners = ( [
    'Local Rspamd', 'Amavis::SpamControl::RspamdClient',

    # Adjust scores according to Rspamd's "required score"
    # setting (defaults to 15). Scores reported by Rspamd
    # will be multiplied with this factor. The following
    # adjusts Rspamd scores to SpamAssassin scores. While
    # this setting is technically optional, not adjusting
    # scores is prone to cause headaches.
    score_factor => $sa_tag2_level_deflt / 15.0,

    # MTA name is used to assess validity of existing
    # Authentication-Results headers, e.g. if DKIM/DMARC
    # validation has already happened.
    mta_name => 'mail.example.com',
] );
quick notes on the lore in there: the default URL is http://127.0.0.1:11333/checkv2, matching Rspamd's "normal" worker defaults. score_factor adjusts scores to Rspamd's "required score" setting (defaults to 15), Rspamd scores get multiplied by that factor, and the example tunes them to match SpamAssassin scores. It's technically optional but not adjusting scores is prone to cause headaches. 😭 And mta_name is used to assess validity of existing Authentication-Results headers, like if DKIM/DMARC validation already happened.

πŸŽ€ Example configuration #2 (remote Rspamd)

Now for the long-distance one β€” Rspamd living behind an HTTPS-capable proxy with basic authentication controlling access. Main character energy, remote edition. πŸ’…

# Rspamd running behind HTTPS-capable proxy using basic
# authentication to control access.
@spam_scanners = ( [
    'Remote Rspamd', 'Amavis::SpamControl::RspamdClient',
    url => 'https://rspamd-proxy.example.com/checkv2',

    # Response timeout in seconds. Default is 60, matching
    # Rspamd's standard config for the "normal" worker.
    timeout => 42,

    # SSL-options and -credentials passed to LWP::UserAgent,
    # see https://metacpan.org/pod/LWP::UserAgent . Default:
    # ssl_opts => { verify_hostname => 1 },
    credentials => {
        # The following <host>:<port> must match the 'url'
        # defined above or credentials won't be transmitted.
        netloc => 'rspamd-proxy.example.com:443',
        # Remote authentication realm
        realm => 'Rspamd restricted access',
        username => 'Marco',
        password => 'Polo',
    },

    # Don't scan messages remotely if the body size extends
    # the following limit (optional setting).
    mail_body_size_limit => 32 * 1024,

    score_factor => $sa_tag2_level_deflt / 15.0,
    mta_name => 'mail.example.com',
] );

The deets, in bullet form because we love structure: πŸ’–

  • url β€” the endpoint to hit. In this example: https://rspamd-proxy.example.com/checkv2.
  • timeout β€” response timeout in seconds. Default is 60, matching Rspamd's standard config for the "normal" worker.
  • ssl_opts and credentials β€” SSL-options and -credentials passed to LWP::UserAgent, see https://metacpan.org/pod/LWP::UserAgent. Default: ssl_opts => { verify_hostname => 1 }.
  • credentials sub-fields, because the details MATTER:
    • netloc β€” the <host>:<port> here must match the url defined above, or credentials won't be transmitted. fr fr, it will just silently not send them. In the example: rspamd-proxy.example.com:443.
    • realm β€” the remote authentication realm. In the example: Rspamd restricted access.
    • username β€” in the example: Marco.
    • password β€” in the example: Polo.
  • mail_body_size_limit β€” don't scan messages remotely if the body size extends this limit. Optional setting. In the example: 32 * 1024.
  • score_factor β€” same deal as config #1, here $sa_tag2_level_deflt / 15.0.
  • mta_name β€” same deal as config #1, here mail.example.com.

🧚 Requirements

On top of Amavis' core requirements, this extension needs these extra Perl modules. No skips. 🫢

  • JSON
  • HTTP::Message
  • LWP::UserAgent
  • LWP::Protocol::https
  • Net::SSLeay

Should your host OS not provide the necessary packages, these modules can be obtained via https://www.cpan.org. ✨


🌈 and that's the whole page, bestie. this was perl v5.40.1, dated 2026-02-02, from Amavis...dClient(3pm). slay, go filter some spam, periodt. πŸ‘‘πŸ’–
πŸ“¦ where this page comes from