Aug 252014
 
Junk

If you are running postfix/dovecot using the server app on OSX 10.8.x and want to implement the markasjunk2 plugin for roundcube, allow me to save you hours of frustration…  Here are the settings that worked for me.

Assuming you intent to use sa-learn to update the Bayesian filter when using the plugin, modify config.inc.php as follows:

Set plugin to use cmd_learn driver:$rcmail_config['markasjunk2_learning_driver'] = cmd_learn;

 

$rcmail_config[‘markasjunk2_learning_driver’] = cmd_learn;

Set spam option for learn driver:$rcmail_config['markasjunk2_spam_cmd'] = 'sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/sa-learn  --spam %f';

$rcmail_config[‘markasjunk2_spam_cmd’] = ‘sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/sa-learn  –spam %f’;

Set ham options for learn driver:

$rcmail_config['markasjunk2_ham_cmd'] = 'sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/sa-learn --ham %f';

$rcmail_config[‘markasjunk2_ham_cmd’] = ‘sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/sa-learn –ham %f’;

If you want to see it in action, be sure to turn on logging:$rcmail_config['markasjunk2_debug'] = true;

 

$rcmail_config[‘markasjunk2_debug’] = true;

In order for roundcube to call sa-learn with access permission to spamassassin database, it is necessary to update the sudoers file.

Open terminal and type:  sudo visudo

Screen Shot 2014-08-25 at 10.28.51 AM

(homebrew is so much easier on the eyes)

 

Once in the sudoers file, add the following line:

Screen Shot 2014-08-25 at 10.05.50 AM

 

 

 

_www ALL=(root) NOPASSWD:/Applications/Server.app/Contents/ServerRooy/usr/bin/sa-learn

After you have added the changes,  save your changes –   ‘:’  brings up menu and ‘w’ to write changes.  Then ‘:’  and ‘q’ to quit (I prefer nano to vim, but supposedly there is some voodoo about changing the sudoers file in an unsafe manner and you’ll shoot your eye out.. blah blah blah.

Open roundcube inbox, and mash the junk button, and see the results in the log file:

displayed at bottom of roundcube interface

 

learned some tokens!

Here are some good references (without which, I’d have never gotten this working):