For SMTP connections, by default the Mail Transport Agent Exim is listening on port 25 only. A while ago I wanted to add some further ports in my Exim install.
If, like me, you have your Exim installed via the official Debian package, you want to apply the changes the Debian way.
On the wrong track
When you google for how to do this you will still find the following information in several search hits:
The prefered way of changing the SMTP listening port or having Exim listening on additional ports is by adding the -oX command to the SMTPLISTENEROPTIONS variable in /etc/default/exim4.
And yes, when I checked /etc/default/exim4 on my install it contained at the end of the file the following:
# /etc/default/exim4
EX4DEF_VERSION=''
[...]
# Options for the SMTP listener daemon. By default, it is listening on
# port 25 only. To listen on more ports, it is recommended to use
# -oX 25:587:10025 -oP /run/exim4/exim.pid
#SMTPLISTENEROPTIONS=''
So I added the additional ports to SMTPLISTENEROPTIONS, uncommented the line and restarted Exim. Nothing changed. Exim was still listening on port 25 only.
How to do it right
After quite a while of troubleshooting I found out that the above structure of /etc/default/exim4 is deprecated since August 2023. In a new Exim4 install the postinstall script would create /etc/default/exim4 as follows:
# /etc/default/exim4
# Options/arguments for exim daemon when run from systemd service
# EXIMSERVICE='-bdf -q30m'
# Options/arguments for exim daemon when run from init script
# EXIMDAEMONOPTS='-bd -q30m'
# Additional options for update-exim4.conf(8)
# UPEX4OPTS=''
The -oX 25:587:10025 -oP /run/exim4/exim.pid should now be added to either EXIMSERVICE or EXIMDAEMONOPTS depending on which startup mechanism you use.
RTFM
Of course this is very well documented in /usr/share/doc/exim4-config/changelog.Debian.gz, /usr/share/doc/exim4-config/NEWS.Debian.gz and /usr/share/doc/exim4-config/NEWS.Debian.gz.
Next time I better consult the package documentation first rather than googeling for answers in the web.