Postfix - problem ze Spamassassinem

Konfiguracja serwerów, usług, itp.
MMM
Posty: 4
Rejestracja: 03 kwietnia 2008, 15:34

Postfix - problem ze Spamassassinem

Post autor: MMM »

Witam,
jako ze jest to moj pierwszy post, chcialbym sie przywitac.

Mam za zadanie zainstalowac serwer postfix z filtrem antyspamowym i antywirusowym. Zainstalowalem wszystko wg. opisu znalezionego na stronie howtoforge, jednak i generalnie wszystko dziala oprocz spamassassina - do maila nie sa doklejane naglowki (jedynym doklejanym naglowkiem jest X-Virus-Scanned). Przekopalem sie przez goolgla, przez watki tego forum (problemy byly podobne, ale nie pomogly), zatem prosze o pomoc.

Tutaj jest fragment logu:

Kod: Zaznacz cały

Apr  3 15:25:34 VirtualDebian postfix/pickup[2652]: EA6893EC3C: uid=1001 from=<janusz>
Apr  3 15:25:35 VirtualDebian postfix/cleanup[2821]: EA6893EC3C: message-id=<20080403132534.EA6893EC3C@a.pl>
Apr  3 15:25:35 VirtualDebian postfix/qmgr[2651]: EA6893EC3C: from=<janusz@a.pl>, size=269, nrcpt=1 (queue active)
Apr  3 15:25:35 VirtualDebian postfix/smtpd[2826]: connect from localhost[127.0.0.1]
Apr  3 15:25:35 VirtualDebian postfix/smtpd[2826]: 7054C3EC32: client=localhost[127.0.0.1]
Apr  3 15:25:35 VirtualDebian postfix/cleanup[2821]: 7054C3EC32: message-id=<20080403132534.EA6893EC3C@a.pl>
Apr  3 15:25:35 VirtualDebian postfix/qmgr[2651]: 7054C3EC32: from=<janusz@a.pl>, size=689, nrcpt=1 (queue active)
Apr  3 15:25:35 VirtualDebian postfix/local[2827]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Apr  3 15:25:35 VirtualDebian postfix/smtpd[2826]: disconnect from localhost[127.0.0.1]
Apr  3 15:25:35 VirtualDebian postfix/local[2827]: 7054C3EC32: to=<marcin@a.pl>, relay=local, delay=0.17, delays=0.08/0.05/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)
Apr  3 15:25:35 VirtualDebian postfix/qmgr[2651]: 7054C3EC32: removed
Apr  3 15:25:35 VirtualDebian amavis[2409]: (02409-02) Passed CLEAN, <janusz@a.pl> -> <marcin@a.pl>, Message-ID: <20080403132534.EA6893EC3C@a.pl>, mail_id: KifgbZ03EHea, Hits: -, queued_as: 7054C3EC32, 561 ms
Apr  3 15:25:35 VirtualDebian postfix/smtp[2823]: EA6893EC3C: to=<marcin@a.pl>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.75, delays=0.1/0.04/0.04/0.56, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=02409-02, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 7054C3EC32)
Apr  3 15:25:35 VirtualDebian postfix/qmgr[2651]: EA6893EC3C: removed
20-debian_defaults

Kod: Zaznacz cały

$sa_spam_subject_tag = '***SPAM*** ';
$sa_tag_level_deflt  = 0.0;  # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 6.31; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 6.31; # triggers spam evasive actions
$sa_dsn_cutoff_level = 10;   # spam level beyond which a DSN is not sent

$sa_mail_body_size_limit = 200*1024; # don't waste time on SA if mail is larger
$sa_local_tests_only = 0;    # only tests which do not require internet access?

$final_virus_destiny      = D_DISCARD;  # (data not lost, see virus quarantine)
$final_banned_destiny     = D_BOUNCE;   # D_REJECT when front-end MTA
$final_spam_destiny       = D_PASS;
$final_bad_header_destiny = D_PASS;     # False-positive prone (for spam)
fragment 15-contetn_filter_mode

