Configure Incoming Filtering with Postfix

To restrict deliveries to your Postfix server from our filtering nodes and IP addresses, complete the below steps:

  1. Create the file /etc/postfix/access with the content:
  2. 185.201.16.200/24 OK
    185.201.17.200/24 OK
    185.201.18.200/24 OK
    185.201.19.200/24 OK
  3. Execute the command:
  4. postmap /etc/postfix/access

  5. Either:
    1. Add the following to /etc/postfix/main.cf
      smtpd_client_restrictions = check_client_access hash:/etc/postfix/access, 
      permit_mynetworks, reject
    2. OR

    3. If you already have smtpd_client_restrictions defined in /etc/postfix/main.cf, insert the following at the beginning of your definition and replace permit with reject at the end of definition:

      "check_client_access hash:/etc/postfix/access"

  6. Reload the Postfix configuration by executing the following command:
  7. sudo postfix reload

  8. Restart Postfix by executing the following command:
  9. /etc/init.d/postfix restart

Per domain setup

It's also possible with Postfix to configure the MTA to only allow connections from the Mail Assure servers for specific protected domains:

  1. Add the following to the main.cf
  2. smtpd_restriction_classes = mailassuremailassure = check_client_access hash:/etc/postfix/mailassure, reject
    smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/protected_destinations, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
  3. Create the following file:
  4. /etc/postfix/mailassure
    1. Add the following content:
    2. 185.201.16.200/24 OK
      185.201.17.200/24 OK
      185.201.18.200/24 OK
      185.201.19.200/24 OK
  5. Create the following file:
  6. /etc/postfix/protected_destinations

    1. Add the domains that you want to configure:
    2. demo-domain.invalid mailassure

  7. Postmap both files:
  8. postmap /etc/postfix/mailassure

    postmap /etc/postfix/protected_destinations

  9. Reload the Postfix configuration by executing the following command:
  10. sudo postfix reload

  11. Restart Postfix by executing the following command:
  12. /etc/init.d/postfix restart