Mailinglist Archive: opensuse (1473 mails)

< Previous Next >
Re: [opensuse] How to Clamav and postfix
  • From: Sandy Drobic <opensuse@xxxxxxxxx>
  • Date: Mon, 08 Jun 2009 18:57:20 +0200
  • Message-id: <4A2D42F0.1060507@xxxxxxxxx>
Michael S. Dunsavage wrote:
I finally got spamassassin running with postfix properly but for the
life of my I cannot get amavis and clam to work well.

Anyone have any links to good howtos?

I went through a couple and I must be doing something wrong somewhere.
If there's a howto w/out using amavis I'm all open for that too

If I remember correctly, the default listening socket of clamd was not where
amavisd-new expected it to be.

Here's a short config that should work:

Please read the how to at the end of the mail!


# send mails to amavis as content_filter
smtp inet n - n - - smtpd
-o content_filter=smtp-amavis:[]:10024
# [...other lines]
# here the mails come back from amavis: inet n - n - - smtpd
-o content_filter=
-o smtpd_proxy_filter=
-o smtpd_authorized_xforward_hosts=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_restriction_classes=
-o smtpd_data_restrictions=
-o mynetworks=
-o receive_override_options=no_unknown_recipient_checks
# the transport smtp-amavis limits how many content_filter
# processes are used simultaneously (default is: 2)
smtp-amavis unix - - n - 2 smtp
-o smtp_send_xforward_command=yes


$MYHOME = '/var/spool/amavis';
$mydomain = '';
$myhostname = '';
$daemon_user = 'vscan';
$daemon_group = 'vscan';
$TEMPBASE = $MYHOME; # (must be set if other config vars use is)
$ENV{TMPDIR} = $TEMPBASE; # wise to set TMPDIR, but not obligatory
$forward_method = 'smtp:'; # 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
$enable_db = 1; # enable use of BerkeleyDB/libdb (SNMP and nanny)
$enable_global_cache = 1; # enable use of libdb-based cache if $enable_db=1
@local_domains_maps = ( [ "" ] );
@local_domains_acl = qw( "");
$insert_received_line = 1; # behave like MTA: insert 'Received:' header
$inet_socket_port = 10024; # accept SMTP on this local TCP port
$inet_socket_bind = ''; # limit socket bind to loopback interface
@inet_acl = qw( ); # allow SMTP access only from localhost IP
@av_scanners = (
['Clam Antivirus-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
@av_scanners_backup = (
['Clam Antivirus - clamscan', 'clamscan',
'--stdout --no-summary -r {}', [0], [1],
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
1; # insure a defined return

LogSyslog yes
LogFacility LOG_MAIL
PidFile /var/lib/clamav/
LocalSocket /var/run/clamav/clamd
TCPSocket 3310
User vscan

How to set up:

Check that the directories above actually exist. If not, create them.
IIRC, I had to create the /var/run/clamav directory.

Start with clamd:
Set up clamd as shown above, then start the service:
rcclamd start
Check the log that the service is actually running:
netstat -antp| grep ":3310"

Then run fresh-clam to update the signatures.

If that works then configure amavisd-new as shown above and start the service:
rcamavis start

You should then see that amavisd has startet and is using clamd in the log:

Jun 8 18:55:25 mordor amavis[19524]: Using primary internal av scanner code
for Clam Antivirus-clamd
Jun 8 18:55:25 mordor amavis[19524]: Found secondary av scanner Clam
Antivirus - clamscan at /usr/bin/clamscan

If that is working you can configure Postfix as shown above to include
amavisd-new as a content-filter.

List replies only please!
Please address PMs to: news-reply2 (@) japantest (.) homelinux (.) com
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >