zuazo/spamassassin-cookbook

View on GitHub
templates/default/local.cf.erb

Summary

Maintainability
Test Coverage
# Generated by Chef

# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
# tweaked.
#
# Only a small subset of options are listed below
#
###########################################################################

<% @conf['rewrite_headers'].each do |rewrite_header|
     rewrite_header.sort.each do |header, value|
-%>
rewrite_header <%= header %> <%= value %>
<%   end
   end
-%>

#   Save spam messages as a message/rfc822 MIME attachment instead of
#   modifying the original message (0: off, 2: use text/plain instead)
#
report_safe <%= SpamAssassinCookbook::Conf.value(@conf['report_safe']) %>


#   Set which networks or hosts are considered 'trusted' by your mail
#   server (i.e. not spammers)
#
<% unless @conf['trusted_networks'].nil? -%>
trusted_networks <%= SpamAssassinCookbook::Conf.value(@conf['trusted_networks']) %>
<% else -%>
# trusted_networks 212.17.35.
<% end -%>


#   Set file-locking method (flock is not safe over NFS, but is faster)
#
<% unless @conf['lock_method'].nil? -%>
lock_method <%= SpamAssassinCookbook::Conf.value(@conf['lock_method']) %>
<% else -%>
# lock_method flock
<% end -%>


#   Set the threshold at which a message is considered spam (default: 5.0)
#
required_score <%= SpamAssassinCookbook::Conf.value(@conf['required_score'].to_f) %>


#   Use Bayesian classifier (default: 1)
#
<% unless @conf['use_bayes'].nil? -%>
use_bayes <%= SpamAssassinCookbook::Conf.value(@conf['use_bayes']) %>
<% else -%>
# use_bayes 1
<% end -%>


#   Bayesian classifier auto-learning (default: 1)
#
<% unless @conf['bayes_auto_learn'].nil? -%>
bayes_auto_learn <%= SpamAssassinCookbook::Conf.value(@conf['bayes_auto_learn']) %>
<% else -%>
# bayes_auto_learn 1
<% end -%>


#   Set headers which may provide inappropriate cues to the Bayesian
#   classifier
#
# bayes_ignore_header X-Bogosity
# bayes_ignore_header X-Spam-Flag
# bayes_ignore_header X-Spam-Status
<% @conf['bayes_ignore_headers'].each do |bayes_ignore_header| -%>
bayes_ignore_header <%= bayes_ignore_header %>
<% end -%>

<% @conf['plugins'].to_hash.sort.each do |plugin, values_ary| -%>
ifplugin Mail::SpamAssassin::Plugin::<%= plugin.capitalize %>
<%   next unless values_ary.kind_of?(Array)
     values_ary.each do |values| -%>
<%     next unless values.kind_of?(Hash)
       values.sort.each do |option, value| -%>
  <%=    plugin.downcase %> <%= option.upcase %> <%= value %>
<%     end
     end
-%>
endif # ifplugin Mail::SpamAssassin::Plugin::<%= plugin.capitalize %>
<% end -%>

# Additional local rules
<% @conf['localrules'].each do |rule| -%>
<%= rule %>
<% end %>