Using clamd / spamd instead of clamscan / spamassassin in ispconfig 2

Discussion in 'Tips/Tricks/Mods' started by Croydon, Jun 15, 2010.

  1. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    I know this topic has come up several times here, so I decided to make a little shell script as I needed this myself.

    The script below works for debian lenny with ispconfig 2 installed.
    I do not guarantee that this will work for you, use it at your own risk

    Code:
    #!/bin/sh
    apt-get -q -y install clamav-daemon spamassassin
    
    /etc/init.d/ispconfig_server stop
    /etc/init.d/postfix stop
    
    sed -i -r "s/^CLAMSCAN=.*/CLAMSCAN=\/usr\/bin\/clamdscan/" /home/admispconfig/ispconfig/tools/clamav/bin/clamassassin
    sed -i -r "s/^ScanMail .*/ScanMail true/" /etc/clamav/clamd.conf
    
    sed -i -r "s/^NotifyClamd (.*)/#NotifyClamd \1/" /etc/clamav/freshclam.conf
    echo "NotifyClamd /etc/clamav/clamd.conf" >> /etc/clamav/freshclam.conf
    
    sed -i -r "s/^NotifyClamd (.*)/#NotifyClamd \1/" /home/admispconfig/ispconfig/tools/clamav/etc/freshclam.conf
    echo "NotifyClamd /etc/clamav/clamd.conf" >> /home/admispconfig/ispconfig/tools/clamav/etc/freshclam.conf
    
    sed -i -r "s/^ENABLED=.*/ENABLED=1/" /etc/default/spamassassin
    sed -i -r "s/^CRON=.*/CRON=1/" /etc/default/spamassassin
    
    sed -i -r "s/\| .*\-\-prefs\-file.*/\| \/usr\/bin\/spamc/" /root/ispconfig/isp/conf/spamassassin.rc.master
    find /var/www/ -name ".spamassassin.rc" -exec sed -i -r "s/\| \/home\/admispc.*\/spamassassin.*/\| \/usr\/bin\/spamc/" {} \;
    
    
    /etc/init.d/spamassassin restart
    /etc/init.d/ispconfig_server restart
    /etc/init.d/postfix restart
    
    
    echo "Update done." ;
    
    
    What this script does:
    - Switches from clamscan bundled with ispc to clamd to reduce server load
    - Switches from spamassassin bundled with ispc to spamd/spamc
    - Enables daily sa-update cron
    - changes all existing user spamassassin config files to use spamc

    You should have the debian volatile project in your apt sources.list!
     

Share This Page