Di recente ho avuto un aggiornamento sul server e tra i vari pacchetti installati ho trovato spamassassin (spamassassin:i386 (3.3.2-5, 3.3.2-5+deb7u1), fin qui nulla di male anche perché non ci sono stati errori.
Il giorno seguente però trovo una mail di sistema che pone dei sospetti su cui indagare meglio.
/usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-clean plugin: failed to parse plugin (from @INC): "decode_dns_question_entry" is not exported by the Mail::SpamAssassin::Util module Can't continue after import errors at /usr/local/share/perl/5.14.2/Mail/SpamAssassin/Plugin/AskDNS.pm line 192. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Mail/SpamAssassin/Plugin/AskDNS.pm line 192. Compilation failed in require at (eval 72) line 1.
da qui ci mettiamo alla ricerca di una soluzione, una breve consultazione ci porta QUI, e la soluzione indicata pare :
You probably have the old version in:
/usr/share/perl5/Mail/SpamAssassin*
and the new in:
/usr/local/share/perl/5.14.2/Mail/SpamAssassin*
trovo nelle dorectory indicate alcune differenze ! attimi di panico a cui non occorre cedere
mi lascio andare a 10 miuti di Tai Chi Suka
Ricordo di aver spippolato senza sapere bene cosa stavo facendo, lo so, è una cosa sconsigliata e indago un attimo su quanto fatto con CPAN ma non ne vengo a capo.
Così da bravo porcello sego /usr/share/perl5/Mail/SpamAssassin e al posto della dir scomparsa metto un link a /usr/local/share/perl/5.14.2/Mail/SpamAssassin.
Faccio un test e quello che prima era così
sa-learn --sync --force-expire plugin: failed to parse plugin (from @INC): "decode_dns_question_entry" is not exported by the Mail::SpamAssassin::Util module Can't continue after import errors at /usr/local/share/perl/5.14.2/Mail/SpamAssassin/Plugin/AskDNS.pm line 192. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Mail/SpamAssassin/Plugin/AskDNS.pm line 192. Compilation failed in require at (eval 72) line 1. bayes: synced databases from journal in 0 seconds: 147 unique entries (147 total entries)
ora si presenta in modo regolare senza errori:
sa-learn --sync --force-expire bayes: synced databases from journal in 0 seconds: 1734 unique entries (2983 total entries)
Dato che se non è specificato il db dei bayes può essere creato in diversi posti, ad esempio ne ho uno in /home/user/.spamassassin e un’altro gestito da amavis in /var/lib/amavis/.spamassassin, impongo all’inizio una direttiva per impostare un posto unico e eseguo lo script di autolearn come root.
Si consiglia di integrare con pyzor e razor la vostra scansione.
questo il mio file /etc/spamassassin/local.cf :
## direttiva per bayes unici con autolearn da root ## http://wiki.apache.org/spamassassin/SiteWideBayesSetup bayes_path /var/lib/amavis/.spamassassin/bayes # Add *****SPAM***** to the Subject header of spam e-mails # rewrite_header Subject *****SPAM***** # Set the threshold at which a message is considered spam (default: 5.0) # required_score 5.5 # Use Bayesian classifier (default: 1) # use_bayes 1 # Bayesian classifier auto-learning (default: 1) # bayes_auto_learn 1 ok_locales en ## new DNSWL list http://www.dnswl.org/tech#spamassassin header __RCVD_IN_DNSWL eval:check_rbl('dnswl-firsttrusted', 'list.dnswl.org.') tflags __RCVD_IN_DNSWL nice net header RCVD_IN_DNSWL_NONE eval:check_rbl_sub('dnswl-firsttrusted', '^127\.0\.\d+\.0$') describe RCVD_IN_DNSWL_NONE Sender listed at http://www.dnswl.org/, no trust tflags RCVD_IN_DNSWL_NONE nice net header RCVD_IN_DNSWL_LOW eval:check_rbl_sub('dnswl-firsttrusted', '^127\.0\.\d+\.1$') describe RCVD_IN_DNSWL_LOW Sender listed at http://www.dnswl.org/, low trust tflags RCVD_IN_DNSWL_LOW nice net header RCVD_IN_DNSWL_MED eval:check_rbl_sub('dnswl-firsttrusted', '^127\.0\.\d+\.2$') describe RCVD_IN_DNSWL_MED Sender listed at http://www.dnswl.org/, medium trust tflags RCVD_IN_DNSWL_MED nice net header RCVD_IN_DNSWL_HI eval:check_rbl_sub('dnswl-firsttrusted', '^127\.0\.\d+\.3$') describe RCVD_IN_DNSWL_HI Sender listed at http://www.dnswl.org/, high trust tflags RCVD_IN_DNSWL_HI nice net score RCVD_IN_DNSWL_LOW -1 score RCVD_IN_DNSWL_MED -10 score RCVD_IN_DNSWL_HI -100 #URIBL_BLACK & URIBL_GREY : http://www.uribl.com/usage.shtml urirhssub URIBL_BLACK multi.uribl.com. A 2 body URIBL_BLACK eval:check_uridnsbl('URIBL_BLACK') describe URIBL_BLACK Contains an URL listed in the URIBL blacklist tflags URIBL_BLACK net score URIBL_BLACK 3.0 urirhssub URIBL_GREY multi.uribl.com. A 4 body URIBL_GREY eval:check_uridnsbl('URIBL_GREY') describe URIBL_GREY Contains an URL listed in the URIBL greylist tflags URIBL_GREY net score URIBL_GREY 0.25 header SUBJ_DOLLARS Subject =~ /^\$[0-9.,]+\b/ score SUBJ_DOLLARS 2.7 # was 1.4 Subject starts with dollar amount score RCVD_IN_DNSWL_LOW -1 score RCVD_IN_DNSWL_MED -10 score RCVD_IN_DNSWL_HI -100 score BAYES_99 5.300 score BAYES_90 4.500 score BAYES_80 4.000 score HTML_FONT_INVISIBLE 3 score HTML_FONTCOLOR_UNKNOWN 2 score INVALID_DATE 3.2 3.3 2.5 2.1 score DATE_IN_PAST_03_06 2.399 1.076 1.200 1.592 score DATE_IN_PAST_06_12 1.699 1.103 1.274 1.543
L’autoapprendimento viene forzato tramite uno script in cron sulle cartelle in formato .Maildir
#!/bin/bash ##script per l'automazione dell'auto Learning di SpamAssassin echo "Auto-Learning Spamassassin in Corso" sa-learn --no-sync --spam /home/user/.Maildir/.SLearn/{cur,new} sa-learn --no-sync --ham /home/user/.Maildir/.SHam/{cur,new} echo "Auto-Learning Spamassassin Eseguito"
periodicamente vedo che il database si sincronizza, altrimenti manualmente sarebbe necessario :
sa-learn –sync
oppure
sa-learn –sync –force-expire
a riguardo consiglio la lettura di questo link e anche di questo link.
L’autoapprendimento a cominciato a dare i suoi frutti dopo un paio di mesi, e le statistiche un pò sbilenche di mailgraph ne sono la prova, a distanza di un’anno dal passaggio a wheezy e l’utilizzo oltre che di mailgraph di Amavisd-new
Nella seconda parte ci occuperemo dell’installazione e configurazione di mailgraph