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!
I would be great if this would be made default in ispconfig2 nexts update. less compiling, faster updates for debian. Thank you for the script.
I just realized a problem with switching to spamd/spamc. All the SA user config files (like .user_prefs) are created by ispconfig as owner "root". As spamd/spamc changes the running user to the mailbox owner it is not able to write those config files or tmp/lock files into the .spamassassin directory. I don't know what further effects this could have (aside from writing lots of permission denied entries to the mail log). @falko/till: would it be possible to make ispconfig2 change the ownership of those files and the directory to the mailbox owner? This should not be a problem even if you don't use spamd/spamc.
As I have some problems with lots of clamscans too I am interested in that to. If I do the changes proposed by Croydon do I need to redo them after each upgrade of ISPConfig or are those changes untouched by a new Version? Wouldn't it be a good thing to build in a switch into ispconfig letting anybody choose what to use? clamd and spamd or clamscan and spamassassin. Best regards Bernd
I used this hint now. It saved my day as my mashines where going down several times having loads of 100% and hundreds of clamscan processes running ... After changing to clamd/spamd I have not noticed any higher load any more. So kudos to Croydon. If there will be an upgrade to ISPconfig I think I only need to do the following steps: Code: /etc/init.d/ispconfig_server stop sed -i -r "s/\| .*\-\-prefs\-file.*/\| \/usr\/bin\/spamc/" /root/ispconfig/isp/conf/spamassassin.rc.master /etc/init.d/ispconfig_server restart Or do I need to do more. But I think an ISPCONFIG2 update only touches /root/ispconfig. Or am I wrong with that? Best regards Bernd
What would be the procedure to make this swap on a Centos box? I notice spamassassin taking up quite a bit of processor power at times.
I had some thoughts about how I could change all the ownerships of the files in the mail user directory with one single command. So here comes the command - use it at your own risk. I don't think that it harms anything - but who knows Code: find /var/www/ -user root -wholename "*/user/w*" -exec sh -c "(dirname {} | sed -r \"s/.*\/user\/(([^_]+)_[^\/]+)(\/.*)?/chown -v \1:\2 /\" ; echo {}) | xargs echo | xargs -0 sh -c " \;
I think it will only work if you did not change the user prefix in ISPConfig admnistration. If you did you it must be something like Code: find /var/www/ -user root -wholename "*/user/[user_prefix]* ... Or am I wrong with that? Did some one already test this piece of code? Regards Bernd
You are right. If you change the prefix you have to change the command. I tested the code on a default ispc install on debian lenny, it worked for me (as far as I can see).