vexim / vexim2

Virtual Exim 2
Other
70 stars 47 forks source link

Make X-Sa-* headers resemble the default ones that SpamAssassin sets. #206

Open rimas-kudelis opened 8 years ago

rimas-kudelis commented 8 years ago

This is slightly related to #203, but can be done separately, so filing it as a separate issue.

I think it would be nicer for us to add same headers that SA adds when scanning messages independently. Here's an example of what SA adds:

X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on server.example.org
X-Spam-Flag: YES
X-Spam-Level: *******
X-Spam-Status: Yes, score=7.9 required=5.0 tests=EMPTY_MESSAGE,MISSING_DATE,
    MISSING_FROM,MISSING_HEADERS,MISSING_MID,MISSING_SUBJECT,NO_HEADERS_MESSAGE,
    NO_RECEIVED,NO_RELAYS autolearn=no autolearn_force=no version=3.4.0

I'm not sure if we can find out SpamAssassin version easily, but we could at least put our system name in X-Spam-Checker-Version. Interestingly, spamassasin generates X-Spam-Level as *****, whereas $spam_bar is returned as either +++++ or ----, and I think it can end with a /. X-Spam-Status is the most interesting: I have a recipe of duplicating it in $spam_report, but that requires editing SpamAssassin config file. Perhaps we should add a macro to easily toggle whether $acl_m_spam_report should be written as X-Spam-Report or X-Spam-Status, explaining that you may want to set this macro after editing the SA config file?

Udera commented 8 years ago

I like the X-Spam-Status short version of X-Spam-Report. Do we need the X-Spam-Report at all?

Regarding $spam_bar or X-Spam-Level, I don't have a real preference, you can set filters on both.

rimas-kudelis commented 8 years ago

$spam_report contains whatever message body the REPORT SPAMC/1.2 command generates. And by default it generates that huge report with a totally redundant message preview. I like X-Spam-Status as well, which is why I've modified my report template to return a string looking like that header. My idea is that IF you agree to edit the SA template, then you'll probably want to set the macro and return the contents of $spam_report in the X-Spam-Status header instead of X-Spam-Report. Otherwise (by default) we should probably still write it as X-Spam-Report, because the format differs so much (not like this is a very strong argument though).

Udera commented 8 years ago

I just scanned my mails a bit with the spam-header. There are some rules, where your X-Spam-Status is not really helping, e.g. the auto white-list:

Content analysis details:   (0.3 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                            [score: 0.0001]
 0.7 MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
 0.2 HTML_MESSAGE           BODY: HTML included in message
-0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from author's
                            domain
-0.1 DKIM_VALID             Message has at least one valid DKIM or DK signature
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily valid
 0.8 RDNS_NONE              Delivered to internal network by a host with no rDNS
 0.6 AWL                    AWL: Adjusted score from AWL reputation of From: address

It can be negative or positive, it depends on the reputation. The short version is:

X-Spam-Status: No, score=0.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,
        DKIM_VALID,DKIM_VALID_AU,HTML_MESSAGE,MIME_HTML_ONLY,RDNS_NONE autolearn=no
        autolearn_force=no version=3.4.0

If you are stilll setting up your mailserver and check the spam-mails, these details can be interesting. Not sure how to handle this best, put the X-Spam-Report only in mails that were identified as spam?