Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Where do I configure spamassassin in Mountain Lion Server?

Where, in Mountain Lion Server, can I configure SpamAssassin?


I've tried modifying /Library/Server/Mail/Config/spamassassin/local.cf, but the changes I made there don't have any effect.

Mac mini, Mac OS X (10.7)

Posted on Aug 5, 2012 8:51 PM

Reply
74 replies

Jun 5, 2014 4:45 PM in response to Matt Domenici

Matt,


Very cool, I ran that and got it all set up. Thanks!


Just a couple more questions.


Does this use/start with what was learned from spamassasin, or does this start over from nothing? Just asking since my boss has gotten over 600 spam so far today, and before he would normally get 250-400 for the whole day. Still unclear if this tags and delivers, or deletes, or if there is even an option to deine that.


This is completely separate from the RBLs as far as I know. If you don't mind me going a bit off topic, do you happen to know the right way to white list domains and IPs in the RBLs? I found and entered this, but I'm not exactly sure it's working:


sudo serveradmin settings mail:postfix:add_whitelist_domain = somedomain.com


sudo serveradmin settings mail:postfix:add_whitelist_host = 50.365.261.164


If this is proper and correct, then do you know the right command to do it on SL server? These commans don't work there.


Thanks again for your help,

Scott

Jun 5, 2014 5:23 PM in response to scottl31

Hi Scott,


spamtrainer is simply using the same database that the Apple script was -- in fact, if you read about how amavisd works, you'll see more about how these things all fit together.


What gets delivered or not is a function of your junk mail filtering setup in the mail server. In Server.app you can set a value for spam scores, which uses both the database you are training, along with other rule sets that are downloaded, to filter the mail. There's some pretty amazing things you can do on this front -- but they go above and beyond what's shown in the GUI. I'd suggest reading up on how the MTA (mail transfer agent) works in relation to amavisd to get a better understanding regardless if you want to use these more powerful capabilities (or not.)


RBLs are used by the Server to stop messages from known spammers. You can configure them in Server.app. The whitelisting you are doing is specifically to allow a message through from a specific destination. And on that note, one point of clarification, are you on Snow Leopard Server, and using Server Admin, or Sever.app on a later OS release?


You may also want to learn more about using sieve to manage spam and route it into the appropriate junk mail boxes. You can do this separately or by installing webmail, which includes often the ability to setup the filtering server side. (Webmall was included with earlier OS releases though, hence my question about me wanting to verify which OS release you are on.)

Jun 5, 2014 6:25 PM in response to Matt Domenici

Matt,


The server I have been setting up the spam trainer on is ML, and that's the one that is for the company web and mail, and it only has the one domain on it.


We also have a SL server which is the one I started out with. That one I have set up about 12 domains. It's mostly for sites we set up for local artists to promote their books, which we are the printer for. We only have a few mail accounts on that one, and they hardly get any spam at all. The only problem is those RBL whitelist commands that seemed to work on ML don't work on this one.

Jun 6, 2014 10:33 AM in response to Matt Domenici

Hey Matt,


Sorry to bother, but eventually I'll be able to fly. This morning, the junkmail account was still full even though I set it for 2:15 am. So I looked back at the setup output and it looks like I botched the input for the time.


So then I ran -i (-i to install/check the automatic startup item) again and it asks me if I want to disable the spamtrainer plist. I say no and it exits with no options update the installation. Do I have to go through and disable everything and reenable it?


So I went and edited the com.topicdesk.spamtrainer.plist file to a time in the near future and it did not run. Sigh. So would you mind looking at my setup output for any clues of what might be amiss?:




Checking if there is a startup item for 'learn_junk_mail' or 'spamtrainer'


There IS a plist for learn_junk_mail

... and it is ENABLED

If you want to use 'spamtrainer' it is RECOMMENDED that this be disabled

Would you like me to disable it for you (yes/no)

yes

'learn_junk_mail' item has been disabled'

You can ignore 'No such process' error messages


There IS NO plist for spamtrainer

if you want to use 'spamtrainer' it is recommended that this be added

Would you like me to enable it for you (yes/no)

yes

What time would you like spamtrainer to run (24-hour format)?

Please enter the hour (1)

02:15

Please enter the minutes (0)

o215

Would you like SPAM/HAM messages to be deleted after the learn process? (n)

y

Would you like to log bayes stats into /var/log/spamtrainer.log? (n)

y

If you would you like to have spamtrainer mail you a report after it runs, then please enter an e-mail address. Enter for no (n)

name@comcast.net

Enter name of mail store with SPAM/HAM mailboxes? Enter for default (default)


Enter name of mailbox with SPAM? Enter for default (junkmail)


Enter name of mailbox with HAM? Enter for default (notjunkmail)


A plist with the following parameters for 'spamtrainer' has been prepared

/usr/sbin/spamtrainer -m name@comcast.net -d -l

It will run each day at 02:15:o215

Would you like to add and enable it? (yes/no)

yes

launchctl: no plist was returned for: /Library/LaunchDaemons/com.topicdesk.spamtrainer.plist

launchctl: no plist was returned for: /Library/LaunchDaemons/com.topicdesk.spamtrainer.plist

