Debian + Exim4 + MailScanner + Clamav

1. 安裝 packages
# apt-get update
# apt-get install exim4 mailscanner clamav

2. 設定相應目錄
# chown -R Debian-exim:Debian-exim /var/spool/MailScanner
# chown -R Debian-exim:Debian-exim /var/lib/MailScanner
# chown -R Debian-exim:Debian-exim /var/run/MailScanner
# chown -R Debian-exim:Debian-exim /var/lock/subsys/MailScanner

 

# mkdir -p /var/spool/exim4_incoming/{db,input,msglog}
# chown -R Debian-exim:Debian-exim /var/spool/exim4_incoming
# chmod -R 750 /var/spool/exim4_incoming

# mkdir -p /var/log/exim4_incoming
# chown -R Debian-exim:adm /var/log/exim4_incoming
# chmod -R 2750 /var/log/exim4_incoming

3. 設定 Exim4
# vi /etc/defaults/exim4

在 QUEUERUNNER 加入 separate
在 QUEUERUNNEROPTIONS 加入 -DOUTGOING
在 SMTPLISTENEROPTINS 加入 -odq

# vi /etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype=’internet’
dc_other_hostnames=’example.com’
dc_local_interfaces=’127.0.0.1:192.168.0.1′
dc_readhost=”
dc_relay_domains=’example.com’
dc_minimaldns=’false’
dc_relay_nets=’192.168.0.0/24′
dc_smarthost=”
CFILEMODE=’644′
dc_use_split_config=’true’
dc_hide_mailname=’false’

# update-exim4.conf

4. 設定 MailScanner
# vi /etc/defaults/mailscanner

run_mailscanner=1

# vi /etc/Mailscanner/Mailscanner.conf
%report-dir% = /etc/Mailscanner/reports/en

%org_name% = Nome da sua Empresa

%org-long-name% = Nome completo da empresa

%web-site% = www.sitedaempresa.com.br

Run As User = Debian-exim

Run As Gruup = Debian-exim

Incoming Queue Dir = /var/spool/exim4_incoming/input

Outgoing Queue Dir = /var/spool/exim4/input

Incoming Work Dir = /var/spool/MailScanner/incoming

Quarantine Dir = /var/spool/MailScanner/quarantine

MTA = exim4

Sendmail = /usr/sbin/exim4 -DOUTGOING

Sendmail = /usr/sbin/exim4 -DOUTGOING

Incoming Work User = Debian-exim

Incoming Work Group = Debian-exim

Quarantine User = Debian-exim

Quarantine Group = Debian-exim

#Sender Content Report = %report-dir%/sender.content.report.txt

#Sender Error Report = %report-dir%/sender.error.report.txt

#Sender Bad Filename Report = %report-dir%/sender.filename.report.txt

#Sender Virus Report = %report-dir%/sender.virus.report.txt

Virus Scanners = clamav

Monitors for ClamAV Updates = /usr/lib/clamav/*.cvd

5. 重啟服務

# /etc/init.d/exim4 restart

# /etc/init.d/mailscanner restart

Please leave your comment on the topic