Amavis
$ apt-get install amavisd-new spamassassin razor pyzor lha arj unrar unzip zoo zip bzip2 lzop cpio nomarch file
Nötige Anpassungen zu den Standardwerten von Debian sarge in /etc/amavis/amavisd.conf
$mydomain = 'domain.tld'; # (no useful default)
$myhostname = 'me.domain.tld'; # fqdn of this host, default by uname(3)
@local_domains_acl = qw( .domain.tld .localhost );
$inet_socket_port = 10024; # accept SMTP on this local TCP port
$final_virus_destiny = D_DISCARD; # (defaults to D_BOUNCE)
$final_banned_destiny = D_BOUNCE; # (defaults to D_BOUNCE)
$final_spam_destiny = D_PASS; # (defaults to D_REJECT)
$final_bad_header_destiny = D_PASS; # (defaults to D_PASS), D_BOUNCE suggested
$virus_admin = "abuse\@$mydomain";
$spam_admin = "abuse\@$mydomain";
$mailfrom_notify_spamadmin = "postmaster\@$mydomain";
$sa_local_tests_only = 0; # (default: false)
$sa_auto_whitelist = 1; # turn on AWL (default: false)
$sa_timeout = 30; # timeout in seconds for a call to SpamAssassin
$sa_mail_body_size_limit = 150*1024; # don't waste time on SA is mail is larger
$sa_tag_level_deflt = -999; # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 4.0; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 40.0; # triggers spam evasive actions
# at or above that level: bounce/reject/drop,
# quarantine, and adding mail address extension
$sa_dsn_cutoff_level = 10.0; # spam level beyond which a DSN is not sent,
# effectively turning D_BOUNCE into D_DISCARD;
# undef disables this feature and is a default;
$sa_spam_subject_tag = '[--=SPAM=--] '; # (defaults to undef, disabled)
# (only seen when spam is not to be rejected
# and recipient is in local_domains*)
$sa_spam_modifies_subj = 1; # may be a ref to a lookup table, default is true
Postfix
Entsprechend muss postfix an amavis angeschlossen werden (/etc/postfix/main.cf):
content_filter = smtp-amavis:[127.0.0.1]:10024
Ausserdem muss auch /etc/postfix/master.cf angepasst werden:
127.0.0.1:10025 inet n - y - - smtpd
-o content_filter=
-o local_recipient_maps=
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject_unauth_destination
-o mynetworks=127.0.0.0/8
smtp-amavis unix - - y - 2 smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookups=yes
Spamassassin
/etc/spamassassin/local.cf
# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
# tweaked.
#
###########################################################################
# How many hits before a message is considered spam.
# (required_score by amavis: sa_tag2_level_deflt)
#required_score 4.0
# whitelist
#whitelist_from *@domain.tld
# (auto_whitelist by amavis: sa_auto_whitelist)
#use_auto_whitelist 1
#auto_whitelist_path /var/spool/spamassassin/auto-whitelist
#auto_whitelist_file_mode 0644
#auto_whitelist_factor 0.03
# blacklist
#blacklist_from *@other.domain.tld
# Whether to change the subject of suspected spam
# (rewrite_header set by amavis: sa_spam_subject_tag, sa_spam_modifies_subj)
#rewrite_header subject *****SPAM: _SCORE_*****
add_header spam Flag _YESNOCAPS_
add_header all Status _YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_
add_header all Level _STARS(*)_
add_header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_
# Encapsulate spam in an attachment
report_safe 2
#always_add_report 1
# Use terse version of the spam report
#use_terse_report 0
# bayes
use_bayes 1
#bayes_path /var/lib/amavis/.spamassassin/bayes
#bayes_use_chi2_combining 1
#bayes_file_mode 0644
bayes_auto_learn 1
bayes_auto_learn_threshold_nonspam 0.2
bayes_auto_learn_threshold_spam 10
#bayes_auto_expire 0
bayes_journal_max_size 200000 # default: 102400 size
bayes_expiry_max_db_size 600000 # default: 150000 tokens
bayes_min_ham_num 200
bayes_min_spam_num 200
bayes_ignore_header X-purgate
bayes_ignore_header X-purgate-ID
bayes_ignore_header X-purgate-Ad
bayes_ignore_header X-GMX-Antispam
bayes_ignore_header X-Antispam
bayes_ignore_header X-Spamcount
bayes_ignore_header X-Spamsensitivity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
bayes_ignore_header X-Spam-Level
bayes_ignore_header X-Sieve
bayes_ignore_header X-WEBDE-FORWARD
# network checks
# (amavis: sa_local_tests_only)
skip_rbl_checks 0
use_razor2 1
use_dcc 0
use_pyzor 1
rbl_timeout 4
# dcc konfiguration
#dcc_path /usr/bin/dccproc
#dcc_add_header 1
#dcc_home /var/lib/dcc
# pyzor konfiguration
pyzor_path /usr/bin/pyzor
pyzor_add_header 1
pyzor_max 3
#trusted_networks 192.168/16 127/8 # all in 192.168.*.* and 127.*.*.*
dns_available yes
#check_mx_attempts 0
#check_mx_delay 1
#lock_method flock
#allow_user_rules 0
# Mail using languages used in these country codes will not
# be marked as being possibly spam in a foreign language.
ok_languages de en
# Mail using locales used in these country codes will not
# be marked as being possibly spam in a foreign language.
ok_locales en
# spamcop punkte
#uri SPAMCOP_URI_RBL eval:check_spamcop_uri_rbl('sc.surbl.org','127.0.0.2')
#describe SPAMCOP_URI_RBL URI's domain appears in spamcop database at sc.surbl.org
#tflags SPAMCOP_URI_RBL net
#score SPAMCOP_URI_RBL 5.0
## SCORE
score ALL_TRUSTED 0
# razor
score RAZOR2_CHECK 2.5
score RAZOR2_CF_RANGE_11_50 0.32
score RAZOR2_CF_RANGE_51_100 3.0
# dcc
score DCC_CHECK 4.9
# pyzor
score PYZOR_CHECK 4.8
# bayes
score BAYES_00 -6.1
score BAYES_01 -5.0
score BAYES_10 -3.5
score BAYES_20 -2.0
score BAYES_30 -1.0
score BAYES_40 -0.3
score BAYES_44 -0.01
score BAYES_50 0.01
score BAYES_56 0.3
score BAYES_60 1.0
score BAYES_70 1.6
score BAYES_80 3.1
score BAYES_90 5.2
score BAYES_99 7.2
# other
#score SUBJ_ILLEGAL_CHARS 2.6
#score PORN_4 3.7
#score RCVD_IN_RFCI 2.0
#score RCVD_IN_ORBS 1.0
#score RCVD_IN_DSBL 1.0
#score RCVD_IN_SBL 0.5
#score RCVD_IN_VISI 1.0
#score RCVD_IN_RFCI 0.5
#score RCVD_IN_SORBS 0.5
#score X_NJABL_OPEN_PROXY 0.5
#score RCVD_IN_UNCONFIRMED_DSBL 0.2
#score RCVD_IN_BL_SPAMCOP_NET 1.1
#score RCVD_IN_VISI 0.3
#score RCVD_IN_RELAYS_ORDB_ORG 0.3
#score USER_AGENT_MACOE 1.0
#score NIGERIAN_TRANSACTION_1 1.5
#score MICROSOFT_EXECUTABLE 3.100
#score MIME_SUSPECT_NAME 3.100
#score RCVD_IN_BONDEDSENDER -6.0
#score HABEAS_HIL RBL -6.0
#score X_LIST_UNSUBSCRIBE 0.5
#score EMAIL_ATTRIBUTION -0.5
#score IN_REP_TO -0.5
#score QUOTED_EMAIL_TEXT -0.5
#score REPLY_WITH_QUOTES -0.5
#score HTML_IMAGE_ONLY_02 1.978
#score HTML_IMAGE_ONLY_04 2.087
#score HTML_IMAGE_ONLY_06 1.228
#score HTML_IMAGE_ONLY_08 0.984
#score HTML_IMAGE_ONLY_10 0.843
#score HTML_IMAGE_ONLY_12 0.487
#score EMAIL_ATTRIBUTION -1
#score MSGID_GOOD_EXCHANGE -1
Die Bayes-db muss in der Standardeinstellung mindestens 200 Ham- und 200 Spam-Mails enthalten, damit Bayes eingesetzt wird.
Lernen von Ham:
$ sa-learn --ham --dbpath /var/lib/amavis/.spamassassin/ /var/mail/$USER/Maildir/hamordner
Lernen von Spam:
$ sa-learn --spam --dbpath /var/lib/amavis/.spamassassin/ /var/mail/$USER/Maildir/spamordner
Razor
$ razor-admin -d -create -home=/var/lib/amavis/.razor
$ razor-admin -d -register
Antivirus
Hier hat man die freie Wahl. Pakete gibt es direkt für clamav und f-prot (installer).
Von Bitdefender kann ein Konsolenscanner als deb von der Homepage heruntergeladen werden.
Amavis kann auch mehrere Scanner nacheinander nutzen.
Für die Einrichtung muss man bei vielen nichts weiter tun als sie zu installieren.
(In der amavisd.conf steht, welche erkannt und wie genutzt werden.)
Sollte das Paket kein automatisches Update über cron mitbringen, muss man das selbst mittels cron-Eintrag erledigen.