SpamAssasin : bug 2010
- Mercredi 6 janvier 2010
- Publié dans Administration . Messagerie
- Par Boris HUISGEN
- Ecrire
Les versions de SpamAssassin antérieures à la version 3.2.5 possèdent une règle de filtrage qui marque par défaut tous les messages datés entre 2010 et 2099 comme spam. L’expression régulière fautive est la suivante :
header FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006]
De nombreux sites relayent ce problème sans pour autant apporter les solutions possibles et encore moins souligner que les règles de filtrage doivent être mises à jour quotidiennement. A moins d’avoir un souci au niveau de la mise à jour des règles, ce bug aurait donc dû être écarté.
Les solutions possibles pour corriger le bug sont les suivantes, par ordre croissant d’efficacité :
- désactiver la règle de filtrage, en ajoutant dans le fichier de configuration local.cf :
# bug 2010 spamassassin score FH_DATE_PAST_20XX 0.0
- corriger manuellement la regex :
header FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006]
par :
header FH_DATE_PAST_20XX Date =~ /20[2-9][0-9]/ [if-unset: 2006]
Pour trouver le fichier à modifier :
# pwd
/var/lib/spamassassin/3.002001/updates_spamassassin_org
# grep -R FH_DATE_PAST_20XX *
updates_spamassassin_org/50_scores.cf:score FH_DATE_PAST_20XX 2.075 3.384 3.554 3.188 # n=2
updates_spamassassin_org/72_active.cf:##{ FH_DATE_PAST_20XX
updates_spamassassin_org/72_active.cf:header FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006]
updates_spamassassin_org/72_active.cf:describe FH_DATE_PAST_20XX The date is grossly in the future.
updates_spamassassin_org/72_active.cf:##} FH_DATE_PAST_20XX
Toutefois, il faudra prendre rendez-vous pour la corriger à nouveau en 2020 … d’où la dernière solution.
mettre à jour vos règles de filtrage et l’automatiser quotidiennement par une tâche cron (la solution la plus efficace) :
# /usr/bin/sa-update -D channel,dns [3124] dbg: dns: is Net::DNS::Resolver available? yes [3124] dbg: dns: Net::DNS version: 0.66 [3124] dbg: channel: attempting channel updates.spamassassin.org [3124] dbg: channel: update directory /var/lib/spamassassin/3.002001/updates_spamassassin_org [3124] dbg: channel: channel cf file /var/lib/spamassassin/3.002001/updates_spamassassin_org.cf [3124] dbg: channel: channel pre file /var/lib/spamassassin/3.002001/updates_spamassassin_org.pre [3124] dbg: channel: metadata version = 730418 [3124] dbg: dns: 1.2.3.updates.spamassassin.org => 895075, parsed as 895075 [3124] dbg: channel: preparing temp directory for new channel [3124] dbg: dns: is Net::DNS::Resolver available? yes [3124] dbg: dns: Net::DNS version: 0.66 [3124] dbg: channel: reading MIRRORED.BY file [3124] dbg: channel: found mirror http://daryl.dostech.ca/sa-update/asf/ weight=5 [3124] dbg: channel: found mirror http://www.sa-update.pccc.com/ weight=5 [3124] dbg: channel: selected mirror http://daryl.dostech.ca/ sa-update/asf [3124] dbg: channel: populating temp content file gpg: WARNING: unsafe ownership on homedir `/etc/mail/spamassassin/sa-update-keys' [3124] dbg: channel: file verification passed, testing update [3124] dbg: channel: extracting archive [3124] dbg: dns: is Net::DNS::Resolver available? yes [3124] dbg: dns: Net::DNS version: 0.66 [3124] dbg: channel: lint check succeeded, extracting archive to /var/lib/spamassassin/3.00200/updates_spamassassin_org... [3124] dbg: channel: point of no return for existing /var/lib/spamassassin/3.00200/updates_spamassassin_org [3124] dbg: channel: creating MIRRORED.BY file [3124] dbg: channel: creating update cf/pre files [...] [3124] dbg: channel: adding 72_active.cf [...] [3124] dbg: channel: update complete
Si la mise à jour est effective, la regex est corrigée automatiquement :
# pwd
/var/lib/spamassassin/3.002001/updates_spamassassin_org
# grep -R FH_DATE_PAST_20XX *
50_scores.cf:score FH_DATE_PAST_20XX 2.075 3.384 3.554 3.188 # n=2
72_active.cf:##{ FH_DATE_PAST_20XX
72_active.cf:header FH_DATE_PAST_20XX Date =~ /20[2-9][0-9]/ [if-unset: 2006]
72_active.cf:describe FH_DATE_PAST_20XX The date is grossly in the future.
72_active.cf:##} FH_DATE_PAST_20XX
Si elle n’est pas effectuée (et c’était malheureusement mon cas sur un serveur mail), corrigez votre fichier de serveurs miroirs avec les suivants :
# pwd /var/lib/spamassassin/3.002001/updates_spamassassin_org # cat MIRRORED.BY # test mirror: zone, cached via Coral #http://buildbot.spamassassin.org.nyud.net:8090/updatestage/ http://daryl.dostech.ca/sa-update/asf/ weight=5 http://www.sa-update.pccc.com/ weight=5
N’oubliez pas de redémarrer le démon spamd et/ou encore votre logiciel de filtrage mail (amavisd-new, etc).
Source : http://wiki.apache.org/spamassassin/Rules/FH_DATE_PAST_20XX

Pas encore de commentaires.