- 论坛徽章:
- 0
|
网上sendmail杀毒都是用scanmail的,sendmail有milter的API,所以搞了下.成功.发个过程,分享下
How to use Clamav check virus with sendmail
In sendmail,you must enable the libmilter,
In sendmail source directory,
#cd ./libmilter
#./Build
#./Build install
then into the ../devtools/Site,edit the file site.config.m4
add two line:
APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER') #enable the libmilter
APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER_ROOT_UNSAFE ') #use libmilter must be root
Then re-compile the sendmail binary
and compile the sendmail.cf
edit cf/cf/sendmail.mc
add two line:
INPUT_MAIL_FILTER(`clmilter',`S=local:/var/run/clmilter.sock,F=,T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS',`clmilter') #this is for clamav-milter
then:
./Build install-cf
In Clamav
First,you must apply many package on solaris 
1.curl-7.12.1
2.openssl-0.9.7d
3.zlib-1.2.1
4.gmp-4.1.2 (this package must be compiled from source code,others can get binary from www.sunfreeware.com)
5.bzip2
6.clamav-0.80rc4
add the clamav account to system
# groupadd clamav
# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
then install the clamav,in source code directory
#./configure --sysconfdir=/etc --enable-milter
#make
#make install
after complete,edit /etc/clamd.conf,and /etc/freshclam.conf
in /etc/clamd.conf
comment Example
#Example
enable log
LogFile /var/log/clamd.log
comment LocalSocket /tmp/localhost (I am not remember clear)
add line:
LocalSocket /var/run/clamd.sock
any others you want change
in /etc/freshclam.conf
comment Example
#Example
enable log
logFile ....
# Number of database checks per day.
# Default: 12 (every two hours)
Checks 2
I think update virus database twice everyday is better.
any others you want change
start the clamd daemon
#/usr/local/sbin/clamd
start the auto-update daemon
#/usr/local/bin/freshclam -d
start clamav-milter for sendmail
#/usr/local/sbin/clamav-milter -lo /var/run/clmilter.sock
then restart the sendmail
everything is ok.in every mail head you can see the check virus information. |
|