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, 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.
You can find the above information in several search hits when you google for this problem. When I checked /etc/default/exim4 on my install it looked like
# /etc/default/exim4
EX4DEF_VERSION=''
# 'combined' - one daemon running queue and listening on SMTP port
# 'no' - no daemon running the queue
# 'separate' - two separate daemons
# 'ppp' - only run queue with /etc/ppp/ip-up.d/exim4.
# 'nodaemon' - no daemon is started at all.
# 'queueonly' - only a queue running daemon is started, no SMTP listener.
# setting this to 'no' will also disable queueruns from /etc/ppp/ip-up.d/exim4
QUEUERUNNER='combined'
# how often should we run the queue
QUEUEINTERVAL='30m'
# options common to quez-runner and listening daemon
COMMONOPTIONS=''
# more options for the daemon/process running the queue (applies to the one
# started in /etc/ppp/ip-up.d/exim4, too.
QUEUERUNNEROPTIONS=''
# special flags given to exim directly after the -q. See exim(8)
QFLAGS=''
# 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.
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 which startup mechanism you use.
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.