Can't add relay-country header to all messages...

Questions and answers about how to do stuff
Post Reply
iandarke
Posts: 13
Joined: 23 Apr 2015 23:18

Can't add relay-country header to all messages...

Post by iandarke » 22 May 2020 17:40

File: /etc/MailScanner/spam.assassin.prefs.conf

Content added to end:

Code: Select all

ifplugin Mail::SpamAssassin::Plugin::RelayCountry

header          RELAYCOUNTRY_BAD X-Relay-Countries =~ /^(CN|RU|DE)/
describe        RELAYCOUNTRY_BAD Testing country relay plugin
score           RELAYCOUNTRY_BAD 0.1
add_header all Relay-Country _RELAYCOUNTRY_

endif # Mail::SpamAssassin::Plugin::RelayCountry

I restarted spamassassin and mailscanner, but I was expecting to see something like this in my mail headers:

X-Spam-Relay-Country: US CN RU

It doesn't seem like headers are being added, but I did spot this in a recent spam so I know the rule is working (although for some reason the description isn't??)

Code: Select all

0.79	RDNS_NONE	Delivered to internal network by a host with no rDNS
0.10	RELAYCOUNTRY_BAD	 
0.00	SPF_HELO_NONE	SPF: HELO does not publish an SPF Record
I think my spamassassin configuration is correct and I'm *guessing* that something else in the spam processing chain is effecting the headers.


Sources:
https://cwiki.apache.org/confluence/dis ... ntryPlugin
viewtopic.php?t=1556

User avatar
pdwalker
Posts: 1383
Joined: 18 Mar 2015 09:16

Re: Can't add relay-country header to all messages...

Post by pdwalker » 23 May 2020 05:56

iandarke wrote:
22 May 2020 17:40
It doesn't seem like headers are being added, but I did spot this in a recent spam so I know the rule is working (although for some reason the description isn't??)
Tools and Links, Update SpamAssassin Rule Descriptions.

That should fix that problem.

iandarke
Posts: 13
Joined: 23 Apr 2015 23:18

Re: Can't add relay-country header to all messages...

Post by iandarke » 23 May 2020 19:40

Thanks.

Does anyone have any suggestions for where to look to get the extra header to be included? I think I'm creating it properly, but I'm guessing some later technology in the pipeline is removing it...?

User avatar
shawniverson
Posts: 3398
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: Can't add relay-country header to all messages...

Post by shawniverson » 23 May 2020 20:13

I think it is the way mailscanner calls spamassassin. I'll take a look.

ericcox
Posts: 3
Joined: 01 Apr 2021 20:00

Re: Can't add relay-country header to all messages...

Post by ericcox » 06 Apr 2021 14:56

iandarke, did you ever figure out what was happening? I think I may have the same problem: viewtopic.php?f=19&t=4702&p=17702#p17702

It's as if mailscanner hands off the message to spamassassin, spamassassin adds all the correct headers, but then mailscanner either strips out those headers or simply uses the original, unmodified message.

iandarke
Posts: 13
Joined: 23 Apr 2015 23:18

Re: Can't add relay-country header to all messages...

Post by iandarke » 13 Apr 2021 00:06

I gave up on the issue and assumed it was getting stripped later on as your analysis indicates.

Post Reply