Difference between pages "PhpMyAdmin" and "ClamAV"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Created page with "{{RightTOC}} == What is PhpMyAdmin ? == [http://www.phpmyadmin.net/home_page PhpMyAdmin] is a PHP application that affords managing MySQL databases. == Installing PhpMy...")
 
(Testing ClamAV)
 
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
== What is PhpMyAdmin ? ==
+
== What is ClamAV ? ==
  
[http://www.phpmyadmin.net/home_page PhpMyAdmin] is a PHP application that affords managing [[MySQL]] databases.
+
[http://www.clamav.net Clamav] is an Open Source antivirus.
  
== Installing PhpMyAdmin ==
+
== Installing ClamAV ==
  
[http://www.phpmyadmin.net/home_page/downloads.php Download] and install for example in a subdirectory of the Apache DocumentRoot or under /usr/local using a symbolic link. The files must be readable by the user running apache.
+
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''').
  
  # tar -C /usr/local -xvf phpMyAdmin-x.y.z.t-english.tar.gz
+
  # tar -C /usr/local -xvf clamav-x.y.tar.gz
  # cd /var/www/htdocs
+
  # cd /usr/local/
  # ln -s /usr/local/phpMyAdmin-x.y.z.t-english phpmyadmin
+
  # chown -R root:root clamav-x.y.z
  # cd phpmyadmin
+
  # cd clamav-x.y
  # cp config.sample.inc.php config.inc.php
+
  # ./configure --help | less
  # cd ..
+
# ./configure --libdir=/usr/local/lib64 --mandir=/usr/local/man \
  # chown -R apache:apache phpmyadmin
+
--sysconfdir=/etc --with-user=milter --with-group=milter
 +
# make
 +
# make install
 +
# make clean
 +
# ldconfig
 +
# groupadd milter
 +
# useradd -g milter -s /bin/false milter
 +
  # cd /var/log
 +
# mkdir -m 700 milter
 +
  # chown milter:milter milter
 +
# cd /var/run
 +
# mkdir -m 700 milter
 +
# chown milter:milter milter
 +
# cd /usr/local/share
 +
# mkdir clamav
 +
# chown milter:milter clamav
  
Edit '''config.inc.php''' to give a value (any string of '''max 46 characters''') to '''$cfg['blowfish_secret'] = <nowiki>''</nowiki>;''' that is used when '''$cfg['Servers'][$i]['auth_type'] = 'cookie';'''. Also add the lines '''$cfg['Servers'][$i]['socket'] = '/var/run/mysql/mysql.sock'; & $cfg['Servers'][$i]['connect_type'] = 'socket';'''. After that it should be possible to open page http://localhost/phpmyadmin using your browser.
+
== Configuring ClamAV ==
  
$cfg['blowfish_secret'] = 'mysecret'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
+
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 :
  /*
+
 
  * Servers configuration
+
# cd /etc
  */
+
# cp clamd.conf.sample clamd.conf
  $i = 0;
+
# vi clamd.conf
  /*
+
. . .
  * First server
+
  #Example
  */
+
LogFile /var/log/milter/clamd.log
  $i++;
+
PidFile /var/run/milter/clamd.pid
  /* Authentication type */
+
LocalSocket /var/spool/MIMEDefang/clamd.sock
  $cfg['Servers'][$i]['auth_type'] = 'cookie';
+
  TCPAddr 127.0.0.1
  /* Server parameters */
+
User milter
  $cfg['Servers'][$i]['host'] = 'localhost';
+
DetectBrokenExecutables yes
  $cfg['Servers'][$i]['socket'] = '/var/run/mysql/mysql.sock';
+
<esc>
  $cfg['Servers'][$i]['connect_type'] = 'socket';
+
:x
  $cfg['Servers'][$i]['compress'] = false;
+
# cp freshclam.conf.sample freshclam.conf
/* Select mysqli if your server has it */
+
# vi freshclam.conf
  $cfg['Servers'][$i]['extension'] = 'mysql';
+
. . .
  $cfg['Servers'][$i]['AllowNoPassword'] = false;
+
#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}}/wikislax/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)
  
 
<br/>
 
<br/>
  
{{pFoot|[[PHP]]|[[Main Page]]|[[MediaWiki]]}}
+
{{pFoot|[[SpamAssassin]]|[[Main Page]]|[[Milter]]}}

Revision as of 06:43, 7 July 2018

What is ClamAV ?

Clamav is an Open Source antivirus.

Installing ClamAV

Get the tarball from the 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).

# tar -C /usr/local -xvf clamav-x.y.tar.gz
# cd /usr/local/
# chown -R root:root clamav-x.y.z
# cd clamav-x.y
# ./configure --help | less
# ./configure --libdir=/usr/local/lib64 --mandir=/usr/local/man \
--sysconfdir=/etc --with-user=milter --with-group=milter
# make
# make install
# make clean
# ldconfig
# groupadd milter
# useradd -g milter -s /bin/false milter
# cd /var/log
# mkdir -m 700 milter
# chown milter:milter milter
# cd /var/run
# mkdir -m 700 milter
# chown milter:milter milter
# cd /usr/local/share
# mkdir clamav
# chown milter:milter clamav

Configuring ClamAV

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 ./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)


SpamAssassin Main Page Milter