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 15th June 2010, 20:55
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 932
Thanks: 16
Thanked 264 Times in 208 Posts
Post Using clamd / spamd instead of clamscan / spamassassin in ispconfig 2

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!
Reply With Quote
The Following 7 Users Say Thank You to Croydon For This Useful Post:
falko (16th June 2010), MasteRTriX (18th November 2010), mike4494 (22nd August 2010), oriongr (10th December 2010), radim_h (7th September 2010), Spaetzle (2nd November 2010), till (17th June 2010)
Sponsored Links
  #2  
Old 5th August 2010, 11:20
thctlo thctlo is offline
Junior Member
 
Join Date: Jun 2006
Posts: 9
Thanks: 2
Thanked 1 Time in 1 Post
Default

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.
Reply With Quote
  #3  
Old 6th September 2010, 11:51
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 932
Thanks: 16
Thanked 264 Times in 208 Posts
Default

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.
Reply With Quote
  #4  
Old 7th September 2010, 17:01
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

Yes, that should be possible. I've added it to our bugtracker.
__________________
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
  #5  
Old 7th October 2010, 13:18
Spaetzle Spaetzle is offline
Member
 
Join Date: Sep 2005
Posts: 56
Thanks: 3
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #6  
Old 8th October 2010, 13:40
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

Quote:
Originally Posted by Spaetzle View Post
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?
I think you need to redo them after an upgrade.
__________________
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
  #7  
Old 2nd November 2010, 18:38
Spaetzle Spaetzle is offline
Member
 
Join Date: Sep 2005
Posts: 56
Thanks: 3
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #8  
Old 3rd November 2010, 19:01
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

Quote:
Originally Posted by Spaetzle View Post
But I think an ISPCONFIG2 update only touches /root/ispconfig.
It also modifies the /home/admispconfig directory.
__________________
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
  #9  
Old 10th November 2010, 23:49
mini14 mini14 is offline
Member
 
Join Date: Oct 2010
Posts: 66
Thanks: 2
Thanked 3 Times in 3 Posts
Default

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.
Reply With Quote
  #10  
Old 21st December 2010, 19:44
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 932
Thanks: 16
Thanked 264 Times in 208 Posts
 
Default

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 "  \;
Reply With Quote
Reply

Bookmarks

Tags
clamd, clamscan, spamassassin, spamc, spamd

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clamd terminating too quickly? BorderAmigos Installation/Configuration 2 5th April 2010 16:33
ISPConfig 3.0.1 released till General 36 29th March 2009 15:30
Loads of mysql connections to dbispconfig StrikerNL General 2 5th March 2009 15:31
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 14:06
How to config spamassassin and clamAV in ISPconfig? tom Installation/Configuration 16 25th May 2006 06:24


All times are GMT +2. The time now is 01:56.


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