Related Items  

Linux and Windows Support  

make-it-great-again

Login or Register  

If you wish to contribute an article, please login or register.

Postfix and Clam AV

PrintE-mail

It's been a while since we've posted something and a lot of stuff piled up. At the day and age of MS Exchange and cloud hosting, there are still instances when you'd like to run your own email server. Postfix being the popular choice, we present here are simple steps to enable ClamAV to scan your incoming emails (Ubuntu is used as an example in this case).

First, a short description of the steps that the mail will take:

Incoming mail → 25:postfix → 10026:clamav → 10025:postfix → Delivery to user

Installation steps are as follows:

1) download and install ClamAV

apt-get install clamsmtp clamav-freshclam

2) Next edit the /etc/clamsmtpd.conf file to make some changes:

OutAddress: 10026
Listen: 0.0.0.0:10025

Make sure you change the ports above, because originally they are flipped. If you don't you'll get the following error:

postfix/master[13836]: fatal: bind 127.0.0.1 port 10026: Address already in use

3) Edit /etc/postfix/main.cf to add the following:

content_filter = scan:127.0.0.1:10025
receive_override_options = no_address_mappings

4) Edit /etc/postfix/master.cf and add the following:

# AV scan filter (used by content_filter)
scan      unix  -       -       n       -       16      smtp
        -o smtp_send_xforward_command=yes
# For injecting mail back into postfix from the filter
127.0.0.1:10026 inet  n -       n       -       16      smtpd
        -o content_filter=
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_helo_restrictions=
        -o smtpd_client_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks_style=host
        -o smtpd_authorized_xforward_hosts=127.0.0.0/8

5) Restart postfix, clamav-daemon and clamsmtp

 

Comments (1)
Segfaults in Clamsmtpd
1 Tuesday, 24 February 2015 17:20
Jeff Roberson
I was having trouble with segfaults in clamsmtpd. What I discovered is that calmd was running under clamav and clamsmtpd was running under a different user. Make sure that they are bot running under the same account. In addition, the ctl file is critical, make sure that it matches in both clamd and clamsmtp's configuration.

Add your comment

Your name:
Subject:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
   
Copyright © 1999 - 2017 Virtual Helpme | a | Original Template: Allrounder