Hallo,
habe ein Problem das meine Mails weder getaggt noch markiert werden (Subject ***SPAM).
Es hat mit der untenstehenden Konfig funktioniert aber nun klappt es nicht mehr.
System ist OpenSuse 11.0 mit Postfix, Amavis-new, Cyrus
In /var/log/mail stehen die Hits sauber drin aber in den Mailheadern fehlt es.
Wo muss ich ansetzen?
habe ein Problem das meine Mails weder getaggt noch markiert werden (Subject ***SPAM).
Es hat mit der untenstehenden Konfig funktioniert aber nun klappt es nicht mehr.
System ist OpenSuse 11.0 mit Postfix, Amavis-new, Cyrus
In /var/log/mail stehen die Hits sauber drin aber in den Mailheadern fehlt es.
Wo muss ich ansetzen?
Code:
Pakete installieren:
spamassassin, amavis, razor, clamav
----------------------
Postfix Configuration
----------------------
This section describes how to configure Postfix to use amavisd-new as an after-queue content filter (see the [WWW] FILTER_README file that comes with your version of Postfix).
First, a few services must be defined in master.cf. The first service will setup an extra SMTP listener on a different port (10025 in this example). It will be used for the reinjection of mail back into Postfix. By unsetting the content_filter parameter, content filtering will be disabled for incoming mail on this port. This avoids loops.
127.0.0.1:10025 inet n - y - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
The second service added is not strictly necessary, but is a good idea to have. It defines a service to use when sending the mail into amavisd-new. The "2" in the seventh column is the maximum number of processes of this type. Do not set this number too high, and make sure it is equal to the maximum number of amavisd-new processes (set in amavis.conf).
smtp-amavis unix - - y - 2 smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookups=yes
Finally, we must configure Postfix to actually use our content filter. This is done with the content_filter parameter which we add to main.cf. We configure Postfix to use our newly defined smtp-amavis service and to connect to a certain host and certain port. Obviously, the port set here must be the port amavisd-new is listening to.
content_filter = smtp-amavis:[127.0.0.1]:10026
In this case, amavisd-new is running on the same host as Postfix, but it can be any host. With brackets surrounding the hostname, MX lookups of the hostname are suppressed. They are also necessary when specifying bare IP addresses instead of a hostname. MX records in DNS can be used to create simple load-balancing and fallback configurations.
This simple setup will cause address rewriting both before and after the content filter. For most configurations this is only unnecessary, but configurations with virtual aliases of the form a -> a,b will cause duplicate mail to be delivered. Virtual rewriting must be turned off either before or after the content filter. How this is done is, again, documented in the [WWW] FILTER_README file of your Postfix.
Amavis configuration
Amavis is just used for spam detection, not virus protection. See the options below.
-------------------
/etc/amavisd.conf
-------------------
Change the following options:
- $mydomain = 'example.com'
*
Change 'example.com' to 'domain1.com'
- @bypass_virus_checks_acl . . . .
*
Change to @bypass_virus_checks_acl = qw( . );
We only want spam protection and no virus scanning, so this will disable virus scanning for all your domains.
- $mailfrom_notify_spamadmin . . .
*
Change "spam.police\@$mydomain"; to "postmaster\@domain1.com";
- #$spam_quarantine_to = 'spam-quarantine';
and insert a # symbol at the beginning of that line On the very next line, you'll see:
#$spam_quarantine_to = "spam-quarantine\@$mydomain";
Here, remove the leading # symbol. (And make sure you have an emailbox for this address on a destination server - This is where you will review quarantined emails, and will forward on any "false positives" to the proper recipient.) *Alternative:* Instead of delivering the spam to an emailbox on the internal server, drop it into a folder right on the spamfilter. To do that, comment out the "spam_quarantine_to" line above that references the email address, and instead select and indicate a folder name for the value "spam_quarantine_to". (Read the comments in this area of amavisd.conf for more info.)
Go to the chapter # SpamAssassin settings When you run SpamAssassin with Amavis, you have to do most of the configuration in amavisd.conf.
See [WWW] http://www.ijs.si/software/amavisd/#faq-spam for details.
- $sa_local_tests_only = 0;
*
If you want to use Razor, this has to be set to 0.
- $sa_tag_level_deflt = -999;
*
The number of hits needed to update the mail headers. With a value of -999 all headers will be updatedt with X_Spam_Flag, X_Spam_Level and X_Spam_Status
- $sa_tag2_level_deflt = 5.0;
*
The number of hits required to set X_Spam_Flag to Yes.
- $sa_spam_subject_tag = '***SPAM*** ';
*
Remove the # if you want ***SPAM*** to be added to the subject of spam mails.
---------------------------
SpamAssassin configuration (ACHTUNG �ndert sich st�ndig) siehe Beispieldatei
---------------------------
Go to /etc/mail/spamassassin and edit local.cf. My file looks like this.
Be sure to doublecheck this options with amavisd.conf. If one of these options is in amavisd.conf, the one in local.cf will not be used.
# Add your own customisations to this file. See 'man Mail::SpamAssassin::Conf'
# for details of what can be tweaked.
#
# How many hits before a message is considered spam.
required_hits 5.0
# Whether to change the subject of suspected spam
rewrite_subject 0
# Text to prepend to subject if rewrite_subject is used
subject_tag *****SPAM*****
# Encapsulate spam in an attachment
report_safe 1
# Use terse version of the spam report
use_terse_report 0
# Enable the Bayes system
use_bayes 1
# Enable Bayes auto-learning
auto_learn 1
# Enable or disable network checks
skip_rbl_checks 0
use_razor2 1
use_dcc 0
use_pyzor 0
# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_languages all
# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales all
-----------------
RAZOR CONFIG:
-----------------
razor-admin -create -home=/var/spool/amavis/.razor
razor-admin -register
*
Creates a random user name and password. Necessary for data access to Razor2 servers.
razor-admin -discover
*
Refreshes the list of razor servers
Evtl. noch
cp -r /root/.razor /var/spool/amavis
chown -R vscan:vscan /var/spool/amavis/.razor
*
Now amavis owns it.
DEBUGGING UND FEHLERBEHEBUNG
Um die ListenDB nochmal zu reparieren
sa-learn -D --sync