1

Topic: [Question] Different hostname and mail domain name

is it possible and does it make sense to have a machine with a hostname (mail3) that differs from my mx domain (mail)?

my thought would be to have a machine called `mail3.example.com` so the hostname would be `mail3` but the mailserver components should act as the hostname would be `mail.example.com` so i can easily migrate to a new machine sometimes. then i would create a new machine `mail4.example.com` which is configured as `mail.example.com` and silently migrate to the new machine by moving the elastic ip to the new machine.

----

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

2

Re: [Question] Different hostname and mail domain name

is it enough to follow https://docs.iredmail.org/change.server.hostname.html set the system hostname to mail3 and all other components mail?

btw in https://docs.iredmail.org/change.server.hostname.html nginx is missing.

3

Re: [Question] Different hostname and mail domain name

The point is your hostname must be resolvable by DNS query and pointed to IP of your server, and vice verse.
So, better NOT do it as you described.

c33s wrote:

is it enough to follow https://docs.iredmail.org/change.server.hostname.html set the system hostname to mail3 and all other components mail?

yes.

c33s wrote:

btw in https://docs.iredmail.org/change.server.hostname.html nginx is missing.

Nginx uses wildcard hostname by default with default iRedMail settings, so no change required. But if you hard-coded your server hostname in Nginx, you need to update it too.

4 (edited by c33s 2019-04-28 19:37:18)

Re: [Question] Different hostname and mail domain name

edit added bbcode formated text. converted with Markdown to BBCode converter https://alfateam123.github.io/md2bbc/ + small fixes

thanks @ZhangHuangbin

The point is your hostname must be resolvable by DNS query and pointed to IP of your server, and vice verse.

servers native ip: 1.2.3.4  dns entry mail3.example.com -> 1.2.3.4
servers elastic ip: 4.3.2.1 dns &amp; reverse dns mail.example.com <-> 4.3.2.1

both ips are connected to the same server.

So, better NOT do it as you described.

what would be the arguments for not doing it?

yes.

what about the other files like

/etc/mailname

and the spool/cached/binary files? how they get "regenerated"?


even i currently run the installer normal without changing hostname my postfix mail.cf looks like this:

...
# hostname
myhostname = mail3.example.com
myorigin = mail3.example.com
mydomain = mail3.example.com

...

mynetworks = 127.0.0.1

# Accepted local emails
mydestination = $myhostname, localhost, localhost.localdomain
...

the output of postconf locks strange. why is mydomain localdomain if i installed it with mail3.example.com which is also in my mail.cf?

postconf -d | grep -e "^my"
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = localdomain
myhostname = mail3.localdomain
mynetworks = 127.0.0.0/8 10.0.2.0/24 192.168.10.0/24
mynetworks_style = ${{$compatibility_level} < {2} ? {subnet} : {host}}
myorigin = $myhostname

just to add the infos i found out so far to help other people comming here later:

os is debian stretch (currently on vagrant)

https://wiki.debian.org/EtcMailName

files containing

mail3

(removed non relevant ones from list below)

root@mail3:~# grep -rnw / --exclude-dir={bin,boot,dev,lib,lib64,media,mnt,proc,sbin,sys,tmp,log,vmail,lvm,vagrant,puppetlabs,puppet-enc} -e 'mail3'
/etc/amavis/conf.d/50-user:12:$myhostname = 'mail3.example.com';

/etc/mailname:1:mail3.example.com

/etc/hostname:1:mail3

/etc/postfix/main.cf:237:myhostname = mail3.example.com
/etc/postfix/main.cf:238:myorigin = mail3.example.com
/etc/postfix/main.cf:239:mydomain = mail3.example.com

Binary file /etc/postfix/aliases.db matches

/etc/hosts:2:127.0.1.1 mail3.example.com mail3
/etc/hosts:3:192.168.10.10 mail3.example.com mail3

Binary file /etc/aliases.db matches

/root/___iRedMail-0.9.9/iRedMail.tips:152:        - URL: https://mail3.example.com/iredadmin/
/root/___iRedMail-0.9.9/iRedMail.tips:163:        - URL: http://mail3.example.com/mail/ (will be redirected to https:// site)
/root/___iRedMail-0.9.9/iRedMail.tips:164:        - URL: https://mail3.example.com/mail/ (secure connection)
/root/___iRedMail-0.9.9/runtime/pkg.install.log:960:setting myhostname: mail3.example.com
/root/___iRedMail-0.9.9/runtime/pkg.install.log:964:setting destinations: $myhostname, mail3.example.com, localhost.example.com, , localhost

Binary file /opt/iRedAPD-2.7/settings.pyc matches

