Articles in this section

How to run Postfix on multiple SMTP ports on a Plesk server

kb: how-to Plesk for Linux ABT: Group A

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.

  1. Connect to a Linux server via SSH.
  2. Create a backup file of the current master.cf file:

    # cp /etc/postfix/master.cf /etc/postfix/master.cf.bak

  3. Check the value of the chroot option of the standard SMTP service:

    # postconf -F smtp/inet/chroot
    smtp/inet/chroot = n

  4. Open the file /etc/postfix/master.cf in any text editor. In this example, we are using the vi editor:

    # vi /etc/postfix/master.cf

  5. Add a line with a new SMTP port like this:

    Note: The value in the chroot column of the new line must be the same as the value returned in step 3 (n in this example). If the standard smtp service has y, use y.

    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

  6. Save the changes and close the file.
  7. Restart Postfix to apply the changes:

    # service postfix restart

  8. 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

  9. 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 the chroot value of the new service is the same as of the smtp service, as described in Unable to send an email from Plesk server: SMTP Error (535): Authentication failed.

  10. If a firewall is enabled on the server, make sure the new port is opened in firewall configuration.
Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.