Kevin A. McGrail > Mail-SpamAssassin > Mail::SpamAssassin::Spamd::Apache2::Config



Annotate this POD


View/Report Bugs


Mail::SpamAssassin::Spamd::Apache2::Config -- configure Apache with SpamAssassin


 LoadModule     perl_module     modules/
 PerlLoadModule Mail::SpamAssassin::Spamd::Apache2::Config
 SAEnabled      On      # default off

 SAAllow from ::1
 SAIdent        Off
 SATell         Off
 SATimeout      300     # reasonable: around 30s
 SADebug        info
 SAMsgSizeLimit 512000


Provides Apache config directives for configuring spamd. Initializes the Mail::SpamAssassin object.

Note, that the defaults here apply to *this* code; sets different ones to be compatible with spamd(1).


SAEnabled { On | Off }

Enables / disables SA for given vhost. Adds two handlers:

 SetHandler modperl
 PerlProcessConnectionHandler Mail::SpamAssassin::Spamd::Apache2
 PerlPreConnectionHandler     Mail::SpamAssassin::Spamd::Apache2::AclIP

Defaults to Off.

SAAllow from 192.168/16 ::1 ...

Similar to Allow from ... directive from mod_authz_vhost. Spamd's --allowed-ips arguments should go here.

Default is empty, meaning access is denied.

SAIdent { On | Off }

Enables RFC 1413 (ident) checks incoming connections. Note, that checking if a *remote* login matches a *local* one is usually pointless. See Mail::SpamAssassin::Apache2::AclRFC1413(3) for more details.

Adds a handler:

 PerlPreConnectionHandler     Mail::SpamAssassin::Spamd::Apache2::AclRFC1413

Requires IdentityCheck on in current configuration scope. This directive is provided by the mod_ident module, separated from core in Apache 2.1.

Default off.

SATell { On | Off }

Allow clients to issue the TELL command. Default off.

SATimeout 300

Timeout for SpamAssassin checks. 25 seconds is a reasonable value.

Default 0 (unlimited).

SADebug debug_level

Debug level for SpamAssassin.

SAMsgSizeLimit 512000

Maximum message size which will be processed. You're strongly encouraged to set this value. Unit: bytes.

SANew key "value"

Additional arguments to Mail::SpamAssassin-new()>. Refer to Mail::SpamAssassin(3).

SAUsers { none | local | sql | ldap }

Databases which should be checked for user information. Will be checked in the order specified.

Default none.

SALocale xx_XX

Value of the LANG environment variable SpamAssassin should run with.

Default none, unless you set Apache otherwise somehow.

SAConfigLine "config line"

Equivalent of the --cf option for spamassassin / spamd / sa-learn.


You'll need some basic Apache directives in each configuration; that should be obvious.

  PidFile "/var/run/"
  ServerName localhost
  TimeOut 30

  StartServers 1
  MinSpareServers 1
  MaxSpareServers 2
  MaxClients 5
  MaxRequestsPerChild 200

If the Mail::SpamAssassin::* perl modules are installed somewhere outside of @INC, you can use something like:

  PerlSwitches -I/home/users/someuser/lib


  LoadModule perl_module /usr/lib/apache/
  PerlLoadModule Mail::SpamAssassin::Spamd::Apache2::Config
  SAenabled on
  SAAllow from
  SAtimeout 25
  SAdebug info
  SANew DEF_RULES_DIR "/usr/share/spamassassin"
  SANew LOCAL_RULES_DIR "/etc/mail/spamassassin"
  SANew LOCAL_STATE_DIR "/var/lib"
  SAUsers local sql

vhosts with different config

  Listen 30784
  LoadModule perl_module /usr/lib/apache/
  PerlLoadModule Mail::SpamAssassin::Spamd::Apache2::Config
  SAenabled off
  SAtimeout 25
  SAdebug info
  SANew DEF_RULES_DIR "/usr/share/spamassassin"
  SANew LOCAL_RULES_DIR "/etc/mail/spamassassin"
  SANew LOCAL_STATE_DIR "/var/lib"

  LoadModule ident_module /usr/lib/apache/

  # local, ident-authenticated users only; search in /etc/passwd,
  # if that fails, try SQL
  <VirtualHost _default_:30783>
    IdentityCheck on
    IdentityCheckTimeout 4
    SAenabled on
    SAident on
    SAAllow from
    SAUsers local sql

  # serve for whole LAN, but don't read user configuration
  <VirtualHost _default_:30784>
    SAenabled on
    SAtimeout 30
    SAAllow from
    SAUsers none


See <>.


httpd(8), spamd(1), apache-spamd(1), Mail::SpamAssassin::Spamd::Apache2(3), Mail::SpamAssassin::Spamd::Apache2::AclIP(3), Mail::SpamAssassin::Spamd::Apache2::AclRFC1413(3)

syntax highlighting: