Applicable to:
- Plesk for Linux
Question
How to run Postfix on multiple SMTP ports on a Plesk server?
Answer
In this example, an alternate SMTP port 2525 is added in addition to default SMTP port 25.
Note: The master.cf file may be overwritten by Plesk update/upgrade.
- Connect to a Linux server via SSH.
-
Create a backup file of the current
master.cffile:# cp /etc/postfix/master.cf /etc/postfix/master.cf.bak
-
Check the value of the
chrootoption of the standard SMTP service:# postconf -F smtp/inet/chroot
smtp/inet/chroot = n -
Open the file
/etc/postfix/master.cfin any text editor. In this example, we are using the vi editor:# vi /etc/postfix/master.cf
-
Add a line with a new SMTP port like this:
Note: The value in the
chrootcolumn of the new line must be the same as the value returned in step 3 (nin this example). If the standardsmtpservice hasy, usey.CONFIG_TEXT: ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
2525 inet n - n - - smtpd - Save the changes and close the file.
-
Restart Postfix to apply the changes:
# service postfix restart
-
Verify that the new the SMTP port is listening:
# netstat -plutn | grep 2525
tcp 0 0 0.0.0.0:2525 0.0.0.0:* LISTEN 2996/master
tcp6 0 0 :::2525 :::* LISTEN 2996/master -
Verify that SMTP authentication works on the new port. Generate the base64 string with the credentials of an existing mailbox:
# read -rp 'Email: ' SMTP_USER; read -rsp 'Password: ' SMTP_PASS; echo; printf '\0%s\0%s' "$SMTP_USER" "$SMTP_PASS" | base64 -w0; echo; unset SMTP_USER SMTP_PASS
Connect to the new port:
# openssl s_client -connect 127.0.0.1:2525 -starttls smtp -crlf -quiet
Note: Replace
<base64-string>with the output of the first command of this step.Run the following commands in the opened session:
CONFIG_TEXT: EHLO localhost
AUTH PLAIN <base64-string>The server should respond:
PRODUCT_INFO: 235 2.7.0 Authentication successful
If the server responds with
454 4.7.0 Temporary authentication failure: generic failure, make sure that thechrootvalue of the new service is the same as of thesmtpservice, as described in Unable to send an email from Plesk server: SMTP Error (535): Authentication failed. - If a firewall is enabled on the server, make sure the new port is opened in firewall configuration.
Comments
Please sign in to leave a comment.