/etc/cron.daily/spamassassin should restart amavisd

Bug #502615 reported by Lupe Christoph
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
spamassassin (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

Binary package hint: spamassassin

/etc/cron.daily/spamassassin runs spamassassin reload which does not notify amavisd that there are new SpamAssassin rules.

I noticed this today after the sa-update run installed a new version of 72_active.cf to fix the notorious FH_DATE_PAST_20XX bug. Mails were still tagged like this:

X-Spam-Status: No, score=2.686 tagged_above=2 required=5
        tests=[BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188,
        FORGED_HOTMAIL_RCVD2=1.502, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.596]
        autolearn=no

This happens when you run SpamAssassin through Amavis (package amavisd-new) because the amavisd processes seem to need a restart to use the updated rules.

Since the cron job knows if there are indeed updates, it is probably the best place to trigger this restart. Probably with something like this:

# Reload
if which invoke-rc.d >/dev/null 2>&1; then
    invoke-rc.d spamassassin reload > /dev/null 2>&1
    if [ -f /var/run/amavis/amavis.pid ]; then
        invoke-rc.d amavis restart > /dev/null 2>&1
    fi
else
    /etc/init.d/spamassassin reload > /dev/null 2>&1
    if [ -f /var/run/amavis/amavis.pid ]; then
        /etc/init.d/amavis restart > /dev/null 2>&1
    fi
fi

I'm using /var/run/amavis/amavis.pid as a trigger to avoid starting amavisd if it isn't already running.

Revision history for this message
Imre Gergely (cemc) wrote :

Maybe a restart isn't such a good idea for amavis, to kill off every child and restart at every change (could be a problem on systems under heavy load), maybe a reload would be enough (if it supports reload).

Revision history for this message
Lupe Christoph (lupe) wrote :

Maybe you can find a version of /etc/init.d/amavis that supports reload, the one in 9.10 doesn't:

# reload)
# echo "Reloading $DESC configuration files."
# start-stop-daemon ${STOP} --signal 1
# ;;

And I believe at a maximum frequency for rule updates of once daily this can't be a serious load. (The actual frequency is much lower again, I believe.)

Revision history for this message
Imre Gergely (cemc) wrote :

That's why I said IF it supports it. I checked and after amavis version 2.0 it is recommended one uses amavisd reload (and not HUP), which in fact does a restart (on Karmic at least).

Maybe somebody with a little more experience with amavis should take a look at this.

I would say if somebody enables sa-update in crontab, they should at least have an option to reload/restart amavis, too. Maybe a RESTART_AMAVIS={0|1} option in /etc/default/spamassassin, after the CRON=0 option, which can be turned on/off if one uses amavis and really wants to restart it on every sa-update.

Revision history for this message
Lupe Christoph (lupe) wrote :

I'm wondering if it is possible to run amavisd with spamd rather than the integrated code. That would be the only case in my opinion when your knob makes sense. When somebody run amavisd with the integrated SpamAssassin code (which is standard and quite possibly the only way to do it), updating the rules without telling the daemon makes little sense.

Revision history for this message
Imre Gergely (cemc) wrote :

That's what we're trying to figure out, how to tell the daemon best that SA rules were updated. Right now indeed it makes less sense to run sa-update when using amavis, but it still makes sense because sometimes amavis gets restarted for other reasons, and then you'll have the updated rules (although with possible huge delays :) ).

I don't know either how/if spamd can be used with amavis.

Chuck Short (zulcss)
Changed in spamassassin (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Josh Goodall (inopinatus) wrote :

Actually, the cronjob does try to restart amavisd-new but fails because the hook is not marked executable. On 12.04, just do

chmod 755 /etc/spamassassin/sa-update-hooks.d/amavisd-new

and a successful sa-update should then trigger the restart. This looks fixed in 12.10 & later due to upstream change.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.