Configuring Postfix
How to configure Postfix.
Before you begin
- Postfix in version 3.x or higher is installed on your target system.
Procedure
- Connect to the target server using your preferred SSH tool (e.g. Putty) and log in.
-
Configure that all emails to the domain of your custom email token profile are
inbound and the rest is outbound as follows:
- Change to the folder /etc/postfix/ and create a new file named user_map
-
Edit the file and add the configuration, for example:
demo.eperi-cdp.com inbound * outbound - Save and exit the file.
-
Configure your custom email token profile domain as relay domain as
follows:
- Still in the folder /etc/postfix/, create a new file named relay_domains
-
Edit the file and add the configuration, for example:
demo.eperi-cdp.com 1 - Save and exit the file.
-
Convert the two files from above to the Postfix database format:
postmap /etc/postfix/user_map postmap /etc/postfix/relay_domains -
Edit the main configuration file /etc/postfix/main.cf and
adjust (or add, if not present) the following parameters:
Parameter Explanation smtpd_recipient_restrictions=check_recipient_access hash:/etc/postfix/user_map To define whether a given email is intended to be inbound (from an external sender to your intercepted application) or outbound (from intercepted application to an external recipient).
relay_domains = hash:/etc/postfix/relay_domains To configure your custom TokenProfile email domain as relay domain. smtpd_restriction_classes = inbound, outbound inbound=reject_unknown_sender_domain
outbound=permit_mynetworks
To configure the behaviour of Postfix in different cases: For inbound emails (to your intercepted application) it only rejects unknown sender domains, while for outbound emails (from your intercepted application) we only accept sender IPs that are in the range of mynetworks (see the parameter mynetworks below). mynetworks = 127.0.0.1 The allowed sender addresses, separated by spaces (Please add the IP addresses your intercepted application is sending emails from) smtpd_milters = inet:localhost:8280 Where the Milter app is running. 8280 is the default port. (A different port could theoretically be configured.) milter_default_action = reject How to react if Milter encounters a problem: Reject all further commands in this session with a permanent status code. -
Restart Postfix, for example:
sudo systemctl restart postfix
