How to configure SMTP banner in exim

Email servers answer connections on port 25 with a string of text called an SMTP Banner whose purpose is to announce the server and any information that the administrator would like to convey to the world.

It is best practice to put the name of your server in your SMTP banner so that anybody who connects via your IP Address has a clue as to who they are talking to.

The benefits of doing this are minimal and many servers perform a banner check as part of spam mitigation.

This article explains the steps to configure banner in exim mail server.

Open the exim configuration file

#vi /etc/exim.conf

Remove the below line from /etc/exim.conf

smtp_banner = "${primary_hostname} ESMTP Exim ${version_number} \
\#${compile_number} ${tod_full} \n\
We do not authorize the use of this system to transport unsolicited, \n\
and/or bulk e-mail."

Add the below lines to /etc/exim.conf inplace of that removed line

smtp_banner = "${smtp_active_hostname}"
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/ip_hostname}{$value}{$primary_hostname}}

Then create file /etc/ip_hostname and add ip and domain like this

192.168.1.20: mail.example.com

Restart exim Service

#service exim restart

Set readonly attribute to exim configuration file.

#chattr +i /etc/exim.conf

Verify the settings using the following command

root@server1 [~]# telnet example.com 25
Trying 192.168.1.20...
Connected to example.com.
Escape character is '^]'.
220 mail.example.com
quit
221 mail.example.com closing connection
Connection closed by foreign host.

Leave a Reply

Your email address will not be published. Required fields are marked *