I need to allow some domains to get into my postfix mail server. As far as I know this can be done by using Regular Expressions (regexp) in Postfix. I also know that there are attributes which postfix uses to "parse" mails. One of these is "check_sender_access". This one is used to apply Regular expressions on it and filter/control if the mail is REJECTED or PERMITTED. The thing is I want to know what "check_sender_access" catches from the mail in plain text. I want to know, if "check_sender_access" behaves as a variable, what is within it at the time the mail is analized.
For instance, this is the header of a mail (in plain text):
Return-Path: email@example.com Received: from ms3.domain.com (LHLO ms3.domain.com) (10.4.1.4) by ms3.domain.com with LMTP; Thu, 2 Mar 2017 03:00:08 -0500 (CST) Received: from localhost (localhost.localdomain [127.0.0.1]) by ms3.domain.com (Postfix) with ESMTP id E8E8F17CED60 for <firstname.lastname@example.org>; Thu, 2 Mar 2017 03:00:04 -0500 (CST) X-Spam-Flag: YES X-Spam-Score: 7.017 X-Spam-Level: *******
Using this plain text, I want to know which part of the text above is the check_sender_access. Even if it's possible to make some echo check_sender_access > dumpfile. As far as I know "main.cf" (postfix's configuration file) doesn't allows batch commands (echo, grep, for, if,...). If so PLEASE tell me how.
To resume, I want to kinda debug/trace the proccess by knowing every time the value an attribute such as check_sender_access gets (in plain text if possible).
Cause: I used a regular expresion to allow a specific domain but this never worked. However, using the command:
postmap -q "domain.com" regexp:/etc/postfix/regexp/checkDomain this returns me a decision according the regular expression into the checkDomain file. This means the regular expression is working with a "domain.net" string as a test, for instance "gmail.com" is validated correctly.
I think the error could be: 1- The mail is rejected before postfix reaches the line when the check_sender_access part is checked. 2- The regular expression is validating an unexpected line (an entire header instead of a single "gmail.com" or an IP address).
Free software can be very customizable but it's also primitive for certain things. For instance, I can't see the "check_sender_access" creation (route) as a attribute or function.
This is the official info for check_sender_access . Thanks for stopping by and let me know if more info is needed.