postfix-pcre?

General eFa discussion
Post Reply
e-d-i-t
Posts: 94
Joined: 27 Apr 2016 19:28
Contact:

postfix-pcre?

Post 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.
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: postfix-pcre?

Post 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.
e-d-i-t
Posts: 94
Joined: 27 Apr 2016 19:28
Contact:

Re: postfix-pcre?

Post 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!
e-d-i-t
Posts: 94
Joined: 27 Apr 2016 19:28
Contact:

Re: postfix-pcre?

Post 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.
e-d-i-t
Posts: 94
Joined: 27 Apr 2016 19:28
Contact:

Re: postfix-pcre?

Post 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
Post Reply