Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0 < 9.0
- , ,
Start using this module
Add this module to your Puppetfile:
mod 'LeLutin-spamassassin', '3.3.0'
Learn more about managing modules with a PuppetfileDocumentation
Spamassassin
Table of Contents
- Overview
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with spamassassin
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
This module installs, configures and manages spamassassin either as a service (through spamd) or for use with applications like amavisd.
Module Description
Spamassassin has a huge array of configuration directives, this module tries to give the user access to as many of them as possible. There are a lot of class parameters and most of them have a brief description of it's function in the header of the class file. For more information see: http://spamassassin.apache.org/full/3.3.x/doc/Mail_SpamAssassin_Conf.html
Setup
What spamassassin affects
- spamassassin package.
- spamassassin configuration files: local.cf, v310.cf, v312.cf, v320.cf and sql.cf (optional).
- spamassassin service (optional).
- optional packages: razor, pyzor and dkim.
Setup Requirements
On Redhat systems, if you enable razor and/or pyzor, the packages need to come from EPEL, which is not managed by this module. See https://forge.puppetlabs.com/stahnma/epel.
The installation of the DCC plugin, if enabled, needs to be handled elsewhere.
Beginning with spamassassin
Minimal usage for spamd
class { 'spamassassin':
sa_update => true,
service_enabled => true,
}
Use with amavis
class { 'spamassassin':
sa_update => true,
run_execs_as_user => 'amavis',
service_enabled => false,
bayes_path => '/var/lib/amavis/bayes'
razor_home => '/var/lib/amavis/.razor',
pyzor_home => '/var/lib/amavis/.pyzor',
}
Usage
Override the default score values.
class { 'spamassassin':
score_tests => {
'BAYES_00' => '-1.9',
'HTML_IMAGE_ONLY_28' => '1.40',
},
}
Whitelist or blacklist some addresses
class { 'spamassassin':
whitelist_from => ['*@abccorp.com', '*@abc.com'],
whitelist_from_rcvd => ['*@abccorp.com mail.abccorp.com'],
whitelist_to => ['bob@gmail.com','sarah@yahoo.co.uk'],
blacklist_from => ['*@msn.com','*@hotmail.com'],
blacklist_to => ['frank@spammer.com', 'rita@example.com'],
}
SQL based options
class { 'spamassassin':
bayes_sql_enabled => true,
bayes_sql_dsn => 'DBI:mysql:spamassassin:localhost:3306',
bayes_sql_username => 'sqluser',
bayes_sql_password => 'somesecret',
bayes_sql_override_username => 'amavis',
user_scores_dsn => 'DBI:mysql:spamassassin:localhost:3306',
user_scores_sql_username => 'sqluser',
user_scores_sql_password => 'somesecret',
awl_enabled => true,
awl_sql_enabled => true,
awl_dsn => 'DBI:mysql:spamassassin',
awl_sql_username => 'sqluser',
awl_sql_password => 'somesecret',
}
Logging for SpamAssassin
class { 'spamassassin':
spamd_syslog_facility => '/var/log/spamd.log',
}
Misc options
class { 'spamassassin':
rewrite_header_subject => '***SPAM***',
report_safe => 2,
trusted_networks => ['192.168.0.0/24'],
skip_rbl_checks => false,
dns_available => 'test',
bayes_ignore_header => ['X-Spam-Flag','X-Spam-Status'],
spamcop_enabled => true,
spamcop_from_address => 'me@mydomain.com',
spamcop_max_report_size => 100,
awl_enabled => true,
shortcircuit_enabled => true,
shortcircuit_user_in_whitelist => 'on',
shortcircuit_user_in_def_whitelist => 'on',
shortcircuit_user_in_blacklist => 'on',
dkim_timeout => 10,
razor_timeout => 10,
pyzor_timeout => 10,
}
Reference
Classes
Public Classes
- spamassassin: Main class, includes all other classes.
Private Classes
- spamassassin::params: Default values.
Parameters
The following parameters are available in the spamassassin module:
sa_update
Boolean. Enable the sa-update cron job. Default: false
run_execs_as_user
If you enabled razor and/or pyzor and would like the razor-admin or pyzor discover commands to be run as a different user specify the username in this directive. Example: amavis. Default: undef
package_name
String. The package name to use. Default: Distribution specific
service_enable
Boolean. Will enable service at boot and ensure a running service.
service_name
String. The service name to use for the spamassassin service. Default: Distribution specific
spamd_max_children
This option specifies the maximum number of children to spawn. Spamd will spawn that number of children, then sleep in the background until a child dies, wherein it will go and spawn a new child.
spamd_syslog_facility
This option defines the log location where SpamAssassin will deposit logs, this can either be a file location or a syslog name
Examples:
spamd_syslog_facility => 'mail' # use syslog, facility mail
spamd_syslog_facility => './mail' # log to file ./mail
spamd_syslog_facility => 'stderr 2>/dev/null' # log to stderr, throw messages away
spamd_syslog_facility => 'null' # the same as above
spamd_syslog_facility => 'file' # log to file ./spamd.log
spamd_syslog_facility => '/var/log/spamd.log' # log to file /var/log/spamd.log
See the details of the -s option in spamd documentation for more information.
spamd_min_children
The minimum number of children that will be kept running The minimum value is 1, the default value is 1 in spamd, and undef here. If you have lots of free RAM, you may want to increase this.
spamd_listen_address
Tells spamd to listen on the specified IP address (defaults to 127.0.0.1). Use 0.0.0.0to listen on all interfaces. You can also use a valid hostname which will make spamd listen on the first address that name resolves to.
spamd_allowed_ips
Specify a list of authorized hosts or networks which can connect to this spamd instance. Single IP addresses, CIDR format networks, or ranges of IP addresses by listing 3 or less octets with a trailing dot. Hostnames are not supported, only IP addresses. This option can be specified multiple times, or can take a list of addresses separated by commas.
spamd_username
spamd runs as this user
spamd_groupname
spamd runs in this group
spamd_nouserconfig
Turn off (on) reading of per-user configuration files (user_prefs) from the user's home directory. The default behaviour is to read per-user configuration from the user's home directory (--user-config).
spamd_allowtell
Allow learning and forgetting (to a local Bayes database), reporting and revoking (to a remote database) by spamd. The client issues a TELL command to tell what type of message is being processed and whether local (learn/forget) or remote (report/revoke) databases should be updated.
spamd_sql_config
Turn on SQL lookups even when per-user config files have been disabled with -x this is useful for spamd hosts which don’t have user’s home directories but do want to load user preferences from an SQL database.
required_score
Set the score required before a mail is considered spam. n.nn can be an integer or a real number.
score_tests
Assign scores (the number of points for a hit) to a given test. Scores can be positive or negative real numbers or integers.
custom_rules
Define custom rules. This is a hash of hashes. The key for the outer hash is the spamassassin rule name, the inner hash for each entry should contain the rule definition, e.g:
spamassassin::custom_rules:
INVOICE_SPAM:
body: '/Invoice.*from.*You have received an invoice from .* To start with it, print out or download a JS copy of your invoice/'
score: 6
describe: 'spam reported claiming "You have received an invoice"'
custom_config
Add custom lines to the config file. Useful for configuring modules that aren't otherwise handled by this Puppet module. This is an array of strings, e.g:
spamassassin::custom_config:
- hashcash_accept *@example.com
- hashcash_accept *@example.net
whitelist_from
Used to whitelist sender addresses which send mail that is often tagged (incorrectly) as spam. This would be written to the global local.cf file
whitelist_from_rcvd
Used to whitelist the combination of a sender address and rDNS name/IP. This would be written to the global local.cf file
whitelist_to
If the given address appears as a recipient in the message headers (Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will be whitelisted.
blacklist_from
Used to specify addresses which send mail that is often tagged (incorrectly) as non-spam, but which the user doesn't want.
blacklist_to
If the given address appears as a recipient in the message headers (Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will be blacklisted.
rewrite_header_subject
By default, suspected spam messages will not have the Subject, From or To lines tagged to indicate spam. By setting this option, the header will be tagged with the value of the parameter to indicate that a message is spam.
rewrite_header_from
See rewrite_header_subject.
rewrite_header_to
See rewrite_header_subject.
report_safe
Values: 0,1 or 2. See: http://spamassassin.apache.org/full/3.3.x/doc/Mail_SpamAssassin_Conf.html#report_safe Default: 0
clear_trusted_networks
Boolean. Empty the list of trusted networks. Default: false
trusted_networks
What networks or hosts are 'trusted' in your setup. Trusted in this case means that relay hosts on these networks are considered to not be potentially operated by spammers, open relays, or open proxies.
clear_internal_networks
Boolean. Empty the list of internal networks. Default: false
internal_networks
Internal means that relay hosts on these networks are considered to be MXes for your domain(s), or internal relays.
skip_rbl_checks
Boolean. If false SpamAssassin will run RBL checks. Default: true
dns_available
If set to 'test', SpamAssassin will query some default hosts on the internet to attempt to check if DNS is working or not. Default: yes
bayes_enabled
Boolean. Whether to use the naive-Bayesian-style classifier built into SpamAssassin. Default: true
bayes_use_hapaxes
Boolean. Should the Bayesian classifier use hapaxes (words/tokens that occur only once) when classifying? This produces significantly better hit-rates, but increases database size by about a factor of 8 to 10. Default: true
bayes_auto_learn
Boolean. Whether SpamAssassin should automatically feed high-scoring mails into its learning systems. Default: true
bayes_ignore_header
See http://spamassassin.apache.org/full/3.3.x/doc/Mail_SpamAssassin_Conf.html#bayes_ignore_header
bayes_auto_expire
Boolean. If enabled, the Bayes system will try to automatically expire old tokens from the database. Default: true
bayes_sql_enabled
Boolean. If true will set bayes_store_module to use sql and will write the sql dsn, and other directives, to local.cf. Default: false
bayes_sql_dsn
This parameter gives the connect string used to connect to the SQL based Bayes storage. By default will use the mysql driver and a database called spamassassin. Please note the module does not manage any database settings or the creation of the schema.
bayes_sql_username
The sql username used for the dsn provided above.
bayes_sql_password
The sql password used for the dsn provided above.
bayes_sql_override_username
If this options is set the BayesStore::SQL module will override the set username with the value given. This could be useful for implementing global or group bayes databases.
bayes_path
This is the directory and filename for Bayes databases. Please note this parameter is not used if bayes_sql_enabled is true.
user_scores_dsn
The perl DBI DSN string used to specify the SQL server holding user config example: 'DBI:mysql:dbname:hostname
user_scores_sql_username
The SQL username to connect to the above server
user_scores_sql_password
The SQL password for the above user
user_scores_sql_custom_query
Custom SQL query to use for spamd user_prefs.
dcc_enabled
Boolean. Enable/disable the DCC plugin. Default: false
dcc_timeout
How many seconds you wait for DCC to complete, before scanning continues without the DCC results. Default: 8
dcc_body_max
This option sets how often a message's body/fuz1/fuz2 checksum must have been reported to the DCC server before SpamAssassin will consider the DCC check as matched. As nearly all DCC clients are auto-reporting these checksums, you should set this to a relatively high value, e.g. 999999 (this is DCC's MANY count). Default: 999999
dcc_fuz1_max
See dcc_body_max. Default: 999999
dcc_fuz2_max
See dcc_body_max. Default: 999999
pyzor_enabled
Boolean. Enable/disable the Pyzor plugin. Default: true
pyzor_timeout
How many seconds you wait for Pyzor to complete, before scanning continues without the Pyzor results. Default: 3.5
pyzor_max
This option sets how often a message's body checksum must have been reported to the Pyzor server before SpamAssassin will consider the Pyzor check as matched. Default: 5
pyzor_options
Specify additional options to the pyzor command. Please note that only characters in the range [0-9A-Za-z ,._/-] are allowed for security reasons. Please note that the module will automatically add the homedir options as part of the configuration.
pyzor_path
This option tells SpamAssassin specifically where to find the pyzor client instead of relying on SpamAssassin to find it in the current PATH.
pyzor_home
Define the homedir for pyzor. Default is to use the [global config dir]/.pyzor
razor_enabled
Boolean. Enable/disable the Pyzor plugin. Default: true
razor_timeout
How many seconds you wait for Razor to complete before you go on without the results. Default: 5
razor_home
Define the homedir for razor. Please note that if you set a custom path the module will automatically use the directory in which you store your razor config as the home directory for the module. Default is to use the [global config dir]/.razor
spamcop_enabled
Boolean. Enable/disable the Pyzor plugin. Default: false
spamcop_from_address
This address is used during manual reports to SpamCop as the From: address. You can use your normal email address. If this is not set, a guess will be used as the From: address in SpamCop reports.
spamcop_to_address
Your customized SpamCop report submission address. You need to obtain this address by registering at http://www.spamcop.net/. If this is not set, SpamCop reports will go to a generic reporting address for SpamAssassin users and your reports will probably have less weight in the SpamCop system.
spamcop_max_report_size
Messages larger than this size (in kilobytes) will be truncated in report messages sent to SpamCop. The default setting is the maximum size that SpamCop will accept at the time of release. Default: 50
awl_enabled
Boolean. Enable/disable the Auto-Whitelist plugin. Default: false
awl_sql_enabled
Boolean. If true will set auto_whitelist_factory to use sql and will write the sql dsn, and other directives, to local.cf. Default: false
awl_dsn
This parameter gives the connect string used to connect to the SQL based storage. By default will use the mysql driver and a database called spamassassin. Please note the module does not manage any database settings or the creation of the schema.
awl_sql_username
The sql username used for the dsn provided above.
awl_sql_password
The sql password used for the dsn provided above.
awl_sql_override_username
Used by the SQLBasedAddrList storage implementation. If this option is set the SQLBasedAddrList module will override the set username with the value given. This can be useful for implementing global or group based auto-whitelist databases.
auto_whitelist_path
This is the automatic-whitelist directory and filename. Default: ~/.spamassassin/auto-whitelist
auto_whitelist_file_mode
The file mode bits used for the automatic-whitelist directory or file. Default: 0600
shortcircuit_enabled
Boolean. Enable/disable the Shortcircuit plugin. Default: false
shortcircuit_user_in_whitelist
Values: ham, spam, on or off.
shortcircuit_user_in_def_whitelist
Values: ham, spam, on or off.
shortcircuit_user_in_all_spam_to
Values: ham, spam, on or off.
shortcircuit_subject_in_whitelist
Values: ham, spam, on or off.
shortcircuit_user_in_blacklist
Values: ham, spam, on or off.
shortcircuit_user_in_blacklist_to
Values: ham, spam, on or off.
shortcircuit_subject_in_blacklist
Values: ham, spam, on or off.
shortcircuit_all_trusted
Values: ham, spam, on or off.
dkim_enabled
Boolean. Enable/disable the DKIM plugin. Default: true
dkim_timeout
How many seconds to wait for a DKIM query to complete, before scanning continues without the DKIM result. Default: 5
rules2xsbody_enabled
Boolean. Enable the Rule2XSBody plugin. Compile ruleset to native code with sa-compile. Requires re2c and gcc packages (not managed in this module)
Limitations
This module is tested against Puppet 6.0 and higher.
The module has been tested on:
- CentOS 7 and 8
- CentOS 8 is EOL. This module still keeps compatibility to this release until version 7 is also EOL since supporting version 8 should come at no additional maintenance cost.
- Debian 10 and 11
- Ubuntu 20.04 and 22.04
Development
- Fork puppet-spamassassin
- Create a topic branch against the develop branch
git checkout develop; git checkout -b my_branch
- Make sure you have added tests for your changes. Tests are written with rspec-puppet.
- Run all the tests to assure nothing else was accidentally broken. To run all tests: rake spec
- Push to your branch
git push origin my_branch
- Create a Pull Request from your branch against the develop branch.
Contributors
The list of contributors can be found in two places:
Reference
Table of Contents
Classes
Public Classes
spamassassin
: This module installs and configures spamassassin and a few of its plugins.
Private Classes
spamassassin::config
: Configure spamassassin and related software.spamassassin::install
: Install packages for spamassassin and related software.spamassassin::params
: Default parameter values for class spamassassinspamassassin::service
: Setup spamassassin service.
Classes
spamassassin
For examples, see tests folder.
Parameters
The following parameters are available in the spamassassin
class:
sa_update
run_execs_as_user
package_name
service_enabled
service_name
notify_service_name
spamd_max_children
spamd_min_children
spamd_listen_address
spamd_allowed_ips
spamd_username
spamd_groupname
spamd_nouserconfig
spamd_allowtell
spamd_sql_config
spamd_syslog_facility
configdir
spamd_options_file
spamd_options_var
spamd_defaults
sa_update_file
required_score
score_tests
whitelist_from
whitelist_from_rcvd
whitelist_to
blacklist_from
blacklist_to
rewrite_header_subject
rewrite_header_from
rewrite_header_to
report_safe
add_header_spam
add_header_ham
add_header_all
remove_header_spam
remove_header_ham
remove_header_all
clear_trusted_networks
trusted_networks
clear_internal_networks
internal_networks
skip_rbl_checks
dns_available
uridnsbl_skip_domain
uridnsbl
urirhsbl
urirhssub
bayes_enabled
bayes_use_hapaxes
bayes_auto_learn
bayes_ignore_header
bayes_auto_expire
bayes_sql_enabled
bayes_sql_dsn
bayes_sql_username
bayes_sql_password
bayes_sql_override_username
bayes_store_module
bayes_path
bayes_file_mode
bayes_auto_learn_threshold_nonspam
bayes_auto_learn_threshold_spam
user_scores_dsn
user_scores_sql_username
user_scores_sql_password
user_scores_sql_custom_query
dcc_enabled
dcc_timeout
dcc_body_max
dcc_fuz1_max
dcc_fuz2_max
pyzor_enabled
pyzor_timeout
pyzor_max
pyzor_count_min
pyzor_options
pyzor_path
pyzor_home
razor_enabled
razor_timeout
razor_home
spamcop_enabled
spamcop_from_address
spamcop_to_address
spamcop_max_report_size
awl_enabled
awl_sql_enabled
awl_dsn
awl_sql_username
awl_sql_password
awl_sql_override_username
auto_whitelist_path
auto_welcomelist_path
auto_whitelist_file_mode
auto_welcomelist_file_mode
textcat_enabled
ok_languages
ok_locales
normalize_charset
shortcircuit_enabled
shortcircuit_user_in_whitelist
shortcircuit_user_in_def_whitelist
shortcircuit_user_in_all_spam_to
shortcircuit_subject_in_whitelist
shortcircuit_user_in_blacklist
shortcircuit_user_in_blacklist_to
shortcircuit_subject_in_blacklist
shortcircuit_all_trusted
dkim_enabled
dkim_timeout
rules2xsbody_enabled
custom_rules
custom_config
sa_update
Data type: Boolean
Enable the sa-update cron job.
Default value: false
run_execs_as_user
Data type: Optional[String]
If you enabled razor and/or pyzor and would like the razor-admin or pyzor
discover commands to be run as a different user specify the username in this
directive. Example: amavis
Default value: undef
package_name
Data type: String
The package name to use. Default is distribution-specific
Default value: $spamassassin::params::package_name
service_enabled
Data type: Boolean
Will enable service at boot and ensure a running service.
Default value: false
service_name
Data type: String
The service name to use for the spamassassin service. Default is distribution-specific
Default value: $spamassassin::params::service_name
notify_service_name
Data type: Optional[String]
If specified then this service will be notified instead of "spamd" when config is update. Only has an effect if service_enabled is false.
Default value: undef
spamd_max_children
Data type: Integer[1]
The maximum number of children to spawn. Spamd will spawn that number of children, then sleep in the background until a child dies, wherein it will go and spawn a new child.
Default value: 5
spamd_min_children
Data type: Optional[Integer[1]]
The minimum number of children that will be kept running. The minimum possible value is 1, the default value is 1 in spamd, and undef here. If you have lots of free RAM, you may want to increase this.
Default value: undef
spamd_listen_address
Data type: Array[Stdlib::Host]
List of IP addresses spamd will listen to (defaults to "localhost", which will listen both on IPv4 and IPv6 locally). Use 0.0.0.0 to listen on all interfaces. You can also use a valid hostname which will make spamd listen on the first address that name resolves to. To listen only to an IPv6 address, make sure to encase the address within square brackets (i.e. "[fe80::fc54:ff:fe8f:4b36]")
Default value: ['localhost']
spamd_allowed_ips
Data type: Array[String]
Specify a list of authorized hosts or networks which can connect to this
spamd instance. Values can be single IP addresses or CIDR format networks.
Hostnames are not supported, only IP addresses. Similarly to
spamd_listen_address
, to specify IPs or CIDR notation for IPV6, make sure
to encase the address or network part in square brackets)
Default value: ['127.0.0.1/32','[::1]/8']
spamd_username
Data type: Optional[String]
spamd runs as this user
Default value: undef
spamd_groupname
Data type: Optional[String]
spamd runs in this group
Default value: undef
spamd_nouserconfig
Data type: Boolean
Turn off (on) reading of per-user configuration files (user_prefs) from the
user's home directory. The default behaviour is to read per-user
configuration from the user's home directory (--user-config
/-c
).
Note that by default spamd_defaults
activates --create-prefs
so you may
want to revise that parameter if you set this option.
Default value: false
spamd_allowtell
Data type: Boolean
Allow learning and forgetting (to a local Bayes database), reporting and revoking (to a remote database) by spamd. The client issues a TELL command to tell what type of message is being processed and whether local (learn/forget) or remote (report/revoke) databases should be updated.
Default value: false
spamd_sql_config
Data type: Boolean
Turn on SQL lookups even when per-user config files have been disabled with
-x
this is useful for spamd hosts which dont have users home directories
but do want to load user preferences from an SQL database.
Default value: false
spamd_syslog_facility
Data type: Optional[String]
Turn this on to deposit logs for SpamAssassin and define the log location.
e.g. /var/log/spamd.log
Default value: undef
configdir
Data type: Stdlib::Absolutepath
Absolute path to the directory containing spamassassin's configuration files.
Default value: $spamassassin::params::configdir
spamd_options_file
Data type: Stdlib::Absolutepath
Absolute path to the file containing global options to spamd.
Default value: $spamassassin::params::spamd_options_file
spamd_options_var
Data type: String
Name of the shell variable used for storing spamd options in
spamd_options_file
.
Default value: $spamassassin::params::spamd_options_var
spamd_defaults
Data type: String
String of spamd option flags set in spamd_options_file
. If you change some
parameters you may need to revise those deamon flags.
Default value: $spamassassin::params::spamd_defaults
sa_update_file
Data type: Stdlib::Absolutepath
Absolute path to file that contains shell variables for sa-update.
Default value: $spamassassin::params::sa_update_file
required_score
Data type: Numeric
Set the score required before a mail is considered spam. Can be an integer or a floating-point number.
Default value: 5
score_tests
Data type: Hash
Assign scores (the number of points for a hit) to a given test. Scores can be positive or negative real numbers or integers.
Default value: {}
whitelist_from
Data type: Array
Used to whitelist sender addresses which send mail that is often tagged
(incorrectly) as spam. This would be written to the global local.cf
file
Default value: []
whitelist_from_rcvd
Data type: Array
Used to whitelist the combination of a sender address and rDNS name/IP. This
would be written to the global local.cf
file
Default value: []
whitelist_to
Data type: Array
If the given address appears as a recipient in the message headers (Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will be whitelisted.
Default value: []
blacklist_from
Data type: Array
Used to specify addresses which send mail that is often tagged (incorrectly) as non-spam, but which the user doesn't want.
Default value: []
blacklist_to
Data type: Array
If the given address appears as a recipient in the message headers (Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will be blacklisted.
Default value: []
rewrite_header_subject
Data type: Optional[String]
By default, suspected spam messages will not have the Subject, From or To lines tagged to indicate spam. By setting this option, the header will be tagged with the value of the parameter to indicate that a message is spam.
Default value: undef
rewrite_header_from
Data type: Optional[String]
See rewrite_header_subject
.
Default value: undef
rewrite_header_to
Data type: Optional[String]
See rewrite_header_subject
.
Default value: undef
report_safe
Data type: Integer[0,2]
Default value: 0
add_header_spam
Data type: Array
Customise headers to be added to spam emails. Each array item should
contain: header_name
string.
Default value: []
add_header_ham
Data type: Array
See add_header_spam
.
Default value: []
add_header_all
Data type: Array
See add_header_spam
.
Default value: []
remove_header_spam
Data type: Array
Remove headers from spam emails. Each array item should be a header_name
to remove.
Default value: []
remove_header_ham
Data type: Array
See remove_header_spam
.
Default value: []
remove_header_all
Data type: Array
See remove_header_spam
.
Default value: []
clear_trusted_networks
Data type: Boolean
Empty the list of trusted networks.
Default value: false
trusted_networks
Data type: Array
What networks or hosts are 'trusted' in your setup. Trusted in this case means that relay hosts on these networks are considered to not be potentially operated by spammers, open relays, or open proxies.
Default value: []
clear_internal_networks
Data type: Boolean
Empty the list of internal networks.
Default value: false
internal_networks
Data type: Array
Internal means that relay hosts on these networks are considered to be MXes for your domain(s), or internal relays.
Default value: []
skip_rbl_checks
Data type: Boolean
If false SpamAssassin will run RBL checks.
Default value: true
dns_available
Data type: Pattern[/^(test|yes|no)$/]
If set to 'test', SpamAssassin will query some default hosts on the internet to attempt to check if DNS is working or not.
Default value: 'yes'
uridnsbl_skip_domain
Data type: Array[String]
List of domains for which URIDNSBL tests should be skipped. This can be used to reduce the volume of URIBDNSBL checks, for example by disabling checks for known domains that get sent to very often.
Default value: []
uridnsbl
Data type: Hash[String, Array[String,2,2]]
Specify a lookup. Each entry's key is the name of the rule to be used. The value should be an array with two items. The first item is the dnsbl zone to lookup IPs in, and the second item is the type of lookup to perform (TXT or A). Note that you must also define a body-eval rule calling check_uridnsbl() to use this.
Default value: {}
urirhsbl
Data type: Hash[String, Array[String,2,2]]
Specify a RHSBL-style domain lookup. Each entry's key is the name of the rule to be used. The value should be an array with two items. The first item is the dnsbl zone to lookup IPs in, and the second item is the type of lookup to perform (TXT or A).
Default value: {}
urirhssub
Data type: Hash[String, Array[String,3,3]]
Specify a RHSBL-style domain lookup with a sub-test. Each entry's key is the name of the rule to be used. The value should be an array with three items. The first item is the dnsbl zone to lookup IPs in. The second item is the type of lookup to perform (TXT or A). Finally, the third item is the sub-test to run against the returned data.
Default value: {}
bayes_enabled
Data type: Boolean
Whether to use the naive-Bayesian-style classifier built into SpamAssassin.
Default value: true
bayes_use_hapaxes
Data type: Boolean
Should the Bayesian classifier use hapaxes (words/tokens that occur only once) when classifying? This produces significantly better hit-rates, but increases database size by about a factor of 8 to 10.
Default value: true
bayes_auto_learn
Data type: Boolean
Whether SpamAssassin should automatically feed high-scoring mails into its learning systems.
Default value: true
bayes_ignore_header
Data type: Array
List of email header names that spamd should ignore. See https://spamassassin.apache.org/full/4.0.x/doc/Mail_SpamAssassin_Conf.html#bayes_ignore_header-header_name
Default value: []
bayes_auto_expire
Data type: Boolean
If enabled, the Bayes system will try to automatically expire old tokens from the database.
Default value: true
bayes_sql_enabled
Data type: Boolean
If true will write the SQL-related directives to local.cf
.
Default value: false
bayes_sql_dsn
Data type: String
This parameter gives the connect string used to connect to the SQL based Bayes storage. By default will use the mysql driver and a database called spamassassin. Please note the module does not manage any database settings or the creation of the schema.
Default value: 'DBI:mysql:spamassassin'
bayes_sql_username
Data type: String
The sql username used for the dsn provided above.
Default value: 'root'
bayes_sql_password
Data type: Optional[String]
The sql password used for the dsn provided above.
Default value: undef
bayes_sql_override_username
Data type: Optional[String]
If this options is set the BayesStore::SQL module will override the set username with the value given. This could be useful for implementing global or group bayes databases.
Default value: undef
bayes_store_module
Data type: String
This parameter configures the module that spamassassin will use when connecting to the Bayes SQL database. The default will work for most database types, but selecting the module for a DBMS may result provide performance improvements or additional features. Certain modules may require the additional perl modules that are not installed by this Puppet module.
Default value: 'Mail::SpamAssassin::BayesStore::SQL'
bayes_path
Data type: Optional[Stdlib::Absolutepath]
This is the directory and filename for Bayes databases. Please note this
parameter is not used if bayes_sql_enabled
is true.
Default value: undef
bayes_file_mode
Data type: Optional[String]
The permissions that spamassassin will set to the bayes file that it may create.
Default value: undef
bayes_auto_learn_threshold_nonspam
Data type: Optional[Float]
Score at which SA learns the message as ham.
Default value: undef
bayes_auto_learn_threshold_spam
Data type: Optional[Float]
Score at which SA learns the message as spam.
Default value: undef
user_scores_dsn
Data type: Optional[String]
The perl DBI DSN string used to specify the SQL server holding user config. Example: 'DBI:mysql:dbname:hostname
Default value: undef
user_scores_sql_username
Data type: Optional[String]
The SQL username to connect to the above server.
Default value: undef
user_scores_sql_password
Data type: Optional[String]
The SQL password for the above user.
Default value: undef
user_scores_sql_custom_query
Data type: Optional[String]
Custom SQL query to use for spamd user_prefs.
Default value: undef
dcc_enabled
Data type: Boolean
Enable/disable the DCC plugin.
Default value: false
dcc_timeout
Data type: Optional[Integer]
How many seconds you wait for DCC to complete, before scanning continues without the DCC results. If left undef, spamd uses its default value of 5
Default value: undef
dcc_body_max
Data type: Optional[Integer]
This option sets how often a message's body/fuz1/fuz2 checksum must have been reported to the DCC server before SpamAssassin will consider the DCC check as matched. As nearly all DCC clients are auto-reporting these checksums, you should set this to a relatively high value, e.g. 999999 (this is DCC's MANY count). If left undef, spamd uses its default value of 999999
Default value: undef
dcc_fuz1_max
Data type: Optional[Integer]
See dcc_body_max
. If left undef, spamd uses its default value of 999999
Default value: undef
dcc_fuz2_max
Data type: Optional[Integer]
See dcc_body_max
. If left undef, spamd uses its default value of 999999
Default value: undef
pyzor_enabled
Data type: Boolean
Enable/disable the Pyzor plugin.
Default value: true
pyzor_timeout
Data type: Optional[Numeric]
How many seconds you wait for Pyzor to complete, before scanning continues without the Pyzor results. If left undef, spamd uses its default of 5
Default value: undef
pyzor_max
Data type: Optional[Integer]
See pyzor_count_min
. Note that this option has been renamed to
pyzor_count_min
in spamassassin 4.0.x and it cannot be used from that
version onwards.
Default value: undef
pyzor_count_min
Data type: Optional[Integer]
This option sets how often a message's body checksum must have been reported to the Pyzor server before SpamAssassin will consider the Pyzor check as matched. If left undefined, spamd will use its default of 5. Note that this option does not exist in versions prior to 4.0.x.
Default value: undef
pyzor_options
Data type: Optional[Pattern[/[0-9A-Za-z ,._\/-]\+/]]
Specify additional options to the pyzor command. Please note that only
characters in the range [0-9A-Za-z ,._/-]
are allowed for security reasons.
Please note that the module will automatically add the homedir options as
part of the configuration.
Default value: undef
pyzor_path
Data type: Optional[Stdlib::Absolutepath]
This option tells SpamAssassin specifically where to find the pyzor client instead of relying on SpamAssassin to find it in the current PATH.
Default value: undef
pyzor_home
Data type: Stdlib::Absolutepath
Define the homedir for pyzor. Default is to use the [global config dir]/.pyzor
Default value: $spamassassin::params::pyzor_home
razor_enabled
Data type: Boolean
Enable/disable the Razor2 plugin.
Default value: true
razor_timeout
Data type: Optional[Integer]
How many seconds you wait for Razor to complete before you go on without the results. If left undefined, spamd will use its default of 5
Default value: undef
razor_home
Data type: Stdlib::Absolutepath
Define the homedir for razor. Please note that if you set a custom path the module will automatically use the directory in which you store your razor config as the home directory for the module. Default is to use the [global config dir]/.razor
Default value: $spamassassin::params::razor_home
spamcop_enabled
Data type: Boolean
Enable/disable the Pyzor plugin.
Default value: false
spamcop_from_address
Data type: Optional[String]
This address is used during manual reports to SpamCop as the From: address. You can use your normal email address. If this is not set, a guess will be used as the From: address in SpamCop reports.
Default value: undef
spamcop_to_address
Data type: Optional[String]
Your customized SpamCop report submission address. You need to obtain this address by registering at http://www.spamcop.net/. If this is not set, SpamCop reports will go to a generic reporting address for SpamAssassin users and your reports will probably have less weight in the SpamCop system.
Default value: undef
spamcop_max_report_size
Data type: Optional[Integer]
Messages larger than this size (in kilobytes) will be truncated in report messages sent to SpamCop. The default setting is the maximum size that SpamCop will accept at the time of release. If left undefined, spamd uses its default of 50
Default value: undef
awl_enabled
Data type: Boolean
Enable/disable the Auto-Whitelist plugin.
Default value: false
awl_sql_enabled
Data type: Boolean
If true will set auto_whitelist_factory to use sql and will write the sql dsn, and other directives, to local.cf.
Default value: false
awl_dsn
Data type: String
This parameter gives the connect string used to connect to the SQL based storage. By default will use the mysql driver and a database called spamassassin. Please note the module does not manage any database settings or the creation of the schema.
Default value: 'DBI:mysql:spamassassin'
awl_sql_username
Data type: String
The sql username used for the dsn provided above.
Default value: 'root'
awl_sql_password
Data type: Optional[String]
The sql password used for the dsn provided above.
Default value: undef
awl_sql_override_username
Data type: Optional[String]
Used by the SQLBasedAddrList storage implementation. If this option is set the SQLBasedAddrList module will override the set username with the value given. This can be useful for implementing global or group based auto-whitelist databases.
Default value: undef
auto_whitelist_path
Data type: Optional[String]
See auto_welcomelist_path
. Note that the option was renamed to
auto_welcomelist_path
in spamassassin 4.0.x. auto_whitelist_path
is
still valid with 4.0.x, but is planned to be removed in 4.1.x.
Default value: undef
auto_welcomelist_path
Data type: Optional[String]
This is the automatic-welcomelist directory and filename. By default, each
user has their own welcomelist database in their ~/.spamassassin directory
with mode 0700. For system-wide SpamAssassin use, you may want to share this
across all users, although that is not recommended. If left undefined, spamd
will use its default value of ~/.spamassassin/auto-whitelist
.
Default value: undef
auto_whitelist_file_mode
Data type: Optional[String]
See auto_welcomelist_file_mode
. Note that this option was renamed to
auto_welcomelist_file_mode
in spamassassin 4.0.x.
auto_whitelist_file_mode
is still valid with 4.0.x, but is planned to be
removed in 4.1.x.
Default value: undef
auto_welcomelist_file_mode
Data type: Optional[String]
The file mode bits used for the automatic-whitelist directory or file. Make
sure you specify this using the 'x' mode bits set, as it may also be used to
create directories. However, if a file is created, the resulting file will
not have any execute bits set (the umask is set to 0111). If left undefined,
spamd will use its default of 0700
.
Default value: undef
textcat_enabled
Data type: Boolean
Enable/disable the TextCat plugin.
Default value: false
ok_languages
Data type: Array[String]
List of languages which are considered okay for incoming mail. If unset, defaults to accepting all languages.
Default value: ['all']
ok_locales
Data type: Array[String]
List of charsets that are permitted. If unset, defaults to accepting all locales.
Default value: ['all']
normalize_charset
Data type: Boolean
Enable/disable scanning non-UTF8 or non-ASCII parts to guess charset.
Default value: false
shortcircuit_enabled
Data type: Boolean
Enable/disable the Shortcircuit plugin.
Default value: false
shortcircuit_user_in_whitelist
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
shortcircuit_user_in_def_whitelist
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
shortcircuit_user_in_all_spam_to
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
shortcircuit_subject_in_whitelist
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
shortcircuit_user_in_blacklist
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
shortcircuit_user_in_blacklist_to
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
shortcircuit_subject_in_blacklist
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
shortcircuit_all_trusted
Data type: Optional[Enum['ham','spam','on','off']]
Values: ham, spam, on or off.
Default value: undef
dkim_enabled
Data type: Boolean
Enable/disable the DKIM plugin.
Default value: true
dkim_timeout
Data type: Optional[Integer]
How many seconds to wait for a DKIM query to complete, before scanning continues without the DKIM result. If left undefined, spamd will use its default value of 3.5
Default value: undef
rules2xsbody_enabled
Data type: Boolean
Enable the Rule2XSBody plugin. Compile ruleset to native code with sa-compile. Requires re2c and gcc packages (not managed in this module)
Default value: false
custom_rules
Data type: Hash
Define custom rules. This is a hash of hashes. The key for the outer hash is the spamassassin rule name, the inner hash for each entry should contain the rule definition, e.g:
spamassassin::custom_rules: INVOICE_SPAM: body: '/Invoice.from.You have received an invoice from .* To start with it, print out or download a JS copy of your invoice/' score: 6 describe: 'spam reported claiming "You have received an invoice"'
Default value: {}
custom_config
Data type: Array[String]
Add custom lines to the config file. Useful for configuring modules that aren't otherwise handled by this Puppet module. This is an array of strings, e.g:
spamassassin::custom_config:
- hashcash_accept *@example.com
- hashcash_accept *@example.net
Default value: []
Dependencies
- puppetlabs/stdlib (>= 4.25.0 < 10.0.0)
Copyright (C) 2014 Scott Barr <gsbarr@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.