How To Block Email Using Subject Headers In Postfix

Author: , December 7th, 2021

I needed to block email based on the Subject header. The solution is simple: Edit main.cf as root and uncomment or add:

Next, creaate or edit /etc/postfix/header_checks as root and add the following line:

Finally, run sudo postfix reload NOTE: Do NOT add the “i” after the regular expression! It is case-insensitive by […]

How To Block All Traffic From China Using iptables and ipset on Amazon Linux

Author: , October 24th, 2019

All credit to Matt Wilcox for this excellent article, for which this post is based – thank you, Matt! https://mattwilcox.net/web-development/unexpected-ddos-blocking-china-with-ipset-and-iptables/ All commands run as root!

Do this once only:

Then add blockchina to the root cron

How To Block an Entire TLD in Postfix

Author: , September 13th, 2016

Step 1. Execute the following two commands: postconf -e smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains postconf -e reject_unauth_destinations=pcre:/etc/postfix/rejected_domains If that doesn’t work, you may hand-edit main.cf and add/edit these lines:

Step 2. Create the regex filter file: vim /etc/postfix/rejected_domains

Step 3. Signal Postfix to reread the config: postfix reload NOTE: Do NOT use the postmap command for the […]

How To Block WordPress XMLRPC Attacks

Author: , July 8th, 2014

Add the following to either your .htaccess file or to your Apache config:

How To Create a Code Block in PHP for Error Handling

Author: , October 19th, 2012

The do/while statement is sometimes used to break out of a block of code when an error condition occurs. For example:

Because the condition for the loop is false, the loop is executed only once, regardless of what happens inside the loop. However, if an error occurs, the code after the break is not […]

How To Block/Reject Email From Or To A Specific Address Using Postfix On CentOS

Author: , June 3rd, 2011

By default, the Postfix SMTP server accepts any sender address. You block email addresses using the sender_access file: