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

Topic: Change Hostname

Hi,

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

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

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.

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"
else
    echo "Your distribution is not supported yet."
    exit 255
fi

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_COUNTRY='DE'
export TLS_STATE=''
export TLS_CITY=''
export TLS_COMPANY="${HOSTNAME}"
export TLS_DEPARTMENT='IT'
export TLS_HOSTNAME="${HOSTNAME}"
export TLS_ADMIN="root@${HOSTNAME}"

openssl req \
        -x509 -nodes -days 3650 -newkey rsa:1024 \
        -subj "/C=${TLS_COUNTRY}/ST=${TLS_STATE}/L=${TLS_CITY}/O=${TLS_COMPANY}/OU=${TLS_DEPARTMENT}/CN=${TLS_HOSTNAME}/emailAddress=${TLS_ADMIN}/" \
        -out ${SSL_CERT_FILE} -keyout ${SSL_KEY_FILE}