1 (edited by peterpp 2009-11-01 03:31:10)

Topic: Change Hostname


i discovered that I had a typo in my fqdn while installing iRedMail.

What do I need to do to change the hostname after the installation:

- change hostname in /etc/hostname and /etc/hosts
- generate new certificate for dovecot (how do I do this?)
- generate new certificate for apache (how do I do this?)
- change hostname in amavis.conf
- change hostname in dovecot-quota-warning.sh
- change hostname in posfix/main.cf
- what else?

Greets, peterpp


Re: Change Hostname

Almost the complete list. smile

Don't forget to sync files under /var/spool/postfix/etc/. You can simplily copy files under /etc/ to /var/spool/postfix/etc/, and then restart postfix.


Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

3 (edited by peterpp 2009-11-01 20:07:36)

Re: Change Hostname

Do I need to copy all files from /etc? Why so, which configuration files are read from there?
cp -Rf /etc /var/spool/postfix ?
/edit/ Answer: Since postfix is chrooted to /var/spool/postfix it needs these files to be able to determine hostname etc.
Not all files are requiered only hosts, localtime, nsswitch.conf, resolv.conf, services /edit/

And how do I create the TLS certificates? Does iRedMail use different certificates for dovecot and apache?
Or do I just need to recreate the iRedMail_CA.pem with the command I found in functions/packages.sh?
/edit/ Answer: Well apparently apache and dovecot use the same hostname, script for new certificate attached. /edit/

#!/usr/bin/env bash
# Generate new certificate for iRedMail 0.5.0

if [ X"${DISTRO}" == X"RHEL" ]; then
    export SSL_FILE_DIR="/etc/pki/tls"
elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
    export SSL_FILE_DIR="/etc/ssl"
    echo "Your distribution is not supported yet."
    exit 255

export HOSTNAME="$(hostname --fqdn)"
export SSL_CERT_FILE="${SSL_FILE_DIR}/certs/iRedMail_CA.pem"
export SSL_KEY_FILE="${SSL_FILE_DIR}/private/iRedMail.key"
export TLS_STATE=''
export TLS_CITY=''
export TLS_ADMIN="root@${HOSTNAME}"

openssl req \
        -x509 -nodes -days 3650 -newkey rsa:1024 \
        -out ${SSL_CERT_FILE} -keyout ${SSL_KEY_FILE}