No Spam Headers after upgrading to Etch

Discussion in 'Server Operation' started by snowfly, Oct 10, 2007.

  1. snowfly

    snowfly Member


    On a spare server here, I recently upgrade it from Debian Sarge to Etch.

    Got everything installed and workingfine, amavisd-new (2.4.2 (20060627)), postfix, courier, clamav, etc. (mostly like this guide here)

    However, NO email seems to get X-Spam-* headers tags put in.

    I've enabled spam/virus checking in "15-content_filter_mode".

    Here's an extract from 20-debian-defaults:

    $sa_spam_subject_tag = '[SPAM] ';
    $sa_tag_level_deflt  = 0.0;  # add spam info headers if at, or above that level
    $sa_tag2_level_deflt = 4.7; # add 'spam detected' headers at that level
    $sa_kill_level_deflt = 20; # triggers spam evasive actions
    $sa_dsn_cutoff_level = 50;   # spam level beyond which a DSN is not sent

    When I check /var/log/mail.log , I see many entries of "Passed SPAMMY", with more hits then "4.7" (above), and some "Passed Clean".

    For example, a Passed SPAMMY:
    Oct 11 01:42:28 aero amavis[3630]: (03630-10) Passed SPAMMY, [xxx] [xxx] <xxx> -> <xxx>, Message-ID: <306301c80b3a$fde85690$c0a8010a@Julius>, mail_id: WFNzCI1D1zJI, Hits: 7.81, queued_as: C6DED803CB, 6439 ms
    And an example of Passed CLEAN:
    Oct 11 01:44:05 aero amavis[4072]: (04072-02) Passed CLEAN, [xxx] [xxx] <> -> <xxx>, Message-ID: <xxx>, mail_id: b19sMBlu4yMI, Hits: 1.477, queued_as: E9A3F803CB, 5039 ms
    And example of Blocked SPAMMY:
    Oct 11 01:43:56 aero amavis[4089]: (04089-01) Blocked SPAM, [xxx] [xxx] <xxx> -> <xxx>, quarantine: spam-jAS1viZaeLIW.gz, Message-ID: <xxx>, mail_id: jAS1viZaeLIW, Hits: 27.465, 6643 ms

    So I can see that the "Blocked SPAMMY" goes to quarantine, which is fine, as our "$sa_kill_level_deflt = 20", and the Blocked SPAMMY entry had 27.465 Hits.

    HOWEVER, the Passed SPAMMY entry had 7.81 Hits, BUT no X-Spam-* headers were inserted into the email.

    As there were no headers, our maildrop doesn't see these tags, and doesn't shift the email to the users 'Spam' folder.

    Can someone please help, as this has been driving me nuts for hours!!!

    I may have missed something really simple, but I just can't see what it is.

    ALSO, does amavisd-new on Debian ETCH ever use the SpamAssassin settings in /etc/spamassassin/* (e.g. ??????

  2. snowfly

    snowfly Member


    After many more hours searching around in the middle of the night, I found out about "@local_domains_maps".

    In the amavisd conf file 50-user, I added this:

    @local_domains_maps = ( [".$mydomain"] );

    And now X-Spam-* headers are added to my emails!!! :)

    BUT... this is only for $mydomain, which is my own domain name.
    I have over 100 other domain names on this mail server (a virtual system using mysql).
    And none of the other emails for other domains are getting these X-Spam-* headers.

    Does each and every domain need to be in "@local_domains_maps" ?????

    Is there a way of using a MySQL lookup, for @local_domains_maps???
    As I already have a "email_domains" table in MySQL, that posfix uses.

  3. snowfly

    snowfly Member

    Well I found a temporary solution for now, to put all domains into a hash file, then include.

    I wrote a small per script to get list of domains from mysql:

    use DBI;
    $db_handle = DBI->connect("dbi:mysql:database=xxx;host=localhost:3306;user=xxx;password=xxx");
    $statement = $db_handle->prepare("SELECT distinct domain FROM email_domains");
    while ($row_ref = $statement->fetchrow_hashref())
    print "$row_ref->{domain} OK\n";
    I then can pipe this output to a file:
    /etc/postfix/ > /etc/postfix/amavis-domains
    And then run postmap:
    postmap /etc/postfix/amavis-domains
    Once the hash file is created, I can then call it from Amavis CONF (50-user):

    @local_domains_maps = ( read_hash("/etc/postfix/amavis-domains") );

    Now that seems to work, and now all 110 domains of our clients can have spam headers added.

    Not a very good solution, as every time we add a new domain, we have to re-run the perl script, recreate hash file, and restart Amavis.

    Oh well, suppose a cron job could do that.
    Would be much nicer to talk to mysql directly.
    Last edited: Oct 11, 2007

Share This Page