Menu

Blocking TLDs

jp7010
2023-02-07
2023-02-08
  • jp7010

    jp7010 - 2023-02-07

    Hello all. I'm trying to block certain TLDs and everything I try I'm getting: 451 4.3.5 email@gmail.com: Sender address rejected: Server configuration error;

    Obviously this is a configuration issue. I've tried following these sites among others:
    https://forum.centos-webpanel.com/index.php?topic=10649.0
    https://www.davidmartinwhite.com/2016/10/25/fighting-spam-block-entire-ttld-with-postfix/
    https://www.ericmichaelstone.com/how-to-block-an-entire-tld-in-postfix/

    Hoping there's and easy fix in my configuration. Sorry, not a postfix expert. If you see any issues in my config I would appreciate suggestions.

    Thanks

    My /etc/postfix/reject_domains looks like:

    /.pro$/ REJECT We reject all .pro domains
    /.date$/ REJECT We reject all .date domains
    /.science$/ REJECT We reject all .science domains
    /.top$/ REJECT We reject all .top domains
    /.download$/ REJECT We reject all .download domains
    /.work$/ REJECT We reject all .work domains
    /.click$/ REJECT We reject all .click domains
    /.link$/ REJECT We reject all .link domains
    /.diet$/ REJECT We reject all .diet domains
    /.review$/ REJECT We reject all .review domains
    /.party$/ REJECT We reject all .party domains
    /.zip$/ REJECT We reject all .zip domains
    /.xyz$/ REJECT We reject all .xyz domains
    /.stream$/ REJECT We reject all .stream domains
    /.bid$/ REJECT We reject all .bid domains
    /.store$/ REJECT We reject all .store domains

    My /etc/postfix/main.cf

    virtual_alias_maps = hash:/etc/postfix/virtual
    relay_domains = mydomain.com
    relayhost = 192.168.1.188:25
    mynetworks = 192.168.188.0/24
    recipient_delimiter = +

    smtpd_restriction_classes = sender_white_list
    sender_white_list = check_client_access hash:/etc/postfix/check_client_access

    # AS SOON AS I UNCOMMENT THESE TWO LINES I GET THE ERROR ON ALL EMAILS

    smtpd_recipient_restrictions =

    check_sender_access pcre:/etc/postfix/reject_domains

    smtpd_helo_required = yes
    smtpd_helo_restrictions =
    permit_mynetworks
    permit_sasl_authenticated
    check_helo_access hash:/etc/postfix/helo_access
    reject_invalid_helo_hostname
    reject_non_fqdn_helo_hostname

    reject_unknown_helo_hostname ###### Commented out 01/30/2023
    reject_rhsbl_helo dbl.spamhaus.org,
    reject_rhsbl_reverse_client dbl.spamhaus.org,
    reject_rhsbl_sender dbl.spamhaus.org,
    reject_rbl_client zen.spamhaus.org

    smtpd_client_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unknown_sender_domain,
    reject_unknown_reverse_client_hostname,
    reject_unknown_client_hostname,
    #...the rest of them,
    permit

     
  • Simon Hobson

    Simon Hobson - 2023-02-07

    Sorry, you are asking in the wrong place :
    This is not a general Postfix help forum - this is for the separate package PostfixAdmin which configures/maintains virtual domains & mailboxes using Postfix (plus MySQL or PostgreSQL, optionally maildrop, and Courier or Dovecot).
    For Postfix help you should head over to postfix.org and check out the Postfix mailing lists.

    But ...
    Looking at those links, you've mistyped your reject_domains file entries. Instead of /.tld/ you have /.tld/. I don't think this would cause Server configuration error as it would (I think) simply mean matching [any character]tld instead of .tld.

     
    • jp7010

      jp7010 - 2023-02-07

      Sorry about that. Thanks.

      On 2/7/2023 4:03 PM, Simon Hobson wrote:

      Sorry, you are asking in the wrong place :
      This is not a general Postfix help forum - this is for the separate
      package PostfixAdmin which configures/maintains virtual domains &
      mailboxes using Postfix (plus MySQL or PostgreSQL, optionally
      maildrop, and Courier or Dovecot).
      For Postfix help you should head over to postfix.org and check out the
      Postfix mailing lists.

      But ...
      Looking at those links, you've mistyped your reject_domains file
      entries. Instead of /.tld/ you have /.tld/. I don't think this would
      cause Server configuration error as it would (I think) simply mean
      matching [any character]tld instead of .tld.


      Blocking TLDs
      https://sourceforge.net/p/postfixadmin/discussion/676076/thread/096a5f5d44/?limit=25#d94f


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/postfixadmin/discussion/676076/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • jp7010

    jp7010 - 2023-02-07

    Sorry about that. Thanks.

     
  • GingerDog

    GingerDog - 2023-02-08

    You probably need to escape the '.' in your regex - else it'll match any character.

    Try e.g.

    /.tld$/ REJECT blah blah

    You should also be able to query that table/file using postmap - which might help you diagnose if you've got your syntax correct - e.g. something like :

    postmap -q pcre:/path/to/something blah.bar.com 
    

    if my memory serves me correctly.

     

Log in to post a comment.

MongoDB Logo MongoDB