Amavis did not add X-Relay-Country header

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
senyapsudah
Posts: 27
Joined: Thu Jul 21, 2016 12:49 am

Amavis did not add X-Relay-Country header

Post by senyapsudah »

Hi Guys,

i'm trying to get the X-Relay-Country header being added to every email send to our internal users. However it seems like it's not successfully being added. i understand that this headers will be add by amavis instead of spamassassin. i have followed some tutorial here on how to enabled this. viewtopic.php?t=55656 but still with no luck. debug spamassasin did show RELAYCOUNTRY tag able to defined which country the email originaly from and add a header to the email but it's not happening when going thru amavis. is there anything else that i should enabled?
senyapsudah
Posts: 27
Joined: Thu Jul 21, 2016 12:49 am

Re: Amavis did not add X-Relay-Country header

Post by senyapsudah »

when i enable debug on amavis i can see that RELAYCOUNTRY does not have correct value.

amavis[29844]: (29844-01) SA dbg: check: tagrun - tag RELAYSEXTERNAL is now ready, value:
amavis[29844]: (29844-01) SA dbg: check: tagrun - tag RELAYCOUNTRY is now ready, value: ARY:[]

i believe this is the reason why the header is not being added to the email. can anyone confirm on this?
RainCaster
Posts: 1
Joined: Wed Apr 22, 2020 4:50 pm

Re: Amavis did not add X-Relay-Country header

Post by RainCaster »

I dug into this and found out the following:
1. Amavis is not being actively worked on by anyone- good luck getting help
2. I stepped through it, and discovered that amavis calls spamassassin, then destroys all headers X-Spam-* headers including (you guessed it) X-Spam-Relay-Country
3. So I modified the amavis-new script to 1) preserve the Relay-Country header and 2) add all the right libraries to deal with all possible permutations of how Spamassassin could load up RelayCountry.
4. I have been running this on my mail server now for several weeks and it appears to be quite stable.

Feel free to use this. Maybe I'll check it in somewhere if enough are interested. The file is "amavisd-new" and on my Ubuntu LTS install, it went into /usr/sbin. Then I restarted spamassassin and amavisd-new. Emails after that started appearing with the RelayCountry header and costing of various countries I have specified.
Attachments
amavisd-new.zip
(415.96 KiB) Downloaded 353 times
Post Reply