Additional Spamassassin links |
sample Mail::SpamAssassin::Conf - SpamAssassin configuration file:
# a comment, might describe what the following statment does
rewrite_header Subject *****SPAM*****
blacklist_from thespammer@anyWhere.com
whitelist_from MyFriend@nicedomain.org
report_contact Postmaster@Real-World-Systems.com
report_hostname Real-World-Systems,com
#content based:
score SUBJ_DOLLARS 2.7 # was 1.4 Subject starts with dollar amount
score ADVANCE_FEE_1 1.7 # was 0.0 Appears to be advance fee fraud (Nigerian 419)
#from a black list
score RCVD_IN_SORBS_DUL 1.7 # was 0.9 RBL: SORBS: sent directly from dynamic IP address
full PARA_A_2_C_OF_1618 /Paragraph .a.{0,10}2.{0,10}C. of S. 1618/i
describe PARA_A_2_C_OF_1618 Claims compliance with senate bill 1618
header FROM_HAS_MIXED_NUMS From =~ /\d+[a-z]+\d+\S*@/i
describe FROM_HAS_MIXED_NUMS From: contains numbers mixed in with letters
lang es describe FROM_FORGED_HOTMAIL Forzado From: simula ser de hotmail.com
lang pt_BR report O programa detetor de Spam ZOE […]
|
SpamAssassin is configured using traditional UNIX-style configuration files, loaded from
/usr/share/spamassassin
/etc/mail/spamassassin
~/.spamassassin/user_perfs
# starts a comment.
If # is part of a rule or
configuration option, it must be escaped with a backslash. i.e.: \#
Whitespace in the files is not significant.
Do not begin a line with whitespace as future versions will use this to indicate a multi-line rule definitions.
Each rule or configuration setting must fit on one-line (as of 3.1.x).
File and directory paths can use ~ to refer to the user's home directory.
No other shell-style path extensions such as globing or ~user/ are supported.
The following are permitted for site-wide (local.cf) and
user-specific (user_prefs) files
It is important to consider the result of the SpamAssasin evaluation of a message.
If SA evaluates a message as spam it will modify the email, this may affect wether the email is delivered,
held, rejected or discarded by a follow-on process.
If spam is only modified by SA and delivered, false positives (i.e. defining a nice message (ham) as spam )
has minor impact.
If a follow-on process moves spam to a holding directory, a false positive is more of a problem.
If a follow-on process rejects or discards spam without notifying the receipient, a false positive is a bad thing!
This type of processing is not recommended (previously known as required_hits )
A false negative (i.e. failure to declare a message as spam) can have detrimental effects if the message is an attack.
required_score n.nn Default:5.0 The distributed score values heve been defined with the default in mind.
More information regarding how the scores were established is at wiki.
score test n.nn [ n.nn n.nn n.nn ]If only one valid score is listed, then that score is always used for a test.
If four valid scores are listed, then the score that is used depends on how SpamAssassin is being used.
Setting a rule's score to 0 will disable that rule from running.
If any of the score values are surrounded by parenthesis '()', then all of the scores in the line are considered to be relative to the already set score. ie: '(3)' means increase the score for this rule by 3 points in all score sets. '(3) (0) (3) (0)' means increase the score for this rule by 3 in score sets 0 and 2 only.
If no score is given for a test by the end of the configuration, a default score is assigned: a score of 1.0 is used for all tests, except those who names begin with 'T_' (this is used to indicate a rule in testing) which receive 0.01.
spamassassin -D bayes type any junk here then ^D [pid] info: config: score: requires a symbolic rule name and 1 or 4 scores [pid] info: config: SpamAssassin failed to parse line, no value provided for "score", skipping: score HELO_DYNAMIC_DHCP x x2.7
Test names which begin with '__' are indirect rules used to compose meta-match rules and can also act as prerequisites to other rules. They are not scored or listed in the 'tests hit' reports, but assigning a score of 0 to an indirect rule will disable it from running.
whitelist_from uname@domain.comwhitelist_from_rcvd
Whitelist and blacklist addresses
Only ∗ and ? metacharacters are allowed.
friend@somewhere.com, ∗@isp.com, or
∗.domain.net are valid.
(Regular expressions are not used for security reasons.
Multiple addresses per line, separated by spaces and multiple whitelist_from lines are permitted.
The headers checked for whitelist addresses are:
Resent-From if set, Envelope-Sender
Resent-Sender
X-Envelope-From
From
envelope sender from the SMTP envelope is looked up.
whitelist_from joe@example.com fred@example.com
whitelist_from ∗@example.com
unwhitelist_from uname@domain.comlocal.cf or for an individual user user_prefs.whitelist_from line.
Examples: unwhitelist_from joe@example.com fred@example.com
unwhitelist_from ∗example.com
whitelist_from_rcvd addr@lists.sourceforge.net sourceforge.net whitelist_from addresses with a check against the Received headers. This string is matched against the reverse DNS lookup used during the handoff
to your internal network's Mail Exchangers.
It can be the full hostname or the domain name .
If the host that connected to your MX had an IP address that
mapped to 'sendinghost.spamassassin.org', specify
sendinghost.spamassassin.org or spamassassin.org.
This requires that internal_networks be correct.
For a complex network, or running with DNS checks off or
with -L, you may get better results by setting that parameter.
Examples:
whitelist_from_rcvd joe@example.com example.com
whitelist_from_rcvd ∗@axkit.org sergeant.org
def_whitelist_from_rcvd addr@lists.sourceforge.net sourceforge.net whitelist_from_rcvd, but for the default whitelist entries in the SpamAssassin distribution
with a lower score which are often targets for spammer spoofing.
whitelist_allows_relays uname@domain.comwhitelist_from_rcvd that sometimes
send through a mail relay other than the listed ones. From address that is in whitelist_from_rcvd that does not match
the relay will will be prevent from trigger a forgery rule.
The address does not have to match exactly the address previously used in a
whitelist_from_rcvd line as it is compared to the address in the header.
Examples:
whitelist_allows_relays joe@example.com fred@example.com
whitelist_allows_relays ∗@example.com
unwhitelist_from_rcvd joe@example.com whitelist_from_rcvd entry.
The address must exactly match a previously whitelist_from_rcvd address .
Examples:
unwhitelist_from_rcvd joe@example.com fred@example.com
unwhitelist_from_rcvd ∗@NotSureANyMore.org
blacklist_from joe@ress.com whitelist_from.
unblacklist_from joe@ress.com
There are three levels of To whitelisting,
whitelist_to,
more_spam_to
and all_spam_towhitelist_from.
Users in the whitelist_to level may still get some spammish
mails blocked, but users in all_spam_to should never get mail blocked.
The headers checked for whitelist addresses are :
Resent-To and Resent-Cc if present;otherwise all addresses are checked from
To Cc Apparently-To Delivered-To Envelope-To X-Real-To Apparently-Resent-To X-Delivered-To Envelope-Recipients X-Envelope-To X-Original-To X-Rcpt-To
whitelist_to joe@example.com Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will
be whitelisted.
more_spam_to example.com
all_spam_to example.com
blacklist_to joe@example.comblacklist_from.
clear_headersadd_header to prevent the default headers from being added.
X-Spam-Checker-Version is not removable. rewrite_header {subject|from|to} stringstring. string removes any existing rewrite.\n for newline, \t for and tab and \\ for backslash.
Other escaped chars will be removed.1. \n disables any further automatic wrapping (ie:
long header lines are possible). The lines will still be properly folded and marked as continuing .
string may contain TEMPLATE TAGS .
From or To headers (as per RFC 2822) have string (in parantheses) appended to the address.
Parentheses in string of From or To headers will be converted to square brackets.
Subject header will have string prepended to the original subject.
A Subject header will be created if necessary.
Only use the _REQD_ and _SCORE_ tags when rewriting the Subject header
if report_safe is 0. Or you may not be able to remove
the SpamAssassin markup via the normal methods.
Customize existing headers with add_header (only the subset of messages will be changed).
Use clear_headers for removing headers.
add_header {spam|ham|all} header_name stringX-Spam-
For example add_header spam spammie Looks like spam to me. X-Spam-Looks like spam to me..header_name is restricted to the character set [A-Za-z0-9_-].
Examples (these are the defaults, Checker-Version can not be changed or removed):
add_header spam Flag _YESNOCAPS_ add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ add_header all Level _STARS(*)_ add_header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_
remove_header { spam |ham|all} header_nameX-Spam-
(so header_name will be appended to X-Spam-).
clear_headers removes all headers.X-Spam-Checker-Version is not removable.
report_safe (0|1|2)Default:1
X-Spam-headers.
A header named X-Spam-Report is added, remove_header can remove that header .See report_safe_copy_headers if you want to copy headers from
the original mail into tagged messages.
fold_headers (0|1) Default:1 1 Headers will be whitespace folded, i.e. broken up into multiple lines
0 Headers not folded.
report_contact contact_address_CONTACTADDRESS_. Default: 'the administrator of that system'
report_hostname hostname
clear_report_template
report report_messages/usr/share/spamassassin/10_default_prefs.cf .
report Spam detection software, running on the system "_HOSTNAME_", has
report identified this incoming email as possible spam. The original message
report has been attached to this so you can view it (if it isn't spam) or label
report similar future email. If you have any questions, see
report _CONTACTADDRESS_ for details.
report
report Content preview: _PREVIEW_
report
report Content analysis details: (_SCORE_ points*, _REQD_ required)*
report
report " pts rule name description"
report ---- ---------------------- --------------------------------------------------
report _SUMMARY_
If as per ?????? the message is not going to be returned, the is unnecessary.
report_safe_copy_headers header_name …
If report_safe, headers from the original message
are copied into the wrapper header (From, To, Cc, Subject, Date, etc.)
To have other headers copied, add them using this option.
Specify multiple headers on the same line, separated by spaces, or use multiple lines.
unsafe_report message
Define the report template which is attached to spam mail messages which contain a
non-text/plain part.
Example from configuration file /usr/share/spamassassin/10_default_prefs.cf
unsafe_report The original message was not completely plain text, and may be unsafe to
unsafe_report open with some email clients; in particular, it may contain a virus,
unsafe_report or confirm that your address can receive spam. If you wish to view
unsafe_report it, it may be safer to save it to a file and open it with an editor.
Each unsafe-report line appends to the template.
Tags can be used . clear_unsafe_report_template
report_charset CHARSETs Default:unset
ok_locales xx [ yy zz … ] Default:allcharacter sets that are allowed by
this option will not be marked as possibly being spam in a foreign language.
If you receive lots of spam in foreign languages, and never get any non-spam in these languages, this may help. Note that all ISO-8859-* character sets, and Windows code page character sets, are always permitted by default.
Set this to all to allow all character sets. This is the default.
The rules CHARSET_FARAWAY, CHARSET_FARAWAY_BODY, and
CHARSET_FARAWAY_HEADERS are triggered based on how this is set.
Examples:
ok_locales all (allow all locales)
ok_locales en (only allow English)
ok_locales en ja zh (allow English, Japanese, and Chinese)
Note: if there are multiple ok_locales lines, only the last one is used.
Select the locales to allow from the list :
en - Western character sets in generalja - Japanese ko - Korean ru - Cyrillic th - Thai zh - Chinese (both simplified and traditional) character sets
trusted_networks ddd.ddd.ddd.ddd[/mask] … Default:noneMXes for your domain(s) and internal relays should be specified using
the internal_networks setting. When there are 'trusted' hosts that
are not MXes or internal relays for your domain(s) they should only be
specified in trusted_networks.
A mask is a CIDR-style 'netmask', specified in bits.
An ip address with less than 4 octets with a trailing dot implies a mask
for those octets.
If a network or host address is prefaced by a ! the network or host will be
excluded (or included) in a first listed match fashion.
Examples:
trusted_networks 192.168/16 127/8 # all in 192.168.*.* and 127.*.*.*
trusted_networks 212.17.35.15 # just that host
trusted_networks 127. # all in 127.*.*.*
# include all of 10.0.1/24 except for 10.0.1.5
trusted_networks !10.0.1.5 10.0.1/24
# include all of 10.0.1/24, the !10.0.1.5 has no effect
trusted_networks 10.0.1/24 !10.0.1.5
# include all RFC1918 address space except subnet 172.16.3/24 but
# including host 172.16.3.3 within the excluded 172.16.3/24
trusted_networks 172.16.3.3 !172.16.3/24 172.16/12 10/8 192.168/16
trusted_networks line after another one
will result in all those networks becoming trusted. To clear out the
existing entries, use clear_trusted_networks.
If trusted_networks is not set and internal_networks is, the value
of internal_networks will be used for this parameter.
If DNS checks are enabled, SpamAssassin includes code to infer your trusted networks on the fly, so this may not be necessary. (Thanks to Scott Banister and Andrew Flury for the inspiration for this algorithm.) This inference works as follows:
clear_trusted_networks
internal_networks
ddd.ddd.ddd.ddd[/mask] … Default:noneInternal means that
relay hosts on these networks are considered to be MXes for your domain(s), or
internal relays. This uses the same format as trusted_networks, above.
This value is used when checking 'dial-up' or dynamic IP address
blocklists, in order to detect direct-to-MX spamming. Trusted relays
that accept mail directly from dial-up connections should not be
listed in internal_networks. List them only in trusted_networks.
If trusted_networks is set and internal_networks is not, the value
of trusted_networks will be used for this parameter.
If neither trusted_networks or internal_networks is set, no addresses
will be considered local; in other words, any relays past the machine where
SpamAssassin is running will be considered external.
clear_internal_networks
always_trust_envelope_sender (0|1) Default:0
skip_rbl_checks (0|1) Default:0
rbl_timeout n Default:15queries left 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% timeout 15 15 14 14 13 11 10 8 5 3 0
In addition, whenever the effective timeout is lowered due to additional query results returning, the remaining queries are always given at least one more second before timing out, but the wait time will never exceed rbl_timeout.
For example, if 20 queries are made at the beginning of a message check and 16 queries have returned (leaving 20%), the remaining 4 queries must finish within 5 seconds of the beginning of the check or they will be timed out.
dns_available { yes | test[: name1 name2…] | no } Default:testdns_available to specify a custom list
dns_available test: domain1.tld domain2.tld domain3.tld
bayes_min_ham_num Default:200bayes_min_spam_num Default:200
use_bayes (0|1) Default:1
use_bayes_rules (0|1) Default:1
bayes_auto_learn (0|1) Default:1See the documentation for the
Mail::SpamAssassin::Plugin::AutoLearnThreshold plugin module
bayes_ignore_header header_name
bayes_ignore_header X-Upstream-Spamfilter
bayes_ignore_header X-Upstream-SomethingElse
bayes_ignore_from uname@domain.combayes_ignore_to uname@domain.comsa-learn will ignore the
listed addresses if it is invoked using the --use-ignores option.whitelist_from.
Spam messages from certain senders may contain many words that frequently occur in ham. For example, one might read messages from a preferred bookstore but also get unwanted spam messages from other bookstores. If the unwanted messages are learned as spam then any messages discussing books, including the preferred bookstore and antiquarian messages would be in danger of being marked as spam. The addresses of the annoying bookstores would be listed. (Assuming they were halfway legitimate and didn't send you mail through myriad affiliates.)
Those who have pieces of spam in legitimate messages or otherwise receive ham messages containing potentially spammy words might fear that some spam messages might be in danger of being marked as ham. The addresses of the spam mailing lists, correspondents, etc. would be listed.
bayes_learn_during_report Default:1spamassassin -r) as spam.
bayes_sql_override_usernameIf this options is set the BayesStore::SQL module will override the set username with the value given. Useful for implementing global or group bayes databases.
bayes_use_hapaxes Default:1hapaxes (words/tokens that occur only once) when classifying?
bayes_journal_max_size Default:102400 bytes
bayes_expiry_max_db_size Default:150000
bayes_auto_expire Default:1bayes_expiry_max_db_size.
bayes_learn_to_journal Default:0
These are considered 'privileged'.
Only users running spamassassin from their procmailrc's or
forward files, or sysadmins editing a file in /etc/mail/spamassassin, can
use them.
If you add or modify a test, please be sure to run a sanity check afterwards
by running spamassassin --lintspamd users cannot use them in their user_prefs files, for
security and efficiency reasons, unless allow_user_rules
is enabled.
allow_user_rules (0|1) Default:0user_prefs . user_prefs , which effects performance.allow_user_rules will not modify an existing system rule .
describe test description test names which begin with __ are reserved for meta-match
sub-rules, and are not scored or listed in the 'tests hit' reports.
test names must not start with a number, contain only
alphanumerics and underscores and be less than 22 characters. Lower-case characters should not be used,
sub-rules, and are not scored or listed in the 'tests hit' reports.
test names which begin with T_ are reserved for tests which are
undergoing QA, and these are given a very low score.
test name example: FROM_ENDS_IN_NUMS.
Appending
Appending
For example, all of the following will result in header test exists:name_of_header
Defines a header existence test. Simplest of the header tests. header test header op /pattern/modifiers [if-unset: string]
Define a test which evaluates the header.header is the name of a mail header Subject, To, etc.
:raw to the header name will inhibit decoding of quoted-printable or base-64 encoded strings.
:addr to the header name will cause everything except the first email address to be removed from the header.
example@foo:
example@foo
example@foo (Foo Blah)
example@foo, example@bar
display: example@foo (Foo Blah), example@bar ;
Foo Blah <example@foo>
``Foo Blah'' <example@foo>
``'Foo Blah''' <example@foo>
Appending :name to the header name will cause everything except
the first real name to be removed from the header.
For example,
all of the following will result in
Foo Blah
example@foo (Foo Blah)
example@foo (Foo Blah), example@bar
display: example@foo (Foo Blah), example@bar ;
Foo Blah <example@foo>
``Foo Blah'' <example@foo>
``'Foo Blah''' <example@foo>
pseudo-headers
ALL | refers to the text of all the message's headers. |
ToCc | refers to the contents of both the 'To' and 'Cc' headers. |
EnvelopeFrom | is the address used in the 'MAIL FROM:' phase of the SMTP transaction that delivered this message. |
MESSAGEID | is a symbol meaning all Message-Id's found in the message;
some mailing list software moves the real 'Message-Id' to 'Resent-Message-Id'
or 'X-Message-Id', then uses its own one in the 'Message-Id' header. The value
returned for this symbol is the text from all 3 headers, separated by newlines. |
op is either =~ (contains regular expression) or !~ (does not contain
regular expression),
pattern is a valid Perl regular expression, with
modifiers as regexp modifiers.
Multi-line rules are not supported.
The # character must be escaped (\#) or else it will be considered to be
the start of a comment and not part of the regexp.
[if-unset: string] string will
be used if the header is not found in the mail message.
header test eval:name_of_eval_method([arguments])
name_of_eval_method is the name of
a method on the Mail::SpamAssassin::EvalTests object.
Found in lib/Mail/SpamAssassin/Plugin
Bayes.pm, BodyEval.pm, DNSEval.pm, HTMLEval.pm, HeaderEval.pm, MIMEEval.pm, RelayEval.pm, URIEval.pm, WLBLEval
header test
eval:check_rbl(set, zone [, sub-test])Received: headers from the message,
setcheck_rbl_sub() calls must use that zone ID. If more than one IP address gets a DNSBL hit for a particular rule, it does not affect the score because rules are only triggered once per message.
zone
sub-testcheck_rbl_sub() .
-notfirsthop at the end of the set name.
For querying DNS lists which include dialup IP
addresses; the first hop may be a dialup, but as long as there is at least
one more hop, via their outgoing SMTP server, that's legitimate, and so
should not gain points. If there is only one hop, that will be queried
anyway, as it should be relaying via its outgoing SMTP server instead of
sending directly to your MX (mail exchange).
-firsttrusted at the end of the set name to test the first IP address that can be trusted.
That should test the IP address of the relay that connected to the most remote trusted relay.
This requires that SpamAssassin know which relays are trusted.
For simple cases, SpamAssassin makes a good evaluation.
For complex cases set trusted_networks manually.
Place -untrusted to test all untrusted IP addresses
at the end of the set name. This does NOT include the
IP address from the most recent 'untrusted line', as used in '-firsttrusted'
above. refering to the trustworthiness of the
IP address data, not the source header line, here; and in the case of
the most recent header (the 'firsttrusted'), that data can be trusted.
See the Wiki page apache.org/spamassassin/TrustedRelays
-lastexternal at the end of the set name, to select only
the external host that connected to your internal network, or at least
the last external host with a public IP.
header test eval:check_rbl_txt('set', 'zone')check_rbl, except querying using IN TXT instead of IN A records.
If the zone supports it, it will result in a line of text describing
why the IP is listed, typically a hyperlink to a database entry.
header test eval:check_rbl_sub('set', 'sub-test')Note: the set name must be exactly the same for as the main query rule, including selections like '-notfirsthop' appearing at the end of the set name.
The full message is the pristine message headers plus the pristine message
body, including all MIME data such as images, other attachments, MIME boundaries, etc.
meta META1 TEST1 && !(TEST2 || TEST3) English language operators (
meta META2 (3 * TEST1 - 2 * TEST2) > 0 Note that Perl builtins and functions, like If you want to define a meta-rule, but do not want its individual sub-rules to
count towards the final score unless the entire meta-rule matches, give the
sub-rules names that start with '__' (two underscores). SpamAssassin will
ignore these for scoring.
These settings considered 'more privileged' than
the ones in the PRIVILEGED SETTINGS section.
These can not be set from The version_tag will be lowercased, and any non-alphanumeric or period
character will be replaced by an underscore.
These tests are only run as part of the test suite.
By default, each user has their own in their
Connect string used for SQL based storage.
By default the user is considered invalid until a plugin returns
a true value. The username passed into the plugin can be affected by
To load user scores from an LDAP directory, this will set the DSN used to connect. Example:
The query must be contained on one line.
Use global and then domain level defaults:
If global prefs should override user prefs: Example:
See
body test eval:name_of_eval_method([args])
Define a body eval test. body test /pattern/modifiers
pattern is a Perl regular expression.
The message Subject header is considered part of the body and becomes the first
paragraph when running the rules.
All HTML tags and line breaks are removed before matching.
uri test /pattern/modifiers
The 'uri' is a list of all the URIs in the body of the email,
and the test will be run on each of those URIs, adjusting the
score if a match is found. Use this test instead of one of the body tests
when you need to match a URI, as it is more accurately bound to the start/end
points of the URI, and will also be faster.
rawbody test /pattern/modifiers
The 'raw body' of a message is the raw data inside all textual parts.
The text will be decoded from base64 or quoted-printable encoding,
but HTML tags and line breaks will still be present.
The pattern will be applied line-by-line.
rawbody test eval:name_of_eval_method([args])
full test /pattern/modifiers
full test eval:name_of_eval_method([args])
meta test boolean expression
and, or) will be treated as rule names. There is no XOR operator. meta test boolean arithmetic expression
abs(), can't be
used, and will be treated as rule names. tflags test [ {net|nice|learn|userconf|noautolearn} ]
bayes_auto_learn
net-L is used, therefore its score should not be modified. nice
userconf learn
noautolearnpriority test n
ADMINISTRATOR SETTINGS
user_prefs when spamc/spamd is used.
However, all settings can be used by local programs run directly by the user.
version_tag string
You should include it when modify your ruleset, especially if you plan to distribute it.
string is your last name or your initials followed by a
number which increases with each change.
example:
version_tag myrules1 # version=2.41-myrules1
test test (ok|fail) Some string to test against
Define a regression testing string. Multiple strings per symbolic test name are permitted.
bayes_path /path/filename Default:~/.spamassassin/bayes
directory and filename for Bayes databases. Several databases
will be created, with this as the base directory and filename, with _toks,
_seen, etc. appended to the base. The default setting results in files
called ~/.spamassassin/bayes_seen, ~/.spamassassin/bayes_toks, etc.
~/.spamassassin directory with
mode 700/600.
For system-wide SpamAssassin use, and to reduce disk space usage share this across all users.
Bayes is more effective with individual user databases.
bayes_file_mode Default:700bayes_store_module Name::Of::BayesStore::Module
Alternate storage mechanism. It must be a published storage specification (see
Mail::SpamAssassin::BayesStore). For example,
Mail::SpamAssassin::BayesStore::SQL to use the generic SQL storage module. bayes_sql_dsn DBI::databasetype:databasename:hostname:portbayes_sql_username
bayes_sql_password
bayes_sql_username_authorized (0|1) Default:0
to call the services_authorized_for_username plugin hook in BayesSQL.
If the hook does not determine that the user is allowed to use bayes or is
invalid then then database will not be initialized.
If enabled without a proper plugin loaded, all users denied
bayes_sql_override_username. user_scores_dsn DBI:databasetype:databasename:hostname:port
To load user scores from a SQL database, this will set the DSN used to connect. Example: DBI:mysql:spamassassin:localhost
Write the DSN as an LDAP URL, the components being the
host and port to connect to, the base DN for the seasrch, the scope of the
search (base, one or sub), the single attribute being the multivalued attribute
used to hold the configuration data (space separated pairs of key and value,
just as in a file) and finally the filter being the expression used to filter
out the wanted username.
The filter expression is being used in a sprintf statement with the username as the only parameter, thus is can hold a
single __USERNAME__ expression. This will be replaced with the username.
ldap://localhost:389/dc=koehntopp,dc=de?spamassassinconfig?uid=__USERNAME__
user_scores_sql_username username
user_scores_sql_password password
user_scores_sql_custom_query query
Query should return two values, the preference name and value, in that order.
variables can be used as part of the query, which will be substituted for the
values before the query is run:
_TABLE_
userpref _USERNAME_
_MAILBOX_
_DOMAIN_
Default query:
SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username = '@GLOBAL' ORDER BY username ASC
SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username = '@GLOBAL' OR username = '@~'||_DOMAIN_ ORDER BY username ASC
SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username = '@GLOBAL' ORDER BY username DESC
user_scores_ldap_username
cn=master,dc=koehntopp,dc=de
user_scores_ldap_password
loadplugin PluginModuleName [/path/module.pm]
Load a perl module with the name used to create the plugin object itself.
/path/to/module.pm is the file to load, containing the module's perl code;
if specified as a relative path, it is relative to the current configuration file.
If omitted, the module will be loaded using perl's search path (the @INC array).
Mail::SpamAssassin::Plugin.
PREPROCESSING OPTIONS
include filename
if (conditional perl expression)endif line will be processed
if the conditional expression evaluates as true (in the perl sense: defined and non-0). The conditional accepts a limited subset of perl for security; enough to perform basic arithmetic comparisons. The following input is accepted:
( ) - + * / _ . , < = > ! ~ 0-9 whitespace
versionx.yyyzzz, where x is major version, y is minor
version, and z is maintenance version. So 3.0.0 is 3.000000, and 3.4.80 is 3.004080.
plugin(Name::Of::Plugin)1 if the plugin is loaded, or undef otherwise.
If the end of a configuration file is reached while still inside a
if scope, a warning will be issued,
parsing will restart on the next file.
For example:
if (version > 3.000000)
header MY_FOO …
endif
loadplugin MyPlugin plugintest.pm
if plugin (MyPlugin)
header MY_PLUGIN_FOO eval:check_for_foo()
score MY_PLUGIN_FOO 0.1
endif
ifplugin PluginModuleName if plugin(PluginModuleName).
require_version n.nnnnnn
The following tags can be used in certain options.
They will be replaced by the corresponding value when they are used.
Some tags can take an argument (in parentheses). The argument is optional, and the default is shown below.
_YESNOCAPS_ "YES"/"NO" is/isn't spam
_YESNO_ "Yes"/"No" is/isn't spam
_SCORE(PAD)_ message score, if PAD is either spaces or zeroes,
pad scores with the number of pad characters, default:none)
examples:
_SCORE(0)_ makes 2.4 become 02.4,
_SCORE(00)_ is 002.4. 12.3 would be 12.3 and 012.3
_REQD_ message threshold
_VERSION_ eg. 3.0.0 or 3.1.0-r26142-foo1
_SUBVERSION_ sub-version/code revision date (eg. 2004-01-10)
_HOSTNAME_ hostname of processing system
_REMOTEHOSTNAME_ hostname of the machine the mail was from, only available with spamd
_REMOTEHOSTADDR_ ip address of the machine the mail was from, only available with spamd
_BAYES_ bayes score
_TOKENSUMMARY_ number of new, neutral, spammy, and hammy tokens found
_BAYESTC_ number of new tokens found
_BAYESTCLEARNED_ number of seen tokens found
_BAYESTCSPAMMY_ number of spammy tokens found
_BAYESTCHAMMY_ number of hammy tokens found
_HAMMYTOKENS(N)_ N most significant hammy tokens (default, 5)
_SPAMMYTOKENS(N)_ N most significant spammy tokens (default, 5)
_DATE_ rfc-2822 date of scan
_STARS(*)_ one "*" (any character) for each full score point, max 50
Relays used and
_RELAYSTRUSTED_ trusted
_RELAYSUNTRUSTED_ not be trusted
_RELAYSINTERNAL_ internal
_RELAYSEXTERNAL_ external
_AUTOLEARN_ autolearn status ("ham", "no", "spam", "disabled", "failed", "unavailable")
_TESTS(,)_ tests hit separated by "," (or other separator)
_TESTSSCORES(,)_ as above, except with scores appended (eg. AWL=-3.0,…)
_DCCB_ DCC's "Brand" ?
_DCCR_ DCC's
_PYZOR_ Pyzor Razor
_RBL_ full results for positive RBL queries in DNS URI format
_LANGUAGES_ possible languages of mail
_PREVIEW_ content preview
_REPORT_ terse report of tests hit (for header reports)
_SUMMARY_ summary of tests hit for standard report (for body reports)
_CONTACTADDRESS_ for 'report_contact'
If a tag is undefined it will be unchanged.
HAMMYTOKENS and SPAMMYTOKENS optional second argument
specifies a format. See HAMMYTOKENS/SPAMMYTOKENS TAG FORMAT section.
The HAMMYTOKENS and SPAMMYTOKENS tags have an optional second argument
which specifies a format: _SPAMMYTOKENS(N,FMT)_, _HAMMYTOKENS(N,FMT)_
The following formats are available:
short add_header all Spammy _SPAMMYTOKENS(2,short)_
Results in message header:
X-Spam-Spammy: remove.php, UD:jpg
Indicating that the top 2 spammy tokens found are remove.php
and UD:jpg. (token follows the last colon, the
text before the colon indicates something about the token).
UD means the token looks like it might be part of a domain name.)
compact- abbreviated declassification distance-- tokenFor example:
add_header all Spammy _SPAMMYTOKENS(2,compact)_
Results in message header:
X-Spam-Spammy: 0.989-6--remove.php, 0.988-+--UD:jpg
Indicating that the probabilities of the top two tokens are 0.989 and
0.988, respectively.
The first token has a declassification distance of 6, meaning that
if the token had appeared in at least 6 more ham messages it would not be considered spammy.
The + for the second token indicates a declassification distance greater than 9.
long- declassification distance--
number of times seen in ham
-- number of times seen in spam --
age-- token
For example:
add_header all Spammy _SPAMMYTOKENS(2,long)_
Results in message header:
X-Spam-Spammy: 0.989-6--0h-4s--4d--remove.php, 0.988-33--2h-25s--1d--UD:jpg
In addition to the information provided by the compact option,
the long option shows that
the first token appeared in zero ham messages and four spam messages, and that it was last
seen four days ago.
The second token appeared in two ham messages, 25 spam messages and was last seen one day ago.
long includes declassification distances that are greater than 9.
lock_method typeThis will be quite a bit faster, but may risk file corruption if the files are ever accessed by multiple clients at once, and one or more of them is accessing them through an NFS filesystem.
Note that different platforms require different locking systems.
The supported locking systems for type are as follows:
nfssafe - an NFS-safe locking system
flock() locking
sysopen (…, O_CREAT|O_EXCL).
nfssafe and flock are only available on UNIX, and win32 is only available on Windows. By default, SpamAssassin will choose either nfssafe or win32 depending on the platform in use.
redirector_pattern /pattern/modifiersThe target URI portion must be surrounded with parentheses and no other part of the pattern may create a backreference.
Example: http://chkpt.zdnet.com/chkpt/whatever/spammer.domain/yo/dude
redirector_pattern /^https?:\/\/(?:opt\.)?chkpt\.zdnet\.com\/chkpt\/\w+\/(.*)$/i
envelope_sender_header Name-Of-HeaderEnvelopeFrom
pseudo-header, and for various rules such as SPF checking. By default, various MTAs will use different headers, such as:
X-Envelope-From
Envelope-Sender
X-Sender
Return-Path
SpamAssassin will attempt to use these, if some heuristics (such as the header placement in the message, or the absence of fetchmail signatures) appear to indicate that they are safe to use. However, it may choose the wrong headers in some mailserver configurations. (More discussion of this can be found in bug 2142 in the SpamAssassin BugZilla.)
envelope_sender_header setting may be
helpful. Name the header that your MTA adds to messages containing the address
used at the MAIL FROM step of the SMTP transaction. < and > characters at the start
and end of the email address in the right-hand side, as in the SMTP
transaction are removed.
If the header is not found in a message, or if does not contain
@ , SpamAssassin will fall back to its default heuristics.
http://wiki.apache.org/spamassassin/EnvelopeSenderInReceived details a
better proposal using the Received headers.) example:
envelope_sender_header X-SA-Exim-Mail-From
A line starting with the text lang xx will only be interpreted
if the user is in that locale, allowing test descriptions and
templates to be set for that language.
The locales string should specify either both the language and country, e.g.
lang pt_BRlang de
Mail::SpamAssassin spamassassin spamd
SpamAssassin's network rules are run in parallel. This can cause overhead in terms of the number of file descriptors required; it is recommended that the minimum limit on file descriptors be raised to at least 256 for safety. wiki.apache.org/spamAssassin
Rule Quality Assuarance displays info about rules from the QA process.
report from this link is VERY slow, just wait!
Example:
CORRUPT_FROM_LINE_IN_HDRS
Detailed results for rule CORRUPT_FROM_LINE_IN_HDRS, from source file rulesrc/sandbox/jm/20_basic.cf, tflags userconf publish. Source file was last modified on 2008-02-13 15:15:24 UTC.
Locating the in the 20_basic.cf file:
27 # define an informational rule, which detects when a message has become 28 # corrupt with a header prepended before the From line: 29 # 30 # Header: blah 31 # From address@example.com Mon Jun 19 14:15:23 2006 32 # Header2: blah 33 34 body __BODY_STARTS_WITH_FROM_LINE /^From \S+ \S\S\S \S\S\S .. ..:..:.. \S+\s+\S+\: /s 35 meta CORRUPT_FROM_LINE_IN_HDRS (MISSING_HEADERS && __BODY_STARTS_WITH_FROM_LINE &&MISSING_DATE &&NO_RELAYS) 36 describe CORRUPT_FROM_LINE_IN_HDRS Informational: message is corrupt, with a From line in its headers 37 38 # informational rules don't have to hit spam 39 tflags CORRUPT_FROM_LINE_IN_HDRS userconf publish 40 score CORRUPT_FROM_LINE_IN_HDRS 0.001
sa-update, Spam Assassin Bayes Learn
AWL is a score averager.
the points it applies are based on the historical scoring from
that sender, the score will vary by who the sender is and when the
message is processed (i.e. their history to-date).
Perhaps:
AutomaticWhiteList should be renamed (HEAT Heuristic Email Address Tracking)
The important point is not that it's automatically applied, but that it's _A_veraging...
It retains the number of messages from an address ( and the most significant portion of the IP address) and sum of the scores for those messages. Seperate entries are retained if the same
email address is different.
average total/count -10.7 -203.0/19 users-help@spamassassin.apache.org 98.109
SPF is a DNS record used by some (many) MailTransferAgents.
When an email is received from fine fellow by way of evil mailer the MTA can
retrieve the DNS TXT record for fine fellow to check if fine fellow ever users evil mailer
to send out messages.
TXT "v=spf1 +a +mx -all"
This means that only the A or MX hosts send messages and -all others should
fail the test ( as indicated by the - prefix to all) and those messsages should be rejected.
Which hosts are blacklistedmxtoolbox.com. Here you can see if YOUR host is blacklisted!
sa-heatu Heuristic Email Address Tracking Utility.
Perl method Description