Newsgroup: it.comp.os.linux.sys
Titolo: [postfix + amavisd-new + clamav] Non capisco dove sbaglio...

, Message-ID: , Hits:
-
Jan 17 08:27:44 master amavis[2936]: (02936-02) TIMING [total 45149 ms]
- SMTP penalty wait: 16649 (37%), SMTP pre-MAIL: 7701 (17%), SMTP DATA:
20769 (46%), body hash: 0 (0%), mime_decode: 4 (0%), get-file-type: 8
(0%), decompose_part: 1 (0%), parts: 0 (0%), AV-scan-1: 1 (0%),
fwd-connect: 8 (0%), fwd-mail-from: 5 (0%), fwd-rcpt-to: 1 (0%),
fwd-rundown: 0 (0%), unlink-1-files: 2 (0%), rundown: 0 (0%)
Jan 17 08:27:44 master postfix/cleanup[2989]: 23BC215179:
message-id=<20050117082744.23BC215179@master.---------.com>
Jan 17 08:27:44 master postfix/qmgr[2523]: 23BC215179:
from=<double-bounce@master.-----------.com>, size=814, nrcpt=1 (queue
active)
Jan 17 08:27:44 master postfix/smtpd[2987]: disconnect from
localhost.localdomain[127.0.0.1]
Jan 17 08:27:44 master postfix/local[2990]: 23BC215179:
to=<paolo@----------.com>, orig_to=<postmaster>, relay=local, delay=0,
status=sent (delivered to mailbox)
Jan 17 08:27:44 master postfix/qmgr[2523]: 23BC215179: removed
Jan 17 08:28:05 master amavis[2936]: (02936-02) SMTP: 500 5.5.2 Error:
bad syntax; PENALIZE: \004\377\364\377\375\006"
Postfix senza AMAVIS e CLAMAV funziona perfettamente (invio/ricezione
messaggi).
Potete aiutartmi ?
Grazie
Dado

 Potete aiutartmi ?
Potresti cominciare dicendoci come ha configurato postfix e amavid-new, e
quali pacchetti hai installato.
ciao
Luca

Ciao Luca e grazie per la disponibilita'
Se non si fosse capito sono abbastanza un niubbo...
Comunque vediamo se questo e' chiaro :
Debian SARGE (via netinstall)
apt-get install postfix
Qui ho modificato postfix e tutto funzionava (posta inviata
correttamente, sia via telnet in localhost, sia da qualsiasi client)
apt-get install clamav
apt-get install clamav-daemon
apt-get install amavisd-new
Ho seguito una guida,passo passo, che ho trovato sotto
www.linuxjournal.com
 che spiegava come modificare i vari conf.
Qui sotto li trovi modificati :
[POSTFIX / 
main.cf
]
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
mail_owner = postfix
myhostname = master.----------.com
mydomain = ----------.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
mynetworks_style = subnet
mynetworks = 
192.168.0.0/28
, 
127.0.0.0/8
relay_domains = $mydestination
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mail_spool_directory = /var/spool/mail
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
content_filter = smtp-amavis:[127.0.0.1]:10024
[POSTFIX / 
master.cf
]
#
==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
#
==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#628      inet  n       -       -       -       -       qmqpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       -       300     1       qmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
maildrop  unix  -       n       n       -       -       pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail
($recipient)
ifmail    unix  -       n       n       -       -       pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -d -t$nexthop
-f$sender $recipient
scalemail-backend unix	-	n	n	-	2	pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
${nexthop} ${user} ${extension}
smpt-amavis unix -	-	y	-	2	smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookup=yes
127.0.0.1:10025
 inet n	-	n	-	-	smtpd