Kod: Zaznacz cały

@bypass_virus_checks_maps = (
   \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
@bypass_spam_checks_maps = (
   \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
fragment master.cf

Kod: Zaznacz cały

smtp      inet  n       -       -       -       -       smtpd

amavis	unix	-	-	-	-	2	smtp
	-o smtp_data_done_timeout=1200
	-o smtp_send_xforward_command=yes

127.0.0.1:10025	inet	n	-	-	-	-	smtpd
	-o content_filter=
	-o local_recipient_maps=
	-o relay_recipient_maps=
	-o smtpd_restriction_classes=
	-o smtpd_client_restrictions=
	-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
	-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
	-o smtpd_bind_address=127.0.0.1
local.cf

Kod: Zaznacz cały

# 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
#
########################

#   Add *****SPAM***** to the Subject header of spam e-mails
#
rewrite_header Subject *****SPAM*****


#   Save spam messages as a message/rfc822 MIME attachment instead of
#   modifying the original message (0: off, 2: use text/plain instead)
#
report_safe 0


#   Set which networks or hosts are considered 'trusted' by your mail
#   server (i.e. not spammers)
#
# trusted_networks 212.17.35.


#   Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock


#   Set the threshold at which a message is considered spam (default: 5.0)
#
required_score 5.0


#   Use Bayesian classifier (default: 1)
#
use_bayes 1


#   Bayesian classifier auto-learning (default: 1)
#
bayes_auto_learn 1


#   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

# dcc
#use_dcc 1
#dcc_path /usr/bin/dccproc
#dcc_add_header 1
#dcc_dccifd_path /usr/sbin/dccifd

# pyzor
#use_pyzor 1
#pyzor_path /usr/bin/pyzor
#pyzor_add_header 1

# razor
#use_razor2 1
#razor_config /etc/razor/razor-agent.conf

# bayes
#use_bayes 1
#use_bayes_rules 1
#bayes_auto_learn 1

Kod: Zaznacz cały

# /etc/default/spamassassin
# Duncan Findlay

# WARNING: please read README.spamd before using.
# There may be security risks.

# Change to one to enable spamd
ENABLED=1

# Options
# See man spamd for possible options. The -d option is automatically added.

# SpamAssassin uses a preforking model, so be careful! You need to
# make sure --max-children is not set to anything higher than 5,
# unless you know what you're doing.

OPTIONS="--create-prefs --max-children 5 --helper-home-dir"

# Pid file
# Where should spamd write its PID to file? If you use the -u or
# --username option above, this needs to be writable by that user.
# Otherwise, the init script will not be able to shut spamd down.
PIDFILE="/var/run/spamd.pid"

# Set nice level of spamd
#NICE="--nicelevel 15"

# Cronjob
# Set to anything but 0 to enable the cron job to automatically update
# spamassassin's rules on a nightly basis
CRON=0
Z gory dziekuje za odpowiedzi.
vikus
Beginner
Posty: 103
Rejestracja: 15 października 2007, 20:00

Post autor: vikus »

/etc/amavis/conf.d/20-debian_defaults

Kod: Zaznacz cały

$sa_tag_level_deflt  = -100;
MMM
Posty: 4
Rejestracja: 03 kwietnia 2008, 15:34

Post autor: MMM »

Dzięki za szybką odpowiedź.
Niestety zmiana ta nie spowodowała doklejania tych nagłówków.
To chyba wygląda tak, jakby spamassassin się nie uruchamiał, ale nie mam pojęcia, dlaczego.
vikus
Beginner
Posty: 103
Rejestracja: 15 października 2007, 20:00

Post autor: vikus »

pokaz naglowek maila
MMM
Posty: 4
Rejestracja: 03 kwietnia 2008, 15:34

Post autor: MMM »

Kod: Zaznacz cały

Return-Path: <janusz@a.pl>
X-Original-To: [email]marcin@a.pl[/email]
Delivered-To: [email]marcin@a.pl[/email]
Received: from localhost (localhost [127.0.0.1])
	by a.pl (Postfix) with ESMTP id DDD243EBED
	for <marcin@a.pl>; Fri,  4 Apr 2008 10:24:50 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at VirtualDebian.AlphaNet
Received: from a.pl ([127.0.0.1])
	by localhost (VirtualDebian.AlphaNet [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 89IDybtat0YY for <marcin@a.pl>;
	Fri,  4 Apr 2008 10:24:43 +0200 (CEST)
Received: by a.pl (Postfix, from userid 1001)
	id 653F13EC0E; Fri,  4 Apr 2008 10:24:43 +0200 (CEST)
To: [email]marcin@a.pl[/email]
Subject: TEST TERAZ
Message-Id: <20080404082443.653F13EC0E@a.pl>
Date: Fri,  4 Apr 2008 10:24:43 +0200 (CEST)
From: [email]janusz@a.pl[/email]
vikus
Beginner
Posty: 103
Rejestracja: 15 października 2007, 20:00

Post autor: vikus »

wyslij sobie takie mail i sprawdz logi czy zostal odbity

Kod: Zaznacz cały

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
MMM
Posty: 4
Rejestracja: 03 kwietnia 2008, 15:34

Post autor: MMM »

Mam ustawiony

Kod: Zaznacz cały

$final_spam_destiny       = D_PASS; 
wiec nie zostanie odbity - zalezy mi na tym, by spam doszedl a zostaly doklejone odpowiednie naglowki do wiadomosci.

W logu pojawia się coś takiego:

Kod: Zaznacz cały

Apr  4 18:59:08 VirtualDebian amavis[2007]: (02007-01) Passed SPAM, LOCAL [127.0.0.1] [127.0.0.1] <marcin@a.pl> -> <janusz@a.pl>, quarantine: spam-1ZBFcArJUfmj.gz, Message-ID: <47F65E4F.2040909@a.pl>, mail_id: 1ZBFcArJUfmj, Hits: 1003.308, queued_as: 08CDF3EBED, 7380 ms
Apr  4 18:59:08 VirtualDebian postfix/smtp[2474]: 5F9343EBB0: to=<janusz@a.pl>, relay=127.0.0.1[127.0.0.1]:10024, delay=8.2, delays=0.62/0.09/0.1/7.4, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=02007-01, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 08CDF3EBED)
Czyli jest identyfikowane jako spam, światełko w tunelu. Nagłówków niestety nie ma :( (pomimo ustawienia sa_tag_level_deflt na -100)
kane2002
Posty: 22
Rejestracja: 07 grudnia 2007, 05:58

Post autor: kane2002 »

z tego co widzę to używasz amavisa i w nim jest określenie

/etc/amavis/conf.d/20-debian_defaults

Kod: Zaznacz cały

$sa_spam_subject_tag = '***SPAM*** '; 
czy dany mail ma być oznaczony jako spam czy też nie, może się mylę jeśli tak to proszę od razu o sprostowanie ale z tego co wiem to amavis bezpośrednio komunikuje sie z spamassasin jesli mnie pamieć nie myli poprzez modul perla , tak wiec proponowałbym wyłączyć spamassina

/etc/default/spamassassin

Kod: Zaznacz cały

ENABLED=0
zobacz czy to zadziała , a i ew. wklej na forum pełny header oraz log dotyczący wiadomości jaki dostajesz wysyłając wiadomość testowa, która zawiera spam
smokvip
Posty: 1
Rejestracja: 04 listopada 2009, 09:55

Post autor: smokvip »

Witam.
Zmień w pliku:

Kod: Zaznacz cały

/etc/amavis/conf.d/05-domain_id

Kod: Zaznacz cały

@local_domains_acl = ( ".$mydomain" ); 
na:

Kod: Zaznacz cały

@local_domains_acl = ('.'); 
U mnie pomogło.
Pozdrawiam.
ODPOWIEDZ