Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 14th October 2007, 14:48
bernie2004 bernie2004 is offline
Junior Member
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 6 Times in 1 Post
Default update and switch to clamd on ubuntu 7.04

this is what i did since clamav was stalling the server:

Code:
> apt-get install libgmp3-dev
> cd /some-build-directory
> wget http://ovh.dl.sourceforge.net/sourceforge/clamav/clamav-0.91.2.tar.gz
> tar xzf c*0.91.2*gz
> cd c*0.91.2
libgmp3-dev will enable verifying digital signatures (http://www.clamav.net/support/faq)

Code:
> ./configure --prefix=/home/admispconfig/ispconfig/tools/clamav \
              --sysconfdir=/home/admispconfig/ispconfig/tools/clamav/etc \
              --with-user=admispconfig \
              --with-group=admispconfig \
              --disable-clamav \
              --disable-bzip2
> make
> make install
> cp -f COPYING /home/admispconfig/ispconfig/tools/clamav/
edit clamassassin
Code:
> vi /home/admispconfig/ispconfig/tools/clamav/bin/clamassassin
Code:
CLAMSCAN=/home/admispconfig/ispconfig/tools/clamav/bin/clamdscan
create logfolder
Code:
> mkdir /var/log/clamav
> chown admispconfig:admispconfig /var/log/clamav
edit clamav.conf or clamd.conf
( clamd.conf should be a link to clamav.conf )
Code:
> vi /home/admispconfig/ispconfig/tools/clamav/etc/clamav.conf
or
> vi /home/admispconfig/ispconfig/tools/clamav/etc/clamd.conf
Code:
LogFile /var/log/clamav/clamd.log
ScanMail 1
edit freshclam.conf
Code:
> vi /home/admispconfig/ispconfig/tools/clamav/etc/freshclam.conf
Code:
UpdateLogFile /var/log/clamav/freshclam.log
NotifyClamd /home/admispconfig/ispconfig/tools/clamav/etc/clamd.conf
create startup script for clamd
( took it from the clamav-daemon package )
Code:
> vi /etc/init.d/clamav-daemon
Code:
#! /bin/sh
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#               Clamav version by Magnus Ekdahl <magnus@debian.org>
#               Heavily reworked by Stephen Gran <sgran@debian.org>
#
### BEGIN INIT INFO
# Provides:          clamav-daemon
# Required-Start:    $syslog
# Should-Start:      
# Required-Stop:
# Should-Stop:       
# Default-Start:     2 3 4 5
# Default-Stop:      0 6
# Short-Description: ClamAV daemon
# Description:       Clam AntiVirus userspace daemon
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/home/admispconfig/ispconfig/tools/clamav/sbin/clamd
NAME="clamd"
DESC="ClamAV daemon"
CLAMAVCONF=/home/admispconfig/ispconfig/tools/clamav/etc/clamd.conf
SUPERVISOR=/usr/bin/daemon
SUPERVISORNAME=daemon
SUPERVISORPIDFILE="/var/run/clamav/daemon-clamd.pid"
SUPERVISORARGS="--name=$NAME --respawn $DAEMON -F $SUPERVISORPIDFILE"
SUPERVISORPIDDIR="$(dirname $SUPERVISORPIDFILE)"
CLAMUSER="$(grep "^User" ${CLAMAVCONF} | awk '{print $2}')"
CLAMSOCKETDIR="$(dirname $(grep "^LocalSocket" ${CLAMAVCONF} | awk '{print $2}'))"


[ -x "$DAEMON" ] || exit 0
[ -r /etc/default/clamav-daemon ] && . /etc/default/clamav-daemon
. /lib/lsb/init-functions

if [ ! -f "$CLAMAVCONF" ]; then
  log_failure_msg "There is no configuration file for Clamav."
  log_failure_msg "Please either dpkg-reconfigure $DESC, or copy the example from"
  log_failure_msg "/usr/share/doc/clamav-base/examples/ to $CLAMAVCONF and run"
  log_failure_msg "'/etc/init.d/clamav-daemon start'"
  exit 1;
fi

if grep -q "^Example" $CLAMAVCONF; then
  log_failure_msg "Clamav is not configured."
  log_failure_msg "Please edit $CLAMAVCONF and run  '/etc/init.d/clamav-daemon start'"
  exit 0
fi

if egrep -qi "^Foreground[[:space:]]*(yes|true|1)" $CLAMAVCONF; then
  if [ ! -x "$SUPERVISOR" ] ; then
     log_failure_msg "Foreground specified, but $SUPERVISORNAME not found"
     exit 0
  else
     RUN_SUPERVISED=1
  fi
fi

THEPIDFILE="`grep ^PidFile $CLAMAVCONF | awk '{print $2}'`"
[ -n "$THEPIDFILE" ] || THEPIDFILE='/var/run/clamav/clamd.pid'

if [ -z "$RUN_SUPERVISED" ]; then
  if [ -f "$THEPIDFILE" ]; then
    PID=`pidofproc -p $THEPIDFILE $DAEMON`
    RUNNING=$?
  else
    PID=`pidofproc $DAEMON`
    RUNNING=$?
  fi
else
  [ -e "$SUPERVISORPIDFILE" ] && PID=`cat $SUPERVISORPIDFILE`
fi

[ "$PID" = '1' ] && unset PID

case "$1" in
  start)
  [ -x $CLAMSOCKETDIR ] && chown $CLAMUSER $CLAMSOCKETDIR -R
  [ -x $SUPERVISORPIDDIR ] && chown $CLAMUSER $SUPERVISORPIDDIR -R
  OPTIND=1
  if [ -z "$RUN_SUPERVISED" ] ; then
    log_daemon_msg "Starting $DESC" "$NAME "
    start_daemon -p $THEPIDFILE $DAEMON
    ret=$?
  else 
    log_daemon_msg "Starting $DESC" "$NAME (supervised) "
    $SUPERVISOR $SUPERVISORARGS
    ret=$?
  fi
  log_end_msg $ret
  ;;
  stop)
  log_daemon_msg "Stopping $DESC" "$NAME"
  OPTIND=1
  if [ -n "$PID" ]; then
    kill -15 -"$PID"
    ret=$?
    sleep 1
    if kill -0 "$PID" 2>/dev/null; then
      ret=$?
      log_progress_msg "Waiting . "
      cnt=0
      while kill -0 "$PID" 2>/dev/null; do
        ret=$?
        cnt=`expr "$cnt" + 1`
        if [ "$cnt" -gt 15 ]; then
          kill -9 -"$PID"
          break
        fi
        sleep 2
        log_progress_msg ". "
      done
    fi
  else
    if [ -z "$RUN_SUPERVISED" ] ; then
      killproc -p $THEPIDFILE
      ret=$?
    else
      killproc -p $SUPERVISORPIDFILE
      ret=$?
    fi
  fi
  if [ -n "$ret" ]; then
    log_end_msg $ret
  else
    log_end_msg $?
  fi
  ;;
  status)
  case "$RUNNING" in
    0) log_success_msg "$NAME is running."
    ;;
    1) log_warning_msg "$NAME is not running, but pidfile $THEPIDIFILE exists."
    ;;
    3) log_failure_msg "$NAME is not running."
    ;;
    *) log_failure_msg "$NAME is unknown."
    ;;
  esac
  ;;
  restart|force-reload)
  $0 stop
  $0 start
  ;;
  reload-database)
  OPTIND=1
  log_daemon_msg "Reloading database for $DESC" "$NAME"
  killproc -p $THEPIDFILE $DAEMON USR2
  log_end_msg $?
  ;;
  reload-log)
  OPTIND=1
  log_daemon_msg "Reloading log file for $DESC" "$NAME"
  killproc -p $THEPIDFILE $DAEMON 1
  log_end_msg $?
  ;;
  *)
  log_failure_msg "Usage: $0 {start|stop|restart|force-reload|reload-log|reload-database|status}" >&2
  exit 1
  ;;
