sa-learn wrapper script Written and maintained by Stefan Jakobs The sal-wrapper.pl script reads a message from STDIN, strips it into its different MIME parts and passes each message/RFC822 part to sa-learn or spamc. The script expects one parameter (--ham/--spam or -L ham|spam) which is used to tell sa-learn or spamc if it should learn the message as ham or spam. It can also check the message against a table of IP-addresses (like postfix' networks table) to decide if the message should be passed to sa-learn or not. How do I install to use it with postfix? Just unpack the script sal-wrapper.pl and copy it to a place you like (e.g. /usr/local/sbin/). Edit the file and change the configuration parameters to your habbits. With the first method edit the master.cf and add the following lines: sa-wrapper unix - n n - - pipe user=YOURUSER argv=/PATH/TO/sal-wrapper.pl --${mailbox} If you use spamc as learning client replace '--${mailbox}' by '-L ${mailbox}'. Then edit your transport file and add the following two lines: spam@ sa-wrapper: ham@ sa-wrapper: Make 'postmap transport' and then you can learn spam through sending the spam message in the appendix to spam@. In the same way you learn ham, but send it to ham@. An other method ist to create a second aliases map that belongs to the user which runs spamassassin and add the following content: # touch /etc/report_aliases # chown YOURUSER /etc/report_aliases /etc/report_aliases: spam: "|/PATH/TO/sal-wrapper.pl --spam" ham: "|/PATH/TO/sal-wrapper.pl --ham" If you use spamc as learning client, then replace '--spam' and '--ham' by '-L spam' and '-L ham'. Then add the new aliases file to your alias_maps: /etc/postfix/main.cf: ... alias_maps = hash:/etc/aliases, hash:/etc/report_aliases ... # postalias /etc/report_aliases How do I install to use it with other programs? I don't know exactly but the script reads a message from STDIN. So it should be easy to make it work with procmail and other progs. A procmailrc sample which I found somewhere in the www: VERBOSE=ON LOGFILE=/var/log/procmail.log :0 * ^To: spam@your.server.tld { :0fw | /usr/local/bin/sa-wrap.pl --spam :0 /dev/null } :0 * ^To: ham@your.server.tld { :0fw | /usr/local/bin/sa-wrap.pl --ham :0 /dev/null If you use spamc as your learning client, then replace '--spam' and '--ham' by '-L spam' and '-L ham'. What is the advantage in using spamc instead of sa-learn? If you use a spamd/spamc setup you should use spamc as learning client, because its resource usage it much lower and it runs faster. In that setup spamd will open the Bayes DB and write to it. It's running anyway, so why not use it. If you don't use a spamd/spamc setup (e.g. amavisd-new) then you have to use sa-learn, because it's probably not worse to start an additional spamd with its big memory consumption. ### last update of this file: 29.11.2009 by Stefan Jakobs ###