-o content_filter=
-o local_recipient_maps=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o
smtpd_recipient_restrictions=permit_mynetworks,reject_unauth_destination
-o mynetworks=
127.0.0.0/8
-o strict_rfc821_envelope=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
[CLAMAV / clamd.conf]
#Automatically Generated by clamav-daemon postinst
#To reconfigure clamd run #dpkg-reconfigure clamav-daemon
LocalSocket /var/run/clamav/clamd.ctl
FixStaleSocket
User clamav
AllowSupplementaryGroups
ScanMail
ScanArchive
ArchiveMaxRecursion 5
ArchiveMaxFiles 1000
ArchiveMaxFileSize 10M
ReadTimeout 180
MaxThreads 12
MaxConnectionQueueLength 15
LogFile /var/log/clamav/clamav.log
LogTime
LogFileMaxSize 0
PidFile /var/run/clamav/clamd.pid
DatabaseDirectory /var/lib/clamav/
SelfCheck 3600
ScanOLE2
ScanPE
DetectBrokenExecutables
ScanHTML
ArchiveBlockMax
[AMAVIS-NEW / amavisd.conf]
use strict;
#
# Section I - Essential daemon and MTA settings
#
$MYHOME = '/var/lib/amavis';   # (default is '/var/amavis')
$mydomain = '----------.com';      # (no useful default)
$daemon_user  = 'amavis';	# (no default (undef))
$daemon_group = 'amavis';	# (no default (undef))
$TEMPBASE = $MYHOME;           # (must be set if other config vars use
is)
$pid_file  = "/var/run/amavis/amavisd.pid";  # (default:
"$MYHOME/amavisd.pid")
$lock_file = "/var/run/amavis/amavisd.lock"; # (default:
"$MYHOME/amavisd.lock")
$ENV{TMPDIR} = $TEMPBASE;       # wise to set TMPDIR, but not
obligatory
$forward_method = 'smtp:
127.0.0.1:10025
';  # where to forward checked
mail
$notify_method = $forward_method;          # where to submit
notifications
$max_servers  =  2;   # number of pre-forked children          (default
2)
$max_requests = 10;   # retire a child after that many accepts (default
10)
$child_timeout=5*60;  # abort child if it does not complete each task
in n sec
@bypass_spam_checks_acl  = qw( . );    # No default dependency on
spamassassin
@local_domains_acl = ( ".$mydomain" );  # $mydomain and its subdomains
#
# Section II - MTA specific (defaults should be ok)
#
$relayhost_is_client = 0;         # (defaults to false)
$insert_received_line = 1;        # behave like MTA: insert 'Received:'
header
$unix_socketname = undef;         # disable listening on a unix socket
$inet_socket_port = 10024;        # accept SMTP on this local TCP port
$inet_socket_bind = '127.0.0.1';  # limit socket bind to loopback
interface
@inet_acl = qw( 127.0.0.1 );      # allow SMTP access only from
localhost IP
#
# Section III - Logging
#
$DO_SYSLOG = 1;                 # (defaults to false)
$LOGFILE = "/var/log/amavis.log";  # (defaults to empty, no log)
$log_level = 2;		# (defaults to 0)
$log_templ = '[? %#V |[? %#F |[?%#D|Not-Delivered|Passed]|BANNED
name/type (%F)]|INFECTED (%V)], #
[?%o|(?)|<%o>] -> [<%R>|,][? %i ||, quarantine %i], Message-ID: %m,
Hits: %c';
#
# Section IV - Notifications/DSN, BOUNCE/REJECT/DROP/PASS destiny,
quarantine
#
read_l10n_templates('en_US', '/etc/amavis');
$final_virus_destiny      = D_DISCARD; # (defaults to D_BOUNCE)
$final_banned_destiny     = D_BOUNCE;  # (defaults to D_BOUNCE)
$final_spam_destiny       = D_REJECT;  # (defaults to D_REJECT)
$final_bad_header_destiny = D_PASS;  # (defaults to D_PASS), D_BOUNCE
suggested
$viruses_that_fake_sender_re = new_RE(
qr'nimda|hybris|klez|bugbear|yaha|braid|sobig|fizzer|palyh|peido|holar'i,
qr'tanatos|lentin|bridex|mimail|trojan\.dropper|dumaru|parite|spaces'i,
qr'dloader|galil|gibe|swen|netwatch|bics|sbrowse|sober|rox|val(hal)?la'i,
qr'frethem|sircam|be?agle|tanx|mydoom|novarg|shimg|netsky|somefool|moodown'i,
qr'@mm|@MM',    # mass mailing viruses as labeled by f-prot and
uvscan
qr'Worm'i,      # worms as labeled by ClamAV, Kaspersky, etc
[qr'^(EICAR|Joke\.|Junk\.)'i         => 0],
[qr'^(WM97|OF97|W95/CIH-|JS/Fort)'i  => 0],
[qr/.*/ => 1],  # true by default  (remove or comment-out if
undesired));
$virus_admin = "postmaster\@$mydomain";		# due to D_DISCARD default
$QUARANTINEDIR = '/var/lib/amavis/virusmails';
$virus_quarantine_to  = 'virus-quarantine';    # traditional local
quarantine
$spam_quarantine_to = 'spam-quarantine';
$X_HEADER_TAG = 'X-Virus-Scanned';	# (default: undef)
$X_HEADER_LINE = "by $myversion (Debian) at $mydomain";
$undecipherable_subject_tag = '***UNCHECKED*** ';  # undef disables it
$remove_existing_x_scanned_headers = 0; # leave existing
X-Virus-Scanned alone
$remove_existing_spam_headers  = 1;     # remove existing spam headers
if
$keep_decoded_original_re = new_RE(
$banned_filename_re = new_RE(
#
# Section V - Per-recipient and per-sender handling, whitelisting, etc.
#
$sql_select_white_black_list = undef;  # undef disables SQL
white/blacklisting
$recipient_delimiter = '+';		# (default is '+')
$replace_existing_extension = 1;	# (default is false)
$localpart_is_case_sensitive = 0;	# (default is false)
$blacklist_sender_re = new_RE(
qr'^(bulkmail|offers|cheapbenefits|earnmoney|foryou|greatcasino)@'i,
qr'^(investments|lose_weight_today|market\.alert|money2you|MyGreenCard)@'i,
qr'^(new\.tld\.registry|opt-out|opt-in|optin|saveonl|smoking2002k)@'i,
qr'^(specialoffer|specialoffers|stockalert|stopsnoring|wantsome)@'i,
qr'^(workathome|yesitsfree|your_friend|greatoffers)@'i,
qr'^(inkjetplanet|marketopt|MakeMoney)\d*@'i,
);
map { $whitelist_sender{lc($_)}=1 } (qw(
nob...@cert.org
owner...@iss.net
slas...@slashdot.org
bug...@securityfocus.com
NTBU...@LISTSERV.NTBUGTRAQ.COM
securit...@linuxsecurity.com
amavis-u...@lists.sourceforge.net
razor-us...@lists.sourceforge.net
notificat...@lists.sophos.com
mailman-ann...@python.org
zope-anno...@zope.org
owner-pos...@postfix.org
owner-postf...@postfix.org
owner-sendm...@lists.sendmail.org
sendmail-ann...@lists.sendmail.org
ca+en...@sendmail.org
owner-t...@postel.ACM.ORG
lvs-use...@LinuxVirtualServer.org
ietf-12...@loki.ietf.org
cvs-commits...@gnome.org
rt-user...@lists.fsck.com
owner-a...@mnogosearch.org
owner-...@ntp.org
owner...@ntp.org
clp-r...@comp.nus.edu.sg
surveys...@lists.nua.ie
emai...@genomeweb.com
owner-textb...@CNNIMAIL12.CNN.COM
yahoo-d...@yahoo-inc.com
));
#
# Section VI - Resource limits
#
$MAXLEVELS = 14;		# (default is undef, no limit)
$MAXFILES = 1500;		# (default is undef, no limit)
$MIN_EXPANSION_QUOTA =      100*1024;  # bytes  (default undef, not
enforced)
$MAX_EXPANSION_QUOTA = 300*1024*1024;  # bytes  (default undef, not
enforced)
$MIN_EXPANSION_FACTOR =   5;  # times original mail size  (must be
specified)
$MAX_EXPANSION_FACTOR = 500;  # times original mail size  (must be
specified)
#
# Section VII - External programs, virus scanners
#
$path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin';
$file   = 'file';   # file(1) utility; use 3.41 or later to avoid
vulnerability
$gzip   = 'gzip';
$bzip2  = 'bzip2';
$lzop   = 'lzop';
$uncompress = ['uncompress', 'gzip -d', 'zcat'];
$unfreeze   = ['unfreeze', 'freeze -d', 'melt', 'fcat'];
$arc        = ['nomarch', 'arc'];
$unarj      = ['arj', 'unarj'];  # both can extract, arj is recommended
$unrar      = ['rar', 'unrar'];  # both can extract, same options
$zoo    = 'zoo';
$lha    = 'lha';
$cpio   = 'cpio';   # comment out if cpio does not support GNU options
$sa_local_tests_only = 1;   # (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  = 4.0; # add spam info headers if at, or above
that level
$sa_tag2_level_deflt = 6.3; # add 'spam detected' headers at that level
$sa_kill_level_deflt = $sa_tag2_level_deflt; # triggers spam evasive
actions
$sa_dsn_cutoff_level = 10;  # spam level beyond which a DSN is not
sent,
$sa_spam_subject_tag = '***SPAM*** ';	# (defaults to undef, disabled)
$first_infected_stops_scan = 1;  # default is false, all scanners are
called
@av_scanners = (
['Clam Antivirus-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
);
#
# Section VIII - Debugging
#
Ho modificato solo dove l'articolo diceva di farlo, tutto il resto l'ho
lasciato come ho l'ho trovato.
Il mio dominio '---------.com' e' registrato e in hosting presso un
provider. Le email indirizzate a 'davide@----------.com' si fermano nel
server del fornitore hosting che poi scarico via fetchmail e sono
quindi a disposizione dei client nella LAN grazie a qpopper.
Se ho fatto/detto fesserie, ti prego di perdonarmi.
Grazie per l'aiuto e per il tempo che stai dedicando
Ciao
Davide

 quindi a disposizione dei client nella LAN grazie a qpopper.
Ok, quindi amavis lo useresti essenzialmente per filtrare i messaggi
inviati.
ciao
Luca

 inviati.
Luca sei stato gentilissimo. Grazie.
Oggi faro' le modifiche e poi ti faro' sapere se tutto okay (credo
proprio di si' comunque).
Un'ultima cosa: qui sopra dici che 'userei amavis per filtrare i soli
messaggi in uscita'. Ma se io volessi filtrare anche i messaggi in
entrata (quelli che scarico via fetchmail e metto sul qpopper locale) ?
Ciao
Davide

 entrata (quelli che scarico via fetchmail e metto sul qpopper locale) ?
mmh... non conosccendo molto fetchmail non saprei dirti. Una ricerca su
google non fa mai male.
ciao
Luca

Ciao Luca,
1. Ho gia' trovato qualcosa (per fetchmail) e mi daro' da fare entro
fine settimana. Volevo solo quanche consiglio prima di avventurarmi in
qualcosa che poi magari non era quello che cercavo!
2. Ho apportato i cambiamenti che mi hai consigliato e sembra
funzionare tutto quasi alla perfezione, nel senso che :
a) se l'utente '
pi...@dominio.com
' invia con il suo MUA (TB) un'email
all'utente '
fra...@dominio.com
' il messaggio dovrebbe rimanere locale
per via dello stesso dominio (postfix lo interpreta come locale). Pero'
il messaggio resta in coda (mailq) con un errore :
"delivery temporarily suspended: transport in unvailable"
Chiaro che entrambi gli utenti 'pippo' e 'franco' sono user nel server
con relative caselle di posta e che c'e' un server POP3 in funzione
(qpopper)
b) se lo stesso utente '
pi...@dominio.com
' invia lo stesso messaggio ad
un utente esterno (esempio : '
pi...@yahoo.com
') il messaggio viene
inoltrato ed arriva e destinazione perfettamente.
c) se l'utente 'pippo' utilizza la porta 10025 sul server SMTP invece
della 25, lo stesso messaggio viene recapitato sia per (a)(all'utente
locale 'franco') sia all'utente esterno '
pi...@yahoo.com
'
perfettamente.
Ho controllato le differenze tra i 2 files (
main.cf/master.cf
) nelle 2
versioni (solo postfix / postfix + amavis + clamav), ma trovo solo:
[
main.cf
]
content_filter = smtp-amavis:[127.0.0.1]:10024
[
master.cf
]
smpt-amavis unix -	-	n	-	2	smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookup=yes
127.0.0.1:10025
 inet n	-	n	-	-	smtpd
-o content_filter=
Non capisco dove si intoppa, visto che i messaggi destinati
all'esterno... vanno a destinazione perfettamente!
Ciao
Davide