esac

exit 0
install the script
Code:
> update-rc.d clamav-daemon defaults
run freshclam
Code:
> cd /home/admispconfig/ispconfig/tools/clamav/bin
> ./freshclam

ClamAV update process started at Sun Oct 14 14:07:17 2007
main.cvd is up to date (version: 44, sigs: 133163, f-level: 20, builder: sven)
daily.inc is up to date (version: 4540, sigs: 26673, f-level: 21, builder: ccordes)
start clamd
restart ispconfig
Code:
> /etc/init.d/clamav-daemon start
> /etc/rc.d/init.d/ispconfig_server restart
got eicar testfile from
http://www.eicar.org/anti_virus_test_file.htm
send a mail and checked the log:

Code:
+++ Started at Sun Oct 14 14:25:32 2007
clamd daemon 0.91.2 (OS: linux-gnu, ARCH: i386, CPU: i686)
Running as user admispconfig (UID 116, GID 116)
Log file size limited to 1048576 bytes.
Reading databases from /home/admispconfig/ispconfig/tools/clamav/share/clamav
Not loading PUA signatures.
Loaded 159835 signatures.
Unix socket file /home/admispconfig/ispconfig/temp/clamd
Setting connection queue length to 15
Archive: Archived file size limit set to 10485760 bytes.
Archive: Recursion level limit set to 5.
Archive: Files limit set to 1000.
Archive: Compression ratio limit set to 250.
Archive support enabled.
Algorithmic detection enabled.
Portable Executable support enabled.
ELF support enabled.
Mail files support enabled.
Mail: Recursion level limit set to 64.
OLE2 support enabled.
PDF support disabled.
HTML support enabled.
Self checking every 1800 seconds.
stream 1688: Eicar-Test-Signature FOUND

