Posts

Showing posts from March, 2013

Specific file extension block in postfix :

How to block attachment file extension in Postfix (OS= Debian) Step 1. Add the following line on main.cf # vim /etc/postfix/main.cf mime_header_checks = regexp:/etc/postfix/mime_header_checks :wq!                 Save and close the file. Step 2. Add following line on /etc/postfix/mime_header_checks file: # vim /etc/postfix/mime_header_checks  /name=[^>]*\.( bat|exe|dll|eml|vbs )/ REJECT     ### File ext that you want to block #### :wq!                 Save and close the file. 3. Restart Postfix service and check with mail log. /etc/init.d/postfix restart Check with mail log tail -f /var/log/mail.log

Specific emails ID only receive mail from specific domains:

Step 1. At first edit the main.cf file of postfix. # vim /etc/postfix/main.cf smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/ protected_destinations , permit_mynetworks, reject_unauth_destination smtpd_restriction_classes = insiders_only insiders_only = check_sender_access hash:/etc/postfix/ insiders , reject [Explanation: smtpd_recipient_restrictions is a postfix parameter, It will check the recipient access by "protected_destinations"- Lets see below what I will put in "protected_destinations"? ] Step 2. Edit and save the following in # vim /etc/postfix/ protected_destinations     xyz@domain.com   insiders_only      [How do postfix knows insider_only?? It has been declared in main.cf with "smtpd_restriction_classes" after that I defined the "insiders_only" in postfix by "/etc/postfix/insiders".] Step 3. Now input /etc/postfix/ insiders # /

Block a specific email address in postfix:(debian)

Block a specific email address in postfix: (incoming)   Sometimes we need to block a specific  email address in postfix. Here is how to do that. Step 1. Add the following line in main.cf # vim /etc/postfix/main.cf smtpd_sender_restrictions = reject_unknown_sender_domain,check_sender_access   hash:/etc/postfix/access Step 2. Now add the address you want to block in access file like following. noreply@test.com          REJECT Step 3. After adding the address postmap the access file. # postmap /etc/postfix/access Now your MX will not receive any mail from the address "noreply@test.com"