After container cloning and hostname change in Plesk, Postfix is still using old hostname

Created:

2016-12-18 06:50:25 UTC

Modified:

2017-08-08 13:40:51 UTC

0

Was this article helpful?


Have more questions?

Submit a request

After container cloning and hostname change in Plesk, Postfix is still using old hostname

Applicable to:

  • Plesk Onyx for Linux

Symptoms

Virtuozzo container is created with hostname one.example.com and Plesk Onyx is installed on it.

When this container is cloned and the hostname is changed via Plesk at Tools & Settings > Server Settings > Full hostname to two.example.com , Postfix still uses old hostname and there is old hostname in its configuration file /etc/postfix/main.cf :

# cat /etc/postfix/main.cf
myhostname = one.example.com

Cause

This is a software issue PPPM-5376 . The fix is considered to be included in one of the next Plesk updates.

Resolution

Until the software issue is fixed, the following workaround can be applied:

  1. Backup the Postfix configuration file:

    # cp /etc/postfix/main.cf{,.orig}
  2. Change the myhostname parameter in the file /etc/postfix/main.cf to a new hostname:

    # cat /etc/postfix/main.cf
    myhostname = two.example.com

If hostname need to be changed periodically use the following simple script (for RedHad-bases systems):

#!/bin/bash
HNAME=$1
FILE="/etc/postfix/main.cf"
hostnamectl set-hostname $HNAME
REPLACE="myhostname = ""$1"
echo "postfix hostname line is set to " "$REPLACE"
cp -a /etc/postfix/main.cf /root/main.cf.backup
sed -i "/^myhostname/s/.*/`echo $REPLACE`/" $FILE

Have more questions? Submit a request
Please sign in to leave a comment.