Apache SpamAssassin global enable anyone?

Mibble

Active Member
Apr 2, 2005
34
0
156
hi there,
once spamassassin is upgraded on a server, each and every domain has spamassassin and the spamassassin box disabled.
is there anyway to re-enable these things globally, so i do not have to go into each and every domain?
thanks,

John
 

mahinder

Well-Known Member
Jun 12, 2003
69
0
156
matrix
I am also looking for similar solution since last many many months. Most of users do not enable spamassassin by default and their email boxes grow to their quota limits causing bounce backs which are also caught by spamtrapps resulting in server being blacklisted by spamcop and other rbls. PLEASE PLEASE PROVIDE OPTION TO FORCE ENABLE SPAMASSASSIN AND SPAM BOX ON ALL ACCOUNTS ON SERVER. ITS JUST NOT POSSIBLE TO LOGIN TO EACH ACCOUNT AND ENABLE SPAMASSASSIN WHEN YOU HAVE 10'S OF SERVER WITH 100s of domains on each server.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,465
30
473
Go on, have a guess
mahinder said:
PLEASE PLEASE PROVIDE OPTION TO FORCE ENABLE SPAMASSASSIN AND SPAM BOX ON ALL ACCOUNTS ON SERVER. ITS JUST NOT POSSIBLE TO LOGIN TO EACH ACCOUNT AND ENABLE SPAMASSASSIN WHEN YOU HAVE 10'S OF SERVER WITH 100s of domains on each server.
Please don't use CAPS it is considered shouting.
 

Mibble

Active Member
Apr 2, 2005
34
0
156
perhaps he is trying to make a point?
 

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,221
4
193
Minneapolis, MN
Mibble said:
once spamassassin is upgraded on a server, each and every domain has spamassassin and the spamassassin box disabled.
is there anyway to re-enable these things globally, so i do not have to go into each and every domain?
Since there is no option in the WHM to enable/activate SpamAssassin for every account, you can write a shell or Perl script to do that.
 

mahinder

Well-Known Member
Jun 12, 2003
69
0
156
matrix
AndyReed said:
Since there is no option in the WHM to enable/activate SpamAssassin for every account, you can write a shell or Perl script to do that.
I am sorry for using caps, i didn't knew its considered shouting, will not do this again. but, I wanted to make my point louder. You try transferring accounts from one server to another one. You will find that spamassassin get deactivate on new server. This creates huge headache for us. I am going to email cpanel and request them for this feature. I will also send them chocolates once its available in WHM for saving lots of my time and headache dealing with RBL's. :D

about the script, I tried thinking about it but it seems very difficult. I will do more research tomorrow. :)

Edit: should i lowercase words in previous post?
 
Last edited:

Imai

Well-Known Member
Aug 11, 2003
45
0
156
Need this feature

I am interested in this feature combined with a global 'Clear Spam Box'.
I have customers who never login to cpanel only to come back with they can't receive mails.
Thank You
 

mahinder

Well-Known Member
Jun 12, 2003
69
0
156
matrix
i have written this script to enable spamassassin and spambox on all users till cpanel provide this option in WHM, i have tried it on one server and seems to work fine. here is kiddy script

Code:
#! /bin/sh
M_FILENAME=$1
#echo $M_FILENAME
M_USERNAME=`find $M_FILENAME -printf %f`
#echo $M_USERNAME

touch /home/$M_USERNAME/.spamassassinenable
chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinenable
touch /home/$M_USERNAME/.spamassassinboxenable
chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinboxenable

echo $M_USERNAME complete
echo
Now save above script and name it /root/enabless.sh and change to chmod 700. now call script like this

find /var/cpanel/users -type f -exec /root/enabless.sh {} \;

this will create
.spamassassinenable
and
.spamassassinboxenable
file in ALL users home directory on server which will enable spamassassin and spambox for domain. works fine on my server. use code on your own risk however it should do no harm to your server.
 

Daniel15

Well-Known Member
Oct 7, 2006
86
1
156
Palo Alto, CA (originally Melbourne, Australia)
cPanel Access Level
Website Owner
Twitter
i have written this script to enable spamassassin and spambox on all users till cpanel provide this option in WHM, i have tried it on one server and seems to work fine. here is kiddy script

Code:
#! /bin/sh
M_FILENAME=$1
#echo $M_FILENAME
M_USERNAME=`find $M_FILENAME -printf %f`
#echo $M_USERNAME

touch /home/$M_USERNAME/.spamassassinenable
chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinenable
touch /home/$M_USERNAME/.spamassassinboxenable
chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinboxenable

echo $M_USERNAME complete
echo
Now save above script and name it /root/enabless.sh and change to chmod 700. now call script like this

