Page 1 of 1

Wildcards in Whitelist/blacklist

Posted: 23 Jul 2014 18:43
by rpw
What wildcards are supported in the Whitelist/Blacklist on MailWatch? I've tried the "*" but it doesn't seem to work.

Thanks Richard.

Re: Wildcards in Whitelist/blacklist

Posted: 24 Jul 2014 18:07
by rpw
Appears I've found my answer over on the mail scanner faq. Apparently you can't use wildcards at all. Looks like my blacklist is going to get VERY LARGE.

Re: Wildcards in Whitelist/blacklist

Posted: 24 Jul 2014 23:50
by shawniverson
Hmm....feature request? Or you can perhaps use a postfix rule instead since it allows regex and wildcards?

Re: Wildcards in Whitelist/blacklist

Posted: 25 Jul 2014 18:23
by rpw
I'd be interested in any solution. As I've mention I'm not very good with Linux (yet) so I'd need a bit of schooling on how to.

Re: Wildcards in Whitelist/blacklist

Posted: 25 Jul 2014 23:58
by shawniverson
It takes some tweaking in postfix, here's the post I saw that describes how to do it.

http://permalink.gmane.org/gmane.mail.v ... nner/80423

I'll highlight the important parts...

In /etc/postfix/main.cf...

smtpd_client_restrictions = reject_unknown_client_hostname,
check_sender_access pcre:/etc/postfix/sender_access
smtpd_sender_restrictions = reject_unknown_sender_domain,
check_sender_access pcre:/etc/postfix/sender_access

In /etc/postfix/sender_access

Code: Select all

/\.example$/                 REJECT
'
Reject anything from example TLD

Re: Wildcards in Whitelist/blacklist

Posted: 28 Jul 2014 12:40
by rpw
Thanks, I'll post back results.

Re: Wildcards in Whitelist/blacklist

Posted: 29 Jul 2014 14:30
by rpw
OK. The information you've provided. Is this added to the existing main.cf or does it replace the two lines in the file?
Also sender_access is blank. Am I adding the /\.example$/ REJECT ? Or what? What I want to reject at this time is China (.cn), Russia (.ru), Palau (.pw) and .asia. How would I format that into the sender access?

Thanks.
Richard

Re: Wildcards in Whitelist/blacklist

Posted: 29 Jul 2014 14:44
by rpw
Went ahead and "added" the lines after the other smtpd lines and added /\.pw REJECT plus the others in the sender access file. Hope this is correct.

As a follow on is there a way to report number of rejected emails? By domain?

Thanks.
Richard.

Re: Wildcards in Whitelist/blacklist

Posted: 29 Jul 2014 15:06
by rpw
FYI; .asia didn't get blocked. Do I need to restart anything?

Re: Wildcards in Whitelist/blacklist

Posted: 29 Jul 2014 16:06
by rpw
Follow up, after configuring it blocked ALL email coming in so I know I did something wrong.

Re: Wildcards in Whitelist/blacklist

Posted: 02 Aug 2014 17:34
by shawniverson
Feel free to share your postfix edits...

Re: Wildcards in Whitelist/blacklist

Posted: 16 Feb 2016 20:46
by irow
I followed the instructions in Shawn's link above, to block the .top TLD, and it worked without any problems. The sender_access file already exists. I just copied and pasted the additional four lines to the end of the /etc/postfix/main.cf file:

Code: Select all

smtpd_client_restrictions = reject_unknown_client_hostname,
check_sender_access pcre:/etc/postfix/sender_access
smtpd_sender_restrictions = reject_unknown_sender_domain,
check_sender_access pcre:/etc/postfix/sender_access
and populated the sender_access file (which was blank) with

Code: Select all

/\.top$/                 REJECT
I then restarted postfix, and no more .top messages. :whistle: