Avmailgate with Amavisd-new working together on Postfix (just for fun… :)))
########
The principles of mail filter:
Unfilter mail-> MTA queue->Content_filter->MTA queue->Content_filter>MDA
or;
postfix->avmailgate->postfix->amavisd-new->postfix->cyrus/courier
###############
For the installing avmailgate, amavisd-new, and postfix
please read the manuals howto installing at:
-avmailgate (http://www.avira.de)
-amavisd-new (http://www.ijs.si/software/amavisd/ &
-postfix (http://www.postfix.org/
##############
On The /etc/avmailgate.conf
User uucp
Group uucp
ListenAddress localhost port 20024
ForwardTo SMTP: localhost port 20025
and so on …
… up to you
#/usr/lib/AntiVir/avmailgate.bin –start
check onto /var/log/maillog
#tail -f /var/log/maillog
plato:/etc # tail -f /var/log/mail
Feb 9 14:34:31 plato avmailgate.bin[21581]: vdf version: 6.38.0.202
Feb 9 14:34:31 plato avmailgate.bin[21581]: product version: AvMailGate-2.1.2-14 +gui
Feb 9 14:34:31 plato avmailgate.bin[21581]: configuration file: /etc/avmailgate.conf
Feb 9 14:34:31 plato avmailgate.bin[21581]: engine directory: /usr/lib/AntiVir
Feb 9 14:34:31 plato avmailgate.bin[21596]: addressfilter not active
Feb 9 14:34:31 plato avmailgate.bin[21597]: ready to accept connections on port 20024
The same check at:
#netstat -tapn
tcp 0 0 127.0.0.1:20024 0.0.0.0:* LISTEN 21597/avmailgate.bin
#telnet localhost 20024
plato:/etc # telnet localhost 20024
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 localhost AntiVir MailGate
ehlo localhost
250 Hello localhost, pleased to meet you
quit
221 Closing connection
Connection closed by foreign host.
The server ready for request!
############
On the /etc/postfix/master.cf
content_filter = smtp:127.0.0.1:20024
and you have to find and comment on this line
#defer_transport=local
############
on the /etc/postfix/master.cf
smtp inet n - n - - smtpd
localhost:20025 inet n - n - - smtpd
-o content_filter=amavisfeed:[127.0.0.1]:10026
amavisfeed unix - - n - 2 lmtp
-o lmtp_data_done_timeout=1200
-o lmtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
127.0.0.1:10027 inet n - n - - smtpd
-o content_filter=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o smtpd_restriction_classes=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
-o local_header_rewrite_clients=
we’ll check again every port listening on:
#telnet localhost 10026 (amavisd-new listening port)
plato:/etc # telnet localhost 10026
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 [127.0.0.1] ESMTP amavisd-new service ready
ehlo localhost
250-[127.0.0.1]
250-VRFY
250-PIPELINING
250-SIZE
250-ENHANCEDSTATUSCODES
250-DSN
250 XFORWARD NAME ADDR PROTO HELO
quit
221 2.0.0 [127.0.0.1] amavisd-new closing transmission channel
Connection closed by foreign host.
#telnet localhost 10027
plato:/etc # telnet localhost 10027 (reinject back to postfix)
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 mx.ug.ac.id ESMTP Postfix
ehlo localhost
250-mx.ug.ac.id
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH CRAM-MD5 DIGEST-MD5 LOGIN PLAIN
250-AUTH=CRAM-MD5 DIGEST-MD5 LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
#telnet localhost 20024 (avmailgate listening port)
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 localhost AntiVir MailGate
ehlo localhost
250 Hello localhost, pleased to meet you
quit
221 Closing connection
Connection closed by foreign host.
#telnet localhost 20025 (reinject back gain to postfix)
here some content of mail on this mail server
Return-Path: <ipen@ug.ac.id>
Received: from murder ([unix socket])
by plato (Cyrus v2.3.8) with LMTPA;
Sat, 09 Feb 2008 14:22:14 +0800
X-Sieve: CMU Sieve 2.3
Received: from localhost (localhost [127.0.0.1])
by mx.ug.ac.id (Postfix) with ESMTP id EA7722104B
for <ipen@ug.ac.id>; Sat, 9 Feb 2008 14:22:13 +0800 (CIT)
Received: from mx.ug.ac.id ([127.0.0.1])
by localhost (plato.ug.ac.id [127.0.0.1]) (amavisd-new, port 10026)
with LMTP id sp8Anrnq7CHb for <ipen@ug.ac.id>;
Sat, 9 Feb 2008 14:22:04 +0800 (CIT)
Received: from localhost (localhost [127.0.0.1])
by mx.ug.ac.id (Postfix) with ESMTP id 8CC362107A
for <ipen@ug.ac.id>; Sat, 9 Feb 2008 14:22:04 +0800 (CIT)
Received: from mx.ug.ac.id (localhost [127.0.0.1])
by localhost (AvMailGate-2.1.2-14) id 21419-n2Vr2J;
Sat, 9 Feb 2008 14:22:04 +0800 (CIT)
Received: from www.webmail.ug.ac.id (localhost [127.0.0.1])
by mx.ug.ac.id (Postfix) with ESMTP id 6C24120CCD
for <ipen@ug.ac.id>; Sat, 9 Feb 2008 14:22:04 +0800 (CIT)
Received: from plato.ug.ac.id ([192.168.0.201])
(SquirrelMail authenticated user ipen)
by www.webmail.ug.ac.id with HTTP;
Sat, 9 Feb 2008 15:22:04 +0900 (TLT)
Message-ID: <27969.192.168.0.201.1202538124.squirrel@www.webmail.ug.ac.id>
Date: Sat, 9 Feb 2008 15:22:04 +0900 (TLT)
Subject: kiriman imel
From: ipen@ug.ac.id
To: ipen@ug.ac.id
User-Agent: SquirrelMail/1.4.13
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
X-Priority: 3 (Normal)
Importance: Normal
Content-Transfer-Encoding: quoted-printable
X-AntiVirus: checked by AntiVir MailGate (version: 2.1.2-14; AVE: 7.3.1.38; VDF: 6.38.0.202; host: plato)
here some log on maillog
plato:/etc # tail -f /var/log/mail
Feb 9 15:01:36 plato postfix/smtpd[21808]: connect from localhost[127.0.0.1]
Feb 9 15:01:36 plato postfix/smtpd[21808]: 40CBA20CCB: client=localhost[127.0.0.1]
Feb 9 15:01:36 plato postfix/cleanup[21810]: 40CBA20CCB: message-id=<11613.192.168.0.201.1202540496.squirrel@www.webmail.ug.ac.id>
Feb 9 15:01:36 plato postfix/qmgr[21685]: 40CBA20CCB: from=<ipen@ug.ac.id>, size=739, nrcpt=1 (queue active)
Feb 9 15:01:36 plato postfix/smtpd[21808]: disconnect from localhost[127.0.0.1]
Feb 9 15:01:36 plato avmailgate.bin[21813]: connection from localhost
Feb 9 15:01:36 plato avmailgate.bin[21813]: spooled to 21813-BOWRyJ
Feb 9 15:01:36 plato postfix/smtp[21811]: 40CBA20CCB: to=<ipen@ug.ac.id>, relay=127.0.0.1[127.0.0.1]:20024, delay=0.15, delays=0.12/0.03/0/0, dsn=2.0.0, status=sent (250 Mail accepted for delivery (queued as 21813-BOWRyJ).)
Feb 9 15:01:36 plato postfix/qmgr[21685]: 40CBA20CCB: removed
Feb 9 15:01:36 plato avmailgate.bin[21813]: connection to localhost closed
Feb 9 15:01:36 plato avmailgate.bin[21816]: Message ‘incoming/xf-21813-BOWRyJ’ scheduled for scanning now
Feb 9 15:01:36 plato avmailgate.bin[21816]: Scanner will process message ‘incoming/qf-21813-BOWRyJ’
Feb 9 15:01:36 plato avmailgate.bin[21819]: Message “outgoing/xf-21813-BOWRyJ” scheduled for delivery now
Feb 9 15:01:36 plato postfix/smtpd[21820]: connect from localhost[127.0.0.1]
Feb 9 15:01:36 plato postfix/smtpd[21820]: 6B9112106E: client=localhost[127.0.0.1]
Feb 9 15:01:36 plato postfix/cleanup[21810]: 6B9112106E: message-id=<11613.192.168.0.201.1202540496.squirrel@www.webmail.ug.ac.id>
Feb 9 15:01:36 plato postfix/qmgr[21685]: 6B9112106E: from=<ipen@ug.ac.id>, size=1171, nrcpt=1 (queue active)
Feb 9 15:01:36 plato postfix/smtpd[21820]: disconnect from localhost[127.0.0.1]
Feb 9 15:01:36 plato avmailgate.bin[21819]: Message ‘21813-BOWRyJ’ successfully forwarded to: <ipen@ug.ac.id>
Feb 9 15:01:46 plato postfix/smtpd[21825]: connect from localhost[127.0.0.1]
Feb 9 15:01:46 plato postfix/smtpd[21825]: 1E87420CCB: client=localhost[127.0.0.1]
Feb 9 15:01:46 plato postfix/cleanup[21810]: 1E87420CCB: message-id=<11613.192.168.0.201.1202540496.squirrel@www.webmail.ug.ac.id>
Feb 9 15:01:46 plato postfix/qmgr[21685]: 1E87420CCB: from=<ipen@ug.ac.id>, size=1535, nrcpt=1 (queue active)
Feb 9 15:01:46 plato amavis[19333]: (19333-03) Passed CLEAN, ORIGINATING/MYNETS LOCAL [127.0.0.1] [127.0.0.1] <ipen@ug.ac.id> -> <ipen@ug.ac.id>, Message-ID: <11613.192.168.0.201.1202540496.squirrel@www.webmail.ug.ac.id>, mail_id: fTfNKX2SeAbg, Hits: -0.873, size: 1171, queued_as: 1E87420CCB, 9630 ms
Feb 9 15:01:46 plato postfix/lmtp[21821]: 6B9112106E: to=<ipen@ug.ac.id>, relay=127.0.0.1[127.0.0.1]:10026, delay=9.8, delays=0.11/0.01/0.01/9.6, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 1E87420CCB)
Feb 9 15:01:46 plato postfix/smtpd[21825]: disconnect from localhost[127.0.0.1]
Feb 9 15:01:46 plato postfix/qmgr[21685]: 6B9112106E: removed
Feb 9 15:01:46 plato postfix/pipe[21827]: 1E87420CCB: to=<ipen@ug.ac.id>, relay=cyrus, delay=0.37, delays=0.05/0.04/0/0.28, dsn=2.0.0, status=sent (delivered via cyrus service)
Feb 9 15:01:46 plato postfix/qmgr[21685]: 1E87420CCB: removed
here’s mail go on to avmailgate
Feb 9 15:01:36 plato postfix/smtp[21811]: 40CBA20CCB: to=<ipen@ug.ac.id>, relay=127.0.0.1[127.0.0.1]:20024, delay=0.15, delays=0.12/0.03/0/0, dsn=2.0.0, status=sent (250 Mail accepted for delivery (queued as 21813-BOWRyJ).)
and, here mail come from postfix and go to amavisd-new:
Feb 9 15:01:46 plato postfix/lmtp[21821]: 6B9112106E: to=<ipen@ug.ac.id>, relay=127.0.0.1[127.0.0.1]:10026, delay=9.8, delays=0.11/0.01/0.01/9.6, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 1E87420CCB)
Happy Ngoprek!! ![]()