find /var/cpanel/users -type f -exec /root/enabless.sh {} \;

this will create
.spamassassinenable
and
.spamassassinboxenable
file in ALL users home directory on server which will enable spamassassin and spambox for domain. works fine on my server. use code on your own risk however it should do no harm to your server.
Thanks for that, it's a very nice script, and works fine :D
 

gotini2004

Member
Feb 9, 2004
11
0
151
dumm question

ok, the script is great,
so my question is what about the /home/username/.spamassasin directory and the files in it - files like user_prefs and so on ?

thanks
 

Daniel15

Well-Known Member
Oct 7, 2006
86
1
156
Palo Alto, CA (originally Melbourne, Australia)
cPanel Access Level
Website Owner
Twitter
ok, the script is great,
so my question is what about the /home/username/.spamassasin directory and the files in it - files like user_prefs and so on ?

thanks
I personally just modified the script to copy my .spamassassin directory over, and chown it. I believe it was something like:
Code:
cp /home/dansoft/.spamassassin /home/$M_USERNAME/ -R
chown $M_USERNAME:$M_USERNAME /home/$M_USERNAME/.spamassassin
Right above the echo $M_USERNAME complete line (with /home/dansoft/.spamassassin being an existing spamassassin directory).

But, I've removed this now, and I'm just using MailScanner server-wide :D
 

brianoz

Well-Known Member
Mar 13, 2004
1,146
7
168
Melbourne, Australia
cPanel Access Level
Root Administrator
i have written this script to enable spamassassin and spambox on all users till cpanel provide this option in WHM, i have tried it on one server and seems to work fine. here is kiddy script

Code:
#! /bin/sh
M_FILENAME=$1
#echo $M_FILENAME
M_USERNAME=`find $M_FILENAME -printf %f`
#echo $M_USERNAME

touch /home/$M_USERNAME/.spamassassinenable
chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinenable
touch /home/$M_USERNAME/.spamassassinboxenable
chown $M_USERNAME.$M_USERNAME /home/$M_USERNAME/.spamassassinboxenable

echo $M_USERNAME complete
echo
Now save above script and name it /root/enabless.sh and change to chmod 700. now call script like this

find /var/cpanel/users -type f -exec /root/enabless.sh {} \;

this will create
.spamassassinenable
and
.spamassassinboxenable
file in ALL users home directory on server which will enable spamassassin and spambox for domain. works fine on my server. use code on your own risk however it should do no harm to your server.
Urk :p I think that's the most marvellously creative use of find(1) I've seen in years of teaching shell scripting, well done! ;)

Purely from a scripting point of view, a far simpler form of this would be:

Code:
cd /home
for user in `ls /var/cpanel/users`
do
     test ! -d $user && continue
     touch  $user/.spamassassinenable $user/.spamassassinboxenable
     chown $user.$user  $user/.spamassassinenable $user/.spamassassinboxenable
     echo $user complete
done
Save it in a file and run it once as a shell script.
 

d-woo

Well-Known Member
Aug 9, 2003
88
0
156
Enabling Spamassassin for All Accounts

I have Spam Assassin 3.1.7

I have just migrated about 75 sites to a new server...all secured by ramprage (great job at WebhostingGear.com)

The default setting for all accounts in cPanel is SpamAssasin (SA) disabled.

I want to do both of these:
---------------------------------
a. setup the skeleton directory (/root/cpanel3-skel/) to have all future added accounts SA enabled.
b. SA enable all current accounts (located in /var/cpanel/users)

What I am seeing is that an account that has never had an email account or been SA enabled looks like this (screenshots from using WinSCP):
Pic01


and that the same account after turning on SA looks like this:
Pic02



It appears that I need to have:
1. the file .spamassassinenable
and
2. the folder .spamassassin

No Problem.

Now, my question is around the contents of the folder, .spamassassin

On a newly enabled account, it looks like this:
Pic03


But on an account that has been around the block for a while, the contents of the folder, .spamassassin looks like this:
Pic04


2 Questions:
1. If I am writing a script to enable all accounts in /var/cpanel/users to be SA enabled, what files should be in the folder, .spamassassin?

2. Will the bayes files and the auto-whitelist file get added/written automatically to the .spamassassin folder as that email account is used?
The bayes files could be older data from my old server when I used to run MailScanner....not sure.

I need to know this, so I will determine which files go in the master .spamassassin folder that I will be copying from to all users.
 
Last edited:

d-woo

Well-Known Member
Aug 9, 2003
88
0
156
It turns out that my SpamAssassin (3.1.7) is configured for the entire server.

So, all I need to do is add the file .spamassassinenable to each /home/<user> directory

