spam filter to strict?

Henning henne.gwath at gmx.de
Wed May 7 21:24:48 CEST 2014


Hi,

you have to setup amavis correctly in /etc/amavis/conf.d/40-kolab.

The setting you have to adjust is
$sa_tag_level_deflt  = undef;
so that all mail will get X-Spam headers added.

Attached, I share my config, which needs a shared/Spam at domain.com folder
setup and redirects Spam to this folder and to the Spam-Folder in the
user's inbox (if not present, it will get directly to the user's inbox).

Of course you have to setup spamassassins local.cf and I recommend to
setup pyzor, razor and maybe dcc additionally and add them to spamassassin.

Check out
http://laclaro.wordpress.com/2014/02/22/fighting-spam-with-amavis/ there
I pretty much covered everything in more detail. You find the article
also in the kolab planet, but with less color and stuff :)

regards,
Henning


Am 07.05.2014 19:54, schrieb Kolab, User:
> Hi Folks!
> 
> I use spamassassin and trained it like described on docs.kolab.org.
> Now I send an email to kolab which is definitely no spam and it gets
> blocked.
> 
> How can I find out why a certain mail got blocked?
> 
> Thank you!
-------------- next part --------------
# this file is automatically written by the Kolab config backend
# manual additions are lost unless made to the template in the Kolab config directory

use strict;

##
## Kolab
##
$local_domains_re = new_RE( qr'.*' );
#@local_domains_maps = ( ["domain.eu", "domain.de", "domain.net"] );
$recipient_delimiter = '+';
$addr_extension_spam = 'Spam';
$final_spam_destiny   = D_PASS;  # pass spam to local recipients to user+Spam at domain.com

# threshold and tagging
$sa_local_tests_only = 0;     # only tests which do not require internet access?
$sa_tag_level_deflt  = undef; # all mail gets X-Spam headers
$sa_tag2_level_deflt = 7.00;  # add 'spam detected' headers at that level
#$sa_spam_subject_tag = '*** SPAM *** ';
$sa_spam_subject_tag = undef;
$sa_kill_level_deflt = 7.00;  # foreward spam to final_*_destiny
$sa_mail_body_size_limit = 256*1024; # 256kB, don't waste time on SA if mail is larger

# discard highly rated spam and virus mail, sending a copy to the quarantine-address 
#$final_spam_destiny   = D_DISCARD;  # discard spam, reching kill-level
$final_virus_destiny  = D_DISCARD; # discard virus mail
$final_banned_destiny = D_BOUNCE; # send bounced-message to sender
$final_bad_header_destiny = D_PASS; # let invalid header-messages pass

$spam_quarantine_to = 'shared+shared/Spam at domain.eu';
$virus_quarantine_to = 'shared+shared/Virus at domain.eu';

# reinjection path
$notify_method  = 'smtp:[127.0.0.1]:10025'; # notifications about scanned messages
$forward_method = $notify_method; # scanned messages

# what was this for?
$spam_admin = "kolab-admin\@domain.eu";
$spam_lovers{lc("kolab-admin\@domain.eu")} = 1;
$virus_admin = "kolab-admin\@domain.eu";

# LOGGING
#$log_level = 0;
#$SYSLOG_LEVEL = 'mail.debug';
$DO_SYSLOG = 1;
$LOGFILE = "/var/log/amavis.log"; # (defaults to empty, no log)
#$sa_debug = 1;

1;

-------------- next part --------------
#!/bin/bash
########################################################################
#    Name: sa-learn-cronjob, Author: Henning Hollermann,                #
#    laclaro at mail.com, http://laclaro.wordpress.com                    #
#                                                                      #
#    This program is free software: you can redistribute it and/or     #
#    modify it under the terms of the GNU General Public License       #
#    as published by the Free Software Foundation, either version 3    #
#    of the License, or (at your option) any later version             #
#                                                                      #
#    This program is distributed in the hope that it will be useful,   #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of    #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the      #
#    GNU General Public License for more details.                      #
#                                                                      #
#    You should have received a copy of the GNU General Public License #
#    along with this program. If not, see <http://gnu.org/licenses/>.  #
#                                                                      #
#    Bash script that finds folders associated with spam or ham within #
#    the mail spool directory and runs sa-learn on each of them.       #
#    The script is intended to be daily as a cronjob.                  #
#                                                                      #
########################################################################


# mail spool
MAILSPOOL=/var/spool/imap/domain/d/domain.eu
SPAM=$(find $MAILSPOOL/ -name "*Junk*" -o -name "*Spam*" |grep -v DELETED)
HAM="$(find $MAILSPOOL/ -name *Ham* |grep -v DELETED)"
MOREHAM="$(find $MAILSPOOL/ -name "*Familie und*" -o -name "*Archiv*" |grep -v DELETED)"
MORESPAM=""

# function sa_learn to learn about ham or spam from given directories
# $1    keywords "spam" or "ham"
# $2-$X directories to examine
sa_learn() {
  case $1 in
      ham)  TYPE="ham";;
      spam) TYPE="spam";;
      *)    exit 1;;
  esac;
  # drop ham or spam option
  shift;
  # use linebreak, not whitespace as for-loop-separator
  IFS=$'\012';
  # learn from given directories
  for dir in $*; do
      if [ -d "$dir" ]; then
          echo "Learning from $dir what $TYPE looks like"
          sa-learn --$TYPE "$dir"/[0-9]*;
      fi
  done
  # restore separator
  IFS=$' ';
}

# learn about spam
sa_learn "spam" "$SPAM"
# learn about ham
sa_learn "ham" "$HAM"

# monthly on the 16th learn about more ham and spam
if [ "$(date +%d)" = 16 ]; then
    sa_learn "spam" "$MORESPAM"
    sa_learn "ham"  "$MOREHAM"
fi



More information about the users mailing list