nothing found to load

The following launchd plist item for 'spamtrainer' has been enabled'

/usr/sbin/spamtrainer -m name@comcast.net -d -l

It will run each day at 02:15:o215


prepress:~ server2$

Jun 6, 2014 10:59 AM in response to scottl31

This doesn't look quite right to me:





What time would you like spamtrainer to run (24-hour format)?

Please enter the hour (1)

02:15

Please enter the minutes (0)

o215



Wouldn't the correct response be 02 to the first prompt and 15 to the second one?

Did spamtrainer send you an email after you set it up the previous evening to run?


Message was edited by: Matt Domenici, correct a typo

Jun 6, 2014 2:18 PM in response to Matt Domenici

Right. It does look wrong, that's why I thought it didn't run. But going in with -i again just asks if I want to disable it. If I say no, it exits with no options to update the installation. Do I have to go through and disable everything and reenable it?


It didn't send me an email when I set it up, only when I ran it with -m.


Also, back to what you were saying about everything working together, does that mean that the Cautious-->Agressive slider in Server.app still works along with spam trainer?

Jun 6, 2014 2:57 PM in response to scottl31

I would disable and then re-enable spamtrainer, so you can setup the run times again and specify all the options you would like, including deleting spam and ham from the respective mailboxes, if you choose to do so.


With regards to your question around the slider in Server.app, yes, it does work with spamtrainer. Again, spamtrainer has nothing to do with the core filtering mechanism, with the exception that it is updating the Bayesian databases. The slider you manipulate in Server.app is actually updating values in the amavisd.conf file. spamtrainer doesn't impact the amavisd process really at all, beyond keeping the databases trained.

Jun 7, 2014 7:35 AM in response to Matt Domenici

Hey Matt,


Looks like success!


I ran the setup again and correctly entered the time. I didn't get the email until 2:40 am even though it was set for 2:15. I assume that's because it had to process over 1000 messages. And the junk and not junk accounts were empty this morning.


I looked in the manual and the PDF and couldn't find anywhere that would tell me what the numbers in the report email actually mean. Do you know?


Displaying SpamAssassin Database Stats

0.000 0 11654 0 non-token data: ham

0.000 0 15158 0 non-token data: spam


Output produced by spamtrainer Version 2.0.0


Thanks!

Scott

Jun 10, 2014 8:48 AM in response to Matt Domenici

Hi Matt,


So many of your answers were helpful, I'm not sure which one to mark. Also, I couldn't figure out how to mark anything as helpful.


Now that I have been doing this for several days, I just wanted to check to see if I need to be doing anything else.


My boss still gets 250-450 spam a day, about half of which are tagged with ***JUNK***. I have been feeding all including the tagged ones into the junkmail account.


1. Should I continue to feed all good messages to the notjunkmail account, even if they are all like the ones I have given it before?


2. If I get busy one day and don't have a chance to put anything into junkmail and notjunkmail, is it a problem for spamtrainer to find them empty?


3. Should I be messing with the Cautious-->Agressive slider at this point? I still have it set to 7.


4. If I'm happy that the ***JUNK*** tags are accurate, is there a way to have them deleted instead of delivered so I can cut the volume of mail my boss is getting? Or, is there a way to have it sent to anothr account so I could continue to check it? If so, would it be a good idea to send it direct to the junkmail account?


Thanks again for all your help.


Scott

Jun 10, 2014 1:44 PM in response to scottl31

When you are signed in, under each reply, there's a button that said "this helped me" or "this solved my question" -- click either one.


- Messages only incorrectly marked as spam should be sent to the "notjunkmail" account -- nothing else.


- spamassassin doesn't care if the junkmail/notjunkmail is empty or not, it will work either way


- You should experiment with the setting for junk mail filtering. Personally, I think 7 is fine but your mileage may very


- You can do all sorts of things with sieve, including routing based on rules. Assuming you have sieve enabled on the command line and know how to setup the rules, you can probably accomplish what you want to do. For now you may just want to configure webmail with filtering; that way, users can choose to delete or have their spam messages dropped into their junk mail box on the server automatically. The folks that make spamtrainer also make an installer which may be the easiest route for you to do this -- check it out at: http://topicdesk.com/downloads/roundcube/roundcube-download


Hope that helps.

Jun 10, 2014 3:09 PM in response to Matt Domenici

That's funny, I don't see those rating buttons anywhere while logged in. I see them in the legend in the sidebar but that's all.


Since I'm not sure I have sieve enabled and I am sure I don't know how to set it up, are you saying that if I install the roundcube webmail, it will give me the ability to reroute the ***JUNK*** messages or delete them?

Jun 12, 2014 4:48 PM in response to scottl31

Hi again Matt,


Since all I want to do now is to send all ***JUNK*** tagged messages to another account to hold instead of letting my boss get them, is it really best to install the roundcube?


I found this thread for a way to that:


https://discussions.apple.com/thread/4211177?answerId=20205625022#20205625022


Would this be safe to do or would it mess up or not work correctly for any reason with what I have going with SpamTrainer now?


Thanks,

Scott

Where do I configure spamassassin in Mountain Lion Server?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.