I placed a copy of that file in /master_files/SA/.spamassassinenable

Here is the script: /my_scripts/SA_enable_all

Code:
#! /bin/sh
cd /home
for user in `ls /var/cpanel/users`
do
     test ! -d $user && continue

	rm -rf /home/$user/.spamassassinenable

	cp /master_files/SA/.spamassassinenable /home/$user/ -R
	chown $user:$user /home/$user/.spamassassinenable

     echo $user complete
done
chmod it as 700
[/#] chmod 700 /my_scripts/SA_enable_all

run the script
[/#] cd /my_scripts
[/#] ./SA_enable_all


All existing accounts are now enabled


New Accounts

place a copy of /master_files/SA/.spamassassinenable in /root/cpanel3-skel
[/#] cp /master_files/SA/.spamassassinenable /root/cpanel3-skel/

Any new accounts will be SA enabled
 
Last edited:

d-woo

Well-Known Member
Aug 9, 2003
88
0
156
Are you running SpamAssassin under Mail Scanner or are you running SA it by itself?

What version are you using?

Steve at WebHostingGear.com hooked me up with a sweet global configuration of SA.

I don't know what he did, but my server load is averaging like .04 and we are getting very few junk mails through.
 

mickalo

Well-Known Member
Apr 16, 2002
782
5
318
N.W. Iowa
Are you running SpamAssassin under Mail Scanner or are you running SA it by itself?

What version are you using?

Steve at WebHostingGear.com hooked me up with a sweet global configuration of SA.

I don't know what he did, but my server load is averaging like .04 and we are getting very few junk mails through.
we're running Ver., 3.1.7, lastest I believe.

we are currently running SA alone, without MailScanner, but have been seriously considering switiching over to Chirpy's Cpanel MailScanner package. I've fine tunned our SA over the past week and have reduced our overall total spam atleast 95%, but the drawback is SA uses about 15% more memory then our normal usage. CPU usuage doesn't seem too bad, but memory is an issue sometimes, but we do run 1GB ram, with very little Swap, usually less a couple of percent.

Can you share the global configuration ?

TIA,
Mickalo
 

d-woo

Well-Known Member
Aug 9, 2003
88
0
156
Here is my /etc/mail/spamassassin/local.cf

Code:
# SpamAssassin config file for version 3.x
# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6
# See http://www.yrex.com/spam/spamconfig25.php for earlier versions
# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)

# How many hits before a message is considered spam.
required_score           4.8

# Change the subject of suspected spam
rewrite_header subject         {Spam?}

# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)
report_safe             0

# Enable the Bayes system
use_bayes               1
use_bayes_rules         1

# Enable Bayes auto-learning
bayes_auto_learn        1
bayes_min_ham_num               1000
bayes_min_spam_num      1000
bayes_learn_during_report       1

# Enable or disable network checks
skip_rbl_checks         0
razor_config /var/spool/mqueue/.razor/razor-agent.conf
dcc_home /var/dcc

use_pyzor               1
#pyzor_path		/usr/local/bin/pyzor
#pyzor_max		0
#pyzor_options --homedir /etc/mail/spamassassin


# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
# ok_languages            all

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
  ok_locales              all

# Handle header info
add_header spam Flag _YESNOCAPS_
add_header all Status _YESBO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_
# add header all Level _STARS(*)_
# add header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_
 

superiorhost

Well-Known Member
Nov 16, 2001
77
0
306
cPanel Access Level
Root Administrator
Hi D-woo,
It looks like he also installed razor in your server too...
your not running just spamasassin. It is looking at your razor and pyzor configs... those are not on a standard cpanel server until installed.

However, it sounds like your getting great results from your set up.

Tim L
 

mickalo

Well-Known Member
Apr 16, 2002
782
5
318
N.W. Iowa
Which folders to actual use

I've noticed that there are two folders that SA seems to use, 1) /usr/share/spamassassin and 2) /etc/mail/spamassassin which is where we have been putting are updates into(folder 2).

Now I thought the files in the /usr/share/spamassassin location wouldn't really been needed and wanted to trim down the amount of files SA needs to read, but after deleting the files in location 1, Spamd constantly fails and is constantly restarted. What files in the /usr/share/spamassassin location must be there? And can those file(s) be moved into the /etc/mail/spamassassin folder location.

I just want to keep things easy to maintain, so we don't have files spread all over the place. Apparently there must a file or files that Spamassassin requires(for Cpanel), otherwise it constantly fails.

We also use RulesDuJour add-on which puts it's updates into the /etc/mail/spamassassin folder location. So what needs to be kept in the /usr/share/spamassassin location so Spamd doesn't fail??

TIA,
Mickalo