if you find anything wrong
please feel free to notify me.

Last edited by bernie2004; 14th October 2007 at 14:51.
Reply With Quote
The Following 6 Users Say Thank You to bernie2004 For This Useful Post:
bwragg (7th September 2008), daveb (24th April 2008), falko (15th October 2007), mccharlet (11th January 2008), rockstar9840 (5th November 2010), till (14th October 2007)
Sponsored Links
  #2  
Old 28th April 2008, 23:52
itsimon itsimon is offline
Junior Member
 
Join Date: Feb 2008
Posts: 25
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Could you post an instruction about how to swith to clamd in other version of linux? e.g Redhat. It will be great if you do that. Cheers.
Reply With Quote
  #3  
Old 29th April 2008, 09:21
jbravo jbravo is offline
Member
 
Join Date: Nov 2007
Location: Poland
Posts: 81
Thanks: 12
Thanked 3 Times in 2 Posts
Default

There are many posts about it. Please search forum first.
It's easy to find out how to use your distribution supplied clamav daemon (clamd).
Edit
Code:
/home/admispconfig/ispconfig/tools/clamav/bin/clamassassin
file and change CLAMSCAN value to clamd absolute path, for example (SLES10SP1):
Code:
CLAMSCAN=/usr/bin/clamdscan
Also edit ispconfig startup file
Code:
/etc/init.d/ispconfig_server
and comment out freshclam startup/shutdown lines and use your distribution freshclamd daemon.

Above solution (topic author's) did not require to do that - but personally i prefer this one.
__________________
--
GreetZ .:JbRaVo:.
ISPConfig 3.0.5.2 @ mail&web @ RHEL6.4,
ISPConfig 2.2.29@mailsrv & 2.2.38@websrv @ SLES10SP4
Reply With Quote
  #4  
Old 6th September 2008, 00:02
bwragg bwragg is offline
Member
 
Join Date: Jul 2006
Posts: 58
Thanks: 7
Thanked 3 Times in 2 Posts
Default

If your trying to get this working on centos check out

http://www.howtoforge.com/forums/showthread.php?t=16723

and

http://www.howtoforge.com/forums/showthread.php?t=12864 Page 2

This helped me fix the above init.d script as it didn't work on centos.

Cheers,

bwragg
Reply With Quote
The Following 2 Users Say Thank You to bwragg For This Useful Post:
elena21 (27th February 2009), rockstar9840 (5th November 2010)
  #5  
Old 12th June 2010, 04:33
Olive Olive is offline
Junior Member
 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great posts. Thanks for the responses, I used to have the same problems but your solutions worked for me. Great help!
Reply With Quote
  #6  
Old 16th June 2010, 16:23
Science Magazine Science Magazine is offline
Junior Member
 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am new to open source software / operating systems and this forum will be helpful. Thanks for posting the solutions. Is there any link to common issues in Linux?
Reply With Quote
  #7  
Old 17th June 2010, 18:08
Science Magazine Science Magazine is offline
Junior Member
 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any links / tutorials?
__________________
http://eurekamag.com/
Reply With Quote
  #8  
Old 26th June 2010, 09:20
SarahDenise SarahDenise is offline
Junior Member
 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yep! I too need links. I am encountering so much error messages from the server. I am an ojt here in our company and i am assigned to correct this one.
__________________
http://www.gamesgames3.com
Reply With Quote
  #9  
Old 27th June 2010, 06:49
B. Osbourne B. Osbourne is offline
Junior Member
 
Join Date: Jun 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi! I tried following the script in this post but I am not getting it I just get an error message.
__________________
http://www.wix.com
Reply With Quote
  #10  
Old 27th June 2010, 13:55
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
 
Default

What's the exact error message?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:50.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.