Setting up clamsmtp

From Alpine Linux
Revision as of 12:35, 21 May 2009 by Djhughes (talk | contribs) (created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Add ClamSMTP

apk_add clamsmtp

Configure the clamsmtpd.conf file as follows:

OutAddress: 127.0.0.1:10026
Listen: 127.0.0.1:10025
ClamAddress: /var/run/clamav/clamd.sock
TempDirectory: /tmp
Action: drop
Quarantine: on
User: clamav
VirusAction: /etc/postfix/scripts/virus_action.sh

The configuration above supports sending mail to an email address of a mailbox monitored by an Administrator. Remember to treat any mails that come into this box as hostile, as they could contain viruses. Additionally, a notification message

The Virus Action script can be found here at virus_action.sh

Add the following line to your postfix main.cf file:

content_filter = scan:[127.0.0.1]:10025

Add the following lines to the end of your master.cf file:

# AV scan filter (used by content_filter)
scan      unix  -       -       n       -       16      smtp
        -o smtp_send_xforward_command=yes
        -o smtp_enforce_tls=no
# 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

Restart postfix and start the clamsmtp service:

/etc/init.d/postfix restart /etc/init.d/clamsmtp start

Finally, schedule clamsmtp to automatically start on boot up:

rc_add -k clamsmtpd