Difference between pages "ClamAV" and "Milter"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Created page with "{{RightTOC}} == What is ClamAV ? == [http://www.clamav.net Clamav] is an Open Source antivirus. == Installing ClamAV == Get the tarball from the [http://www.clamav.net/lan...")
 
(Created page with "{{RightTOC}} == What is Milter ? == The Milter (mail filter) interface of the sendmail program affords calling plugins to filter bounce or modify mails while they are being...")
 
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
== What is ClamAV ? ==
+
== What is Milter ? ==  
  
[http://www.clamav.net Clamav] is an Open Source antivirus.
+
The Milter (mail filter) interface of the sendmail program affords calling plugins to filter bounce or modify mails while they are being received. Sendmail must have been compiled with the Milter DEFINE. Milter must be installed before MIMEDefang, as MIMEDefang needs the libmilter library.
  
== Installing ClamAV ==
+
== Installing Milter ==
  
Get the tarball from the [http://www.clamav.net/lang/en/download/sources/ download page]. Install in the standard way, create a user for running the software (e.g. '''milter''', as a single user has to be used by both '''Clamav''' and '''MIMEDefang''').
+
Build libmilter, libsm, and verify that mailstats, makemap, and smrsh are already in place :
  
  # tar -C /usr/local -xvf clamav-x.y.tar.gz
+
  # /etc/rc.d/rc.sendmail stop
  # cd /usr/local/
+
  # cd /usr/local/sendmail-*
  # chown -R root:root clamav-x.y.z
+
# cd libmilter
  # cd clamav-x.y
+
  # sh Build
  # ./configure --help | less
+
  # sh Build install
  # ./configure --libdir=/usr/local/lib64 --mandir=/usr/local/man \
+
  # cd ..
  --sysconfdir=/etc --with-user=milter --with-group=milter
+
  # mv /usr/lib/libmilter.a /usr/local/lib64
  # make
+
  # cd libsm
  # make install
+
  # sh Build
  # make clean
+
  # sh Build install
  # ldconfig
+
  # cd ..
  # groupadd milter
+
# cp obj.Linux*/libsm/libsm.a /usr/local/lib64
  # useradd -g milter -s /bin/false milter
+
  # cd mailstats
  # cd /var/log
+
  # sh Build
  # mkdir -m 700 milter
+
  # sh Build install
  # chown milter:milter milter
+
  # cd ..
  # cd /var/run
+
  # cd makemap
  # mkdir -m 700 milter
+
  # sh Build
  # chown milter:milter milter
+
  # sh Build install
  # cd /usr/local/share
+
  # cd ..
  # mkdir clamav
+
  # cd smrsh
  # chown milter:milter clamav
+
  # sh Build
 +
  # sh Build install
 +
  # cd ..
  
== Configuring ClamAV ==
+
Install headers and libraries for MIMEDefang. The name of the Linux directory will actually depend on your specific installation :
 
 
Review the configuration files in '''/etc/clamd.conf''' and '''/etc/freshclam.conf'''. Comment out the '''Example''' line and set the other parameters as below. The User milter line tells the software to execute as user milter :
 
 
 
# cd /etc
 
# cp clamd.conf.sample clamd.conf
 
# vi clamd.conf
 
. . .
 
#Example
 
LogFile /var/log/milter/clamd.log
 
PidFile /var/run/milter/clamd.pid
 
LocalSocket /var/spool/MIMEDefang/clamd.sock
 
TCPAddr 127.0.0.1
 
User milter
 
DetectBrokenExecutables yes
 
<esc>
 
:x
 
# cp freshclam.conf.sample freshclam.conf
 
# vi freshclam.conf
 
. . .
 
#Example
 
DatabaseDirectory /usr/local/share/clamav
 
UpdateLogFile /var/log/milter/freshclam.log
 
LogFileMaxSize 2M
 
LogTime yes
 
PidFile /var/run/milter/freshclam.pid
 
DatabaseOwner milter
 
DatabaseMirror db.FR.clamav.net
 
NotifyClamd /etc/clamd.conf
 
<esc>
 
:x
 
 
 
== Running ClamAV ==
 
 
 
clamd and freshclam run as daemons so must be launched at startup and stopped at shutdown. Update '''/etc/rc.d/rc.local''' and '''/etc/rc.d/rc.local_shutdown''' accordingly :
 
 
 
# vi /etc/rc.d/rc.local
 
. . .
 
# start clamd
 
if [ -x /usr/local/sbin/clamd ]; then
 
        echo "Starting clamd daemon: /usr/local/sbin/clamd"
 
        /usr/local/sbin/clamd
 
fi
 
 
# start freshclam
 
if [ -x /usr/local/bin/freshclam ]; then
 
        echo "Starting freshclam daemon: /usr/local/bin/freshclam -d"
 
        /usr/local/bin/freshclam -d
 
fi
 
<esc>
 
:x
 
# vi /etc/rc.d/rc.local_shutdown
 
. . .
 
# stop freshclam
 
if [ -r /var/run/milter/freshclam.pid ]; then
 
        echo "Stopping freshclam: kill -INT `cat /var/run/milter/freshclam.pid`"
 
        kill -INT `cat /var/run/milter/freshclam.pid`
 
fi
 
 
# stop clamd
 
if [ -r /var/run/milter/clamd.pid ]; then
 
        echo "Stopping clamd: kill -INT `cat /var/run/milter/clamd.pid`"
 
        kill -INT `cat /var/run/milter/clamd.pid`
 
fi
 
<esc>
 
:x
 
 
 
At this stage freshclam can be launched manually to initialize the virus database however clamd will fail as it requires a socket created by MIMEDefang when starting up. So we will delay clamd execution until MIMEDefang Sendmail with Milter are ready for use.
 
 
 
== Testing ClamAV ==
 
 
 
Don't run '''rc.local''' now. Download the ClamAV database first:
 
 
 
# freshclam
 
 
 
eicar.com is a test signature for ClamAV. Make sure it works for you.
 
 
 
# '''clamscan -r -l scan.txt ./'''[{{SERVER}}/slax/download/eicar.com eicar.com]
 
./eicar.com: Eicar-Test-Signature FOUND
 
 
----------- SCAN SUMMARY -----------
 
Known viruses: 4890369
 
Engine version: 0.99.2
 
Scanned directories: 0
 
Scanned files: 1
 
Infected files: 1
 
Data scanned: 0.00 MB
 
Data read: 0.00 MB (ratio 0.00:1)
 
Time: 6.302 sec (0 m 6 s)
 
  
 +
# mkdir -p /usr/local/include/sendmail
 +
# cp -R include/* /usr/local/include/sendmail/
 +
# cp -R sendmail/*.h /usr/local/include/sendmail/
 +
# cp obj.Linux.4.4.19.x86_64/*/*.a /usr/local/lib64/
 
<br/>
 
<br/>
  
{{pFoot|[[SpamAssassin]]|[[Main Page]]|[[Milter]]}}
+
{{pFoot|[[ClamAV]]|[[Main Page]]|[[MIMEDefang]]}}

Latest revision as of 23:32, 6 December 2017

What is Milter ?

The Milter (mail filter) interface of the sendmail program affords calling plugins to filter bounce or modify mails while they are being received. Sendmail must have been compiled with the Milter DEFINE. Milter must be installed before MIMEDefang, as MIMEDefang needs the libmilter library.

Installing Milter

Build libmilter, libsm, and verify that mailstats, makemap, and smrsh are already in place :

# /etc/rc.d/rc.sendmail stop
# cd /usr/local/sendmail-*
# cd libmilter
# sh Build
# sh Build install
# cd ..
# mv /usr/lib/libmilter.a /usr/local/lib64
# cd libsm
# sh Build
# sh Build install
# cd ..
# cp obj.Linux*/libsm/libsm.a /usr/local/lib64
# cd mailstats
# sh Build
# sh Build install
# cd ..
# cd makemap
# sh Build
# sh Build install
# cd ..
# cd smrsh
# sh Build
# sh Build install
# cd ..

Install headers and libraries for MIMEDefang. The name of the Linux directory will actually depend on your specific installation :

# mkdir -p /usr/local/include/sendmail
# cp -R include/* /usr/local/include/sendmail/
# cp -R sendmail/*.h /usr/local/include/sendmail/
# cp obj.Linux.4.4.19.x86_64/*/*.a /usr/local/lib64/


ClamAV Main Page MIMEDefang