Blacklist question

Discussion in 'Server Operation' started by bigmatlem, Feb 13, 2021.

  1. bigmatlem

    bigmatlem Member

    I'd like to black list an entire .domain rather than example.com
    I'm trying @*.domain to catch the spammers for example .today, .buzz, etc. Will with work that way?
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  3. MaxT

    MaxT Active Member

    to block an entire TLD like .pro, .bid,.top, etc...

    create one -pcre file, in example reject_domains.pcre and put the desired tld domains inside:
    Code:
    # nano /etc/postfix/reject_domains.pcre
    
    /\.top$/ DISCARD
    /\.pro$/ DISCARD
    /\.business$/ DISCARD
    /\.br$/ REJECT Sorry, temporarily rejected TLD .BR because spam
    
    you can see the difference in the last line: if you wish to give an explanation to the sender for some temporary situation, then use REJECT, and at the end of that same line you can write some explanation about that specific domain.

    Save and exit.

    Now edit /etc/postfix/main.cf and search the smtpd_sender_restrictions section to include this line:
    Code:
    # nano /etc/postfix/main.cf
    
    smtpd_sender_restrictions =
    check_sender_access pcre:/etc/postfix/reject_domains.pcre
    
    Save and exit

    Restart postifx:
    Code:
    # service postfix restart
    
    that's all
     
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    For anyone who finds this and wants to follow, note that sender restrictions will usually have a lot more items that just the single one shown. Probably you can just insert this in the front of your existing list.
     
    MaxT likes this.
  5. MaxT

    MaxT Active Member

    you are right! ;)
     

Share This Page