Introduction
By default, the Exim service will return the hostname in the SMTP Banner when receiving a valid helo. Some users may configure a different domain in the PTR record and receive this warning as a result of validation checks.
It is advised that the PTR record be updated to match the hostname to address this error. In some cases, this may not be desirable and the below workaround can be used to customize the SMTP Banner in Exim.
Procedure
We recommend that only experienced system administrators perform the steps in this article. cPanel Technical Support does not provide assistance with the steps in this tutorial. These require customizations to the Exim service that will need to be manually maintained by the system administrator for your server.
To make the banner use the domain name instead of the hostname, make the following modifications in the Exim Configuration Manager: Advanced Editor.
1. Change the smtp_banner
option to the following:
"${smtp_active_hostname} ESMTP Exim ${version_number} \#${compile_number} ${tod_full} \nWe do not authorize the use of this system to transport unsolicited, \nand/or bulk e-mail."
This will look like the following:
2. You will then need to scroll to the bottom of the configuration section until you see the following button labeled "Add additional configuration setting".
Click the above button to add a customizable configuration line. We will use this to specify the data that will be returned by the new variable smtp_active_hostname
that was added to the smtp_banner
. To do this you will select smtp_active_hostname
from the dropdown in the new line that was added. Then fill in the second box with the following.
"${if exists{/etc/custom_smtp_banner}{${lookup{$interface_address}lsearch{/etc/custom_smtp_banner}{$value}{$primary_hostname}}}{$primary_hostname}}"
3. Once the above steps are complete, you will need to scroll to the bottom of the editor and click the Save button to apply these changes.
4. You will then need to create the custom file that Exim uses to now determine what domain should be returned for the SMTP Banner instead of the hostname. You can create this file with the appropriate permissions using the following command.
touch /etc/custom_smtp_banner; chown root.mail /etc/custom_smtp_banner; chmod 640 /etc/custom_smtp_banner
5. Once created you will need to add entries using the following format for any IPs that use custom PTR records. Where the first value represents the IP and the second the domain configured in the record. This can be done using your preferred text editor(ie, vi, vim, nano)
1.2.3.4: domain.com
These will not be automatically maintained and will require you to add or remove them manually as needed.
Thats it, now your SMTP Banner will report the configured domain when a ehlo is sent to that IP. You can test this using the telnet command from the local server. After receiving the prompt you will need to input the ehlo command as seen below. As before you will need to replace the example IP with the actual IP that was configured.
[root@server]# telnet 1.2.3.4 25
Trying 1.2.3.4...
Connected to 1.2.3.4.
Escape character is '^]'.
220-host.domain.com ESMTP Exim 4.93 #2 Tue, 29 Dec 2020 07:27:52 -0600
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
ehlo host.domain.com
250-domain.com Hello host.domain.com [1.2.3.4]
For additional details regarding the Exim Advanced Editor and how to use it, see the following article.