ATRG - Mail Transfer Agent (MTA)
ATRG - Mail Transfer Agent (MTA)
Solution ID sk109699
Technical Level
Product Harmony Email & Collaboration, Anti-Spam, Threat Emulation, Threat Extraction
Version R77.10 (EOL), R77.20, R77.30 (EOL), R80.10 (EOL), R80.20, R80.30, R80.40, R81
OS Crossbeam XOS, Gaia, SecurePlatform 2.6
Platform / Model All
Date Created 21-Feb-2016
Solution
Table of Contents:
1. Introduction
2. Configuration
3. Limitations
4. Postfix
5. E-mail flow in MTA
6. Control intervals and thresholds for MTA logs
7. CPview integration (Monitoring Threat-Emulation MTA related statistics)
8. Troubleshooting
9. Related documentation
10. Related solutions
11. Revision history
(1) Introduction
Mail Transfer Agent (MTA) can be enabled on the Security Gateway to manage the emulation of SMTP traffic.
It is possible that during file emulation, the e-mail server cannot keep the connection open for the time that is necessary for full emulation. When this happens, there
timeout for the e-mail. A Threat Emulation deployment with an MTA avoids this problem - the MTA completes and closes the connection with the source e-mail server
then sends the file for emulation. After the emulation is complete, the MTA sends the e-mail to the mail server on the internal network.
Decryption of TLS traffic - Threat Emulation must use an MTA to decrypt e-mails for emulation.
Prevention of e-mail traffic - It is recommended to use Threat Emulation profile settings that prevent SMTP traffic. It is possible that during file emulation, the e
server cannot keep the connection open for the time that is necessary for full emulation. When this happens, there is a timeout for the e-mail, and 'Fail Mode' w
be used.
Removal of malicious attachments - When Threat Emulation identifies that an e-mail attachment is malicious, the MTA removes the attachment and sends the
mail.
(2) Configuration
C. Click on the Mail Transfer Agent pane - check the box Enable as a Mail Transfer Agent (MTA).
Example:
iii. Enter the domain for the SMTP traffic for this rule (accepting all traffic by default). Add a rule with a wildcard ("*") as the domain to configure the N
Hop for all emails destined for non-configured domains. A common usage for a wildcard rule is to control bounced emails sent back to the origina
sender.
v. Left-click in the Next Hop cell - select the node object that represents the mail server for this rule.
Example:
E. Optional: Check the box Sign scanned e-mails and enter the message to add to each e-mail when emulation is finished.
After configuring the Security Gateway as an MTA, there are 3 options to configure it in the existing topology.
Choose the correct option according to the topology of the organization and the security needs.
Each organization has an MX record that points to the internal mail server, or to a different MTA.
The MX record defines the next hop for SMTP traffic that is sent to the organization.
In this configuration, the MTA receives all e-mails directed to the organization and sends them to the internal mail server.
After configuring the Security Gateway as an MTA, change the settings to send SMTP traffic from external networks to the Security Gateway.
Important Note: If it is necessary to disable the MTA on the Security Gateway, then first change the SMTP settings or MX records. Failure to do so
can result in lost e-mails.
To configure an MTA for e-mail that is sent to the internal mail server:
B. Change the MX records and define the Security Gateway as the next hop.
The MTA receives e-mails from a preliminary MTA and sends them to the next hop, usually the internal mail server.
If there is an existing MTA used as the preliminary MTA (e.g., as an Anti-Spam solution), then this configuration will suit the best.
A. Edit the SMTP settings on the MTA that sends e-mails to the internal mail server.
B. Change the SMTP settings and define the Security Gateway as the next hop.
The MTA can be used for monitoring the SMTP traffic. Configure the MTA to send e-mails only for emulation, but not to forward them to the mail
server.
Note: Make sure that the mail relay in the network can send a copy of the e-mails to the Check Point MTA.
C. Delete all Mail Forwarding rules (right-click on each rule - go to Rule Actions menu - click on Delete Rule - confirm)
Next Hop cell - left-click in the cell - click on New... button - assign a desired name (e.g., No_Forward) - assign IPv4 address 0.0.0.0 -
click on OK
E. Click on OK.
(3) Limitations
The Threat Prevention rule that is matched for the MTA will be the first rule with “Any” source, that matched the IP address of the MTA in its Protected Scope /
Destination column (“Any” will also match).
Notes:
The match is static, and the MTA will use the same rule for all e-mails.
The matched rule must include Threat Emulation/Threat Extraction inspection. Otherwise, the attachments will not be scanned.
The MTA rule must be rule 1 in the Threat Prevention ruleset.
Single certificate
Anti-Virus is supported on MTA in R80.10 and R80.20 with the latest engine update. Refer to sk123174 to see if your Take supports Anti-Virus.
By default, in versions R80 and lower, there is no option to dynamically resolve the next hop for redundancy/load sharing.
Refer to sk110369 - How to configure load balancing / high availability based on the DNS configuration for Mail Transfer Agent (MTA) .
MTA can function as an Anti-Spam starting in R77.10 - Check Point Security Gateway takes the role of the Exchange Server, and, therefore, is able to decrypt the
encrypted e-mails.
For performance reasons, it is recommended to use different Security Gateways - one as MTA for Anti-Spam and another as MTA for Threat Emulation and Extr
MTA is used by Threat Emulation and Threat Extraction blades for TLS decryption, better threat prevention, etc.
Related solution: sk105482 - Some spam e-mails pass through the Security Gateway even when the Anti-Spam blade is enabled.
Do not select Cluster Virtual Interface(s) in MTA "Advanced Settings" (when clicking on "Configure Settings..." button - in "Select on which interfaces to listen"
section, selecting "Use specific").
Refer to sk107093 - E-mails do not reach the client after selecting Cluster Virtual Interface(s) in MTA "Advanced Settings".
(4) Postfix
Postfix is an open source mail server that is used by Check Point software to route and deliver e-mails in the MTA implementation.
Note: Both files are generated on Security Gateway during policy installation by the process in.emaild.mta.
/opt/postfix/etc/postfix/master.cf
This file configures the communication between Postfix processes and Check Point processes, ports, protocols, and so on.
/opt/postfix/etc/postfix/main.cf
Administrator must be fully aware of implications resulting from manual configuration of Postfix (refer to http://www.postfix.org/postconf.5.html).
Related solution: sk101870 - How to change Postfix configuration for Threat Emulation MTA
Important note regarding main.cf: main.cf is not editable, as it will be overwritten on policy install. Use this procedure:
From the Security Gateway CLI, create the file: touch $FWDIR/conf/mta_postfix_options.cf
Edit the file and add the definitions.
Save the file.
Install the Threat Prevention policy.
A. An e-mail is sent to the MTA on Security Gateway to TCP port 25. (Port 25 is no longer the the only supported port, see sk142932).
B. Postfix on Security Gateway receives all e-mails (clear and encrypted) and responds to the sender.
C. Postfix on Security Gateway decrypts the e-mail (if needed) and saves on the incoming queue (marked as PF1 on the diagram below).
The e-mail is parsed by the MIME parser and the attachments (if any) are sent to Threat Emulation Daemon ted for emulations.
Note: All e-mails are handled by Postfix - regardless whether they contain attachments, or not.
Administrator can configure the desired intervals and thresholds for logs from the Mail Transfer Agent (MTA) when processing e-mails. This will allow to generate log
the following cases:
Note: This feature (ID 02009776) is available only in the following Security Gateways:
The configuration is performed on the Security Gateway configured as Mail Transfer Agent (MTA) in the $FWDIR/conf/mail_security_config file by setting the desired v
for the corresponding parameters (described below).
Important Notes:
The following tables provide the description of the most relevant configuration parameters.
Note: These parameters are located in the $FWDIR/conf/mail_security_config file in the "[mta_log_alerts]" section - under the comment "#Log alerts interva
Default
Parameter Description
value
queues_check_interval Controls how often to check the incoming e-mails in Postfix queues. These checks might result in 8
the new System Alert logs from Mail Transfer Agent (MTA) being displayed in SmartView Tracker / minutes
SmartLog.
alerts_mode_queues_check_interval Controls how long to wait from the time of sending one of the MTA System Alert logs until the next 14
Note: These parameters are located in the $FWDIR/conf/mail_security_config file in the "[mta_log_alerts]" section - under the comment "#Log alerts thresho
Parameter Description Default Notes
value
num_of_waiting_mails_low_svr_th 250
Controls the minimal number of e-mails System Alert log will be generated with
e-mails
that are waiting to be processed - if at least Severity "Low" as long as the number of e-
this number of e-mails are waiting, then a mails that are waiting to be processed is
corresponding System Alert log is between this value and the value of next
generated with Severity "Low". threshold parameter
"num_of_waiting_mails_med_svr_th".
Example of a System Alert log with Severity
"Low" when e-mails are waiting to be If the number of e-mails that are waiting to be
processed: processed decreases below the value of this
parameter, then a Control log is generated
From R8x SmartLog after setting the
("relax" message).
value of 4:
Example of a log when there are no more e-
mails waiting to be processed:
delay_time_low_svr_th 10
Controls how long to wait from the time of System Alert log will be generated with
minutes
receiving at least one e-mail before Severity "Low" as long as the waiting time is
generating a System Alert log with Severity between this value and the value of next
"Low" about a delay in the mails queue (e- threshold parameter
mails are waiting to be processed). "delay_time_med_svr_th".
Example of a System Alert log with Severity If the waiting time decreases below the value of
"Low" when there is a delay in mails queue: this parameter, then a Control log is generated
("relax" message).
From R8x SmartLog after setting the
value of 5: Example of a log when there is no more delay
in mails queue:
num_of_deferred_mails_low_svr_th 1
Controls how many e-mails should be e-mail System Alert log will be generated with
determined by Postfix as Deferred before Severity "Low" as the number of deferred e-
generating a System Alert log with Severity mails is between this value and the value of
"Low" about deferred mails. next threshold parameter
"num_of_deferred_mails_med_svr_th".
Example of a System Alert log with Severity
"Low" when there are deferred mails: If the number of deferred e-mails decreases
below the value of this parameter, then a
From R8x SmartLog:
Control log is generated ("relax" message).
num_of_bounced_mails_low_svr_th 1
Controls how many e-mails should be System Alert log will be generated with
e-mail
determined by Postfix as Bounced before Severity "Low" as the number of bounced e-
generating a System Alert log with Severity mails is between this value and the value of
"Low" about bounced mails. next threshold parameter
"num_of_bounced_mails_med_svr_th".
Example of a System Alert log with Severity
"Low" when there are bounced mails: If the number of bounced e-mails decreases
below the value of this parameter, then a
From R8x SmartLog:
Control log is generated ("relax" message).
(7) Mail Transfer Agent (MTA) - CPview integration (Monitoring Threat-Emulation MTA related statistics)
This feature reflects MTA internal statistics via the CPview utility.
Under CPVIEW.Software-blades.Threat-Emulation, a new MTA tab has been added. This tab contains 2 sections:
1. Queues Section:
2. Monitoring Section
Note: All the counters listed display the amount of emails in the last x seconds, where x is the CPView refresh interval (two seconds by default). To change the CPView
refresh interval, under CPview, press the "r" key and enter the desired interval in seconds.
(8) Troubleshooting
/var/log/maillog
How to monitor and manage Postfix queue:
Action Command
(5632E28B0044 is an example
[Expert@HostName:0]# /opt/postfix/usr/sbin/postcat -c /opt/postfix/etc/postfix/ -q 5632E28B0044 | less
Queue ID from the current queue)
(5632E28B0044 is an example
[Expert@HostName:0]# /opt/postfix/usr/sbin/postsuper -c /opt/postfix/etc/postfix/ -d 5632E28B0044
Queue ID from the current queue)
recepient.example@domain.example.com
B. Monitor the postfix queue and try to find a reason for the delay from the postfix queue
If there is no request sent with the recipient name, then the e-mail did not contain attachments.
This means that the delay is caused only because of the communication between postfix and in.emaild.mta process.
Check the CPU load on the Security Gateway (refer to "CPU" sections in sk98348).
Collect the contents of the current postfix queue for later investigation.
If there is a request sent with the recipient name, then go to the line number that matches the request that was sent to that recipient.
If this message does not appear, then the communication with Threat Emulation Daemon ted was not initialized.
Check that ted process is up ("ps auxw | grep -w ted") and is responding ("tecli show").
check if it crashed with core dump files ("ls -l /var/log/dump/usermode/ | grep ted")
collect $FWDIR/log/ted.elg* files
collect $FWDIR/log/fwd.elg* files
CPinfo file from the Security Gateway
CPinfo file from the Security Management Server
use the Appliance Sizing Tool to check that this appliance matches the current throughput and number of users:
go to UserCenter - go to "QUOTING TOOLS" menu at the top - click on "Appliance Sizing Tool"
(in addition, refer to sk93598 - Threat Emulation Sizing Mode: how to measure the required inspections at an organization)
collect Threat Emulation statistics ("tecli show statistics")
collect Threat Emulation throughput ("tecli show throughput")
Check of ted process has responded with the verdict to the request - search for this line:
Run:
If this message does not appear, then look for the attachment in Threat Emulation (proceed to the next step).
From the $FWDIR/log/in.emaild.mta.elg* log files you have the name of the attachment file.
Search for this attachment in the ted process debugs (collected in the previous step):
At the beginning of the line, there is a UUID of the attachment in the format {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.
Background:
Postfix built-it queue monitoring abilities are lacking, which makes it very hard to analyze Postfix bottlenecks.
The "cpqshape" utility helps understand the Postfix queue message distribution in time and by sender / recipient domain.
Note: The "cpqshape" utility (ID 02002951) is available only in the following Security Gateways:
Syntax:
Documentation:
For more information about this utility, refer to:
Configuration
Troubleshooting
Applies To:
This SK replaces sk118412