/opt/iRedAPD-2.7/settings.py:40:srs_domain = "mail3.example.com"

/var/spool/postfix/etc/hosts:2:127.0.1.1 mail3.example.com mail3
/var/spool/postfix/etc/hosts:3:192.168.10.10 mail3.example.com mail3

Binary file /var/cache/man/index.db matches

/var/cache/debconf/config.dat:388:Value: $myhostname, mail3.example.com, localhost.example.com, , localhost
/var/cache/debconf/config.dat:410:Value: mail3.example.com

/run/motd.dynamic:1:Linux mail3 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64

###############################################################################

orginal markdown post starts here

thanks @ZhangHuangbin

> The point is your hostname must be resolvable by DNS query and pointed to IP of your server, and vice verse.

servers native ip: 1.2.3.4  dns entry mail3.example.com -> 1.2.3.4
servers elastic ip: 4.3.2.1 dns & reverse dns mail.example.com <-> 4.3.2.1

both ips are connected to the same server.

> So, better NOT do it as you described.
what would be the arguments for not doing it? (if the ips and the reverse dns entries are correctly setup)

> yes.
what about the other files like `/etc/mailname` and the spool/cached/binary files? how they get "regenerated"?

even i currently run the installer normal without changing hostname my postfix mail.cf looks like this:

```
...
# hostname
myhostname = mail3.example.com
myorigin = mail3.example.com
mydomain = mail3.example.com

...

mynetworks = 127.0.0.1

# Accepted local emails
mydestination = $myhostname, localhost, localhost.localdomain
...
```

the output of postconf locks strange. why is mydomain localdomain if i installed it with mail3.example.com which is also in my mail.cf?

```
postconf -d | grep -e "^my"
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = localdomain
myhostname = mail3.localdomain
mynetworks = 127.0.0.0/8 10.0.2.0/24 192.168.10.0/24
mynetworks_style = ${{$compatibility_level} < {2} ? {subnet} : {host}}
myorigin = $myhostname
```

just to add the infos i found out so far to help other people comming here later:

os is debian stretch (currently on vagrant)

https://wiki.debian.org/EtcMailName

files containing `mail3` (removed non relevant ones from list below)

`root@mail3:~# grep -rnw / --exclude-dir={bin,boot,dev,lib,lib64,media,mnt,proc,sbin,sys,tmp,log,vmail,lvm,vagrant,puppetlabs,puppet-enc} -e 'mail3'`
```
/etc/amavis/conf.d/50-user:12:$myhostname = 'mail3.example.com';

/etc/mailname:1:mail3.example.com

/etc/hostname:1:mail3

/etc/postfix/main.cf:237:myhostname = mail3.example.com
/etc/postfix/main.cf:238:myorigin = mail3.example.com
/etc/postfix/main.cf:239:mydomain = mail3.example.com

Binary file /etc/postfix/aliases.db matches

/etc/hosts:2:127.0.1.1 mail3.example.com mail3
/etc/hosts:3:192.168.10.10 mail3.example.com mail3

Binary file /etc/aliases.db matches

/root/___iRedMail-0.9.9/iRedMail.tips:152:        - URL: https://mail3.example.com/iredadmin/
/root/___iRedMail-0.9.9/iRedMail.tips:163:        - URL: http://mail3.example.com/mail/ (will be redirected to https:// site)
/root/___iRedMail-0.9.9/iRedMail.tips:164:        - URL: https://mail3.example.com/mail/ (secure connection)
/root/___iRedMail-0.9.9/runtime/pkg.install.log:960:setting myhostname: mail3.example.com
/root/___iRedMail-0.9.9/runtime/pkg.install.log:964:setting destinations: $myhostname, mail3.example.com, localhost.example.com, , localhost

Binary file /opt/iRedAPD-2.7/settings.pyc matches

/opt/iRedAPD-2.7/settings.py:40:srs_domain = "mail3.example.com"

/var/spool/postfix/etc/hosts:2:127.0.1.1 mail3.example.com mail3
/var/spool/postfix/etc/hosts:3:192.168.10.10 mail3.example.com mail3

Binary file /var/cache/man/index.db matches

/var/cache/debconf/config.dat:388:Value: $myhostname, mail3.example.com, localhost.example.com, , localhost
/var/cache/debconf/config.dat:410:Value: mail3.example.com

/run/motd.dynamic:1:Linux mail3 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64
```

5

Re: [Question] Different hostname and mail domain name

c33s wrote:

servers native ip: 1.2.3.4  dns entry mail3.example.com -> 1.2.3.4
servers elastic ip: 4.3.2.1 dns &amp; reverse dns mail.example.com <-> 4.3.2.1
both ips are connected to the same server.

This should be fine.