Skip navigation

Spamassassin Junkmail and Notjunkmail Learning in Mountain Lion

5398 Views 34 Replies Latest reply: Nov 14, 2013 10:56 AM by scottl31 RSS
  • Jeff Hargrove Level 2 Level 2 (235 points)

    This is really helpful!

     

    I was reading in Apple's advanced server admin manual that it was a default that the server will train junk mail at 2:15. Another let down ...

     

    I think you should be writing the unofficial manual for all of us novices.

     

    Any chance I could get your help about my quarantine problem? I think it is trying to deliver to the quarantine address, but fails, but don't know why.

     

    Again thanks for your time is getting spam training set up.

     

    Cheers

     

    Jeff

  • UptimeJeff Level 4 Level 4 (3,390 points)

    I've never been happy with bayes training since the old cyrus shared mailbox days.

     

    Users shouldn't need to redirect messages and sharing access to junkmail/notjunkmail imap accounts is cumbersome.

     

    Today, I tackled this with a quick script which does this:

     

    - Scans every mail user for 2 folders (junkmail/notjunkmail)

    - Feeds those messages to sa-learn, to train the bayes filters.

     

    I will add

    - purge the user junkmail/notjunkmail folders of messages > 30 days old.

     

    End result, users simply drag messages within their own imap account.

    The script can specifcy the standard 'Junk' folder so that client apps that filter to 'Junk' will contribute to the common bayes DB.

     

    This creates an easy to use training system which allows all users to contribute easily.

    Requires no server config, users only need to add their training folders.

     

    This feature may be added to spamtrainer in a future version.

  • Jeff Hargrove Level 2 Level 2 (235 points)

    This sounds great!

     

    Any chance that you might share this script with the community?

  • pterobyte Level 6 Level 6 (10,910 points)

    spamtrainer is already available for download at http://osx.topicdesk.com/spamtrainer 

    It is compatible with Mountain Lion. It allows you to run it at any time you like, can backup/restore your bayes DB and purge learned messages.

    The additional features mentioned by UptimeJeff will be added in a future release.

  • Kostas B Level 1 Level 1 (90 points)

    Alex,

     

    Are there any instructions for setting this up?

     

    Best regards

     

    Kostas

  • pterobyte Level 6 Level 6 (10,910 points)

    Kostas,

     

    once installed, "spamtrainer -h" or "man spamtrainer" will show you the available parameters. You will also find a PDF document on your desktop.

     

    HTH,

    Alex

  • Kostas B Level 1 Level 1 (90 points)

    Thank you Alex!

     

    Best

     

    Kostas

  • Chris Goodwin Calculating status...

    Hi,

     

    I installed this today and get errors when using the -d option as follows:

     

    server02:db admin$ sudo /usr/sbin/spamtrainer -d

    Password:

     

     

    /usr/sbin/spamtrainer: line 1625: /usr/bin/cvt_mail_data: No such file or directory

    /usr/sbin/spamtrainer: line 1626: /usr/bin/cvt_mail_data: No such file or directory

     

     

    Starting spamtrainer...

     

     

    Training from user folders

    Learning SPAM...

    /usr/sbin/spamtrainer: line 1376: cd: /Library/Server/Mail/Data/mail//cur: No such file or directory

    /usr/sbin/spamtrainer: line 1391: cd: /Library/Server/Mail/Data/mail//new: No such file or directory

    Learned new SPAM (junk mail)

    Learning HAM...

    /usr/sbin/spamtrainer: line 1435: cd: /Library/Server/Mail/Data/mail//cur: No such file or directory

    /usr/sbin/spamtrainer: line 1450: cd: /Library/Server/Mail/Data/mail//new: No such file or directory

    Learned new HAM (not junk mail)

    Syncing SpamAssassin Database

    Displaying SpamAssassin Database Stats

    0.000          0         14          0  non-token data: spam

    0.000          0         63          0  non-token data: ham

    Deleting learned HAM and SPAM

    Done!

    Output produced by spamtrainer Version 1.9.8

     

     

    The database doesn't appear to be updated and the junk / notjunk mail is not deleted.

     

    Appears to run OK and updates the database if run with no options.

     

    This is with a standard mail setup (nothing moved to different locatins, junkmail and notjunkmail users exist and mailboxes can be accessed through the Mail client.

     

    Any thoughts??

  • pterobyte Level 6 Level 6 (10,910 points)

    What puzzles me is that you say it runs fine without the -d flag. The output you show is from a section where the -d flag doesn't count.

     

    Looks like a path problem to me. Any chance you have spaces in volume or path names somewhere?

     

    Could you mail me your dovecot configuration files?

  • Chris Goodwin Level 1 Level 1 (55 points)

    Yep - space in the boot volume name (Server HD) as delivered. Is renaming that going to have any effects on any services?

     

    Which dovecot files in particular are you referring to? (I'm still trying to find my way around the new architecture having move from using Snow Leopard Server - new setup not migration).

  • pterobyte Level 6 Level 6 (10,910 points)

    Space in Boot volume path is not a problem usually.

     

    I think I found an obscure bug. Can you try and run spamtrainer again. You should be prompted to update to 1.9.9 which should fix it. Sorry about that and thanks for the feedback.

     

    HTH,

    Alex

     

    P.S. Don't need it anymore, but for reference, the conf files are in /Library/Server/Mail/Config/dovecot/

  • Chris Goodwin Level 1 Level 1 (55 points)

    That seems to have done the trick!!

     

    Excellent service (as usual).

     

    Just need tosetup the auto run and hopefully good to go.

     

    Many thanks,

     

    Chris

  • Kostas B Level 1 Level 1 (90 points)

    Sorry for this, but I need some clarification:

     

    "When run, it will read the designated HAM and SPAM mailboxes, update the SpamAssassin databases and delete mail that has been learned from".

     

    Suppose I create these mailboxes using: spamtrainer -p mymailpartition -j myjunkmailbox -n mynotjunkmailbox -d

     

    1. How the users are aware of these mailboxes? Or is this the messages confirmed as "Junk" in their Mail client.

     

    2. What -d (delete processed mail) means?

     

    3. I have set all the marked as junk to redirect to a specific mail account and the users check this mailbox for any false marked items. Can they "whitelist" addresses from there?

     

    Best regards

     

    Kostas

  • pterobyte Level 6 Level 6 (10,910 points)

    spamtrainer will not create any mailboxes for you. The -p -j and -n parameters are only so you can point spamtrainer to different accounts. spamtrainer makes the same assumptions Apple's learn_junk_mail script does. It also uses the same backend software - spamassassin's sa-learn.

    It is simply more flexible because you can give it different parameters if you have customised your system. It also allows you to delete spam and ham messages that you put in the junkmail and notjunkmail mailboxes after it has learned those messages.

     

    Running spamtrainer or learn_junk_mail will train the bayes DB. It is not a whitelist. Whitelisting can be done in amavisd.conf or a configuration file like local.cf

     

    HTH,

    Alex

  • bdemore Calculating status...

    Oddly when I run "sudo serveradmin settings mail:imap | grep junk" on a brand new 10.8 Server install, I receive the following:

     

    mail:imap:junk_mail_userid = ""

    mail:imap:not_junk_mail_userid = ""

     

    I've tried to set them manually with the following command: 

     

    sudo serveradmin settings mail:imap:junk_mail_userid = "junkmail"

     

    This command does not seem to change the status at all.  Any advice?

     

    Thanks in advance.

     

    -Brian

Actions

More Like This

  • Retrieving data ...

Bookmarked By (1)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.