Page 1 of 1
postfix-pcre?
Posted: 21 Feb 2017 21:34
by e-d-i-t
In the current blacklist table it is possible to add domains, but not a TLD by itself (doesn't work)
As stated here:
https://serverfault.com/questions/72864 ... fix/728658
Is it needed to install postfix-pcre in order to filter for TLD in sender restrictions?
I need to stop anything coming from *.online or *.click
These are all spam mail for us.
Re: postfix-pcre?
Posted: 21 Feb 2017 22:16
by shawniverson
That is one way to do it.
Another way is to create custom spamassassin rules that assign a high score for those TLDs.
Re: postfix-pcre?
Posted: 21 Feb 2017 23:23
by e-d-i-t
Ah, never thought of that!
Might be the better option.
Will dig into that and see how it is done.
Tnx!
Re: postfix-pcre?
Posted: 21 Feb 2017 23:59
by e-d-i-t
Created a file:/etc/mail/spamassassin/z_TLD.cf
# add points if the From address is not a valid host in a listed TLD
header LOCAL_FROM_TLD From !~ /@[a-z0-9\-\.]+\.(com|org|net|nl|uk)/i
describe LOCAL_FROM_TLD From address is not a valid host in a listed TLD
score LOCAL_FROM_TLD 4.5
This is now working fine. It ads 4.5 to spamscore whenever it is not a .com/.net/.org/etc...
From here we can tweak it further.
Re: postfix-pcre?
Posted: 04 Mar 2017 22:40
by e-d-i-t
Had to change it as the regex wasn't working properly.
Created a file:/etc/mail/spamassassin/z_TLD.cf
Code: Select all
# add points if the From address is not a valid host in a listed TLD
header LOCAL_FROM_TLD From !~ /@.{1,}\.(com|eu|nl|net|nu|co\.uk)/i
describe LOCAL_FROM_TLD Sender is not a valid host in approved TLD list
score LOCAL_FROM_TLD 6