0

I've got a dedicated server (Ubuntu 14.04) with Postfix/Dovecot on IP 1.1.1.1

I'm hosting 4 domains: 2 on IP 1.1.1.1, 1 on IP 1.1.1.2 and 1 on IP 1.1.1.3. Each one of these domains got a DNS record (A domain.com/mail.domain.com, MX record, SPF etc) pointing at their own IP address.

The problem is whenever I send an email and check out the email's header I see:

> X-Spam-Last-External-IP: 1.1.1.1
> X-Spam-Last-External-HELO: server.hostname.com 
> X-Spam-Last-External-rDNS: Default Domain on 1.1.1.1
> Received: from server.hostname.com (Default Domain [1.1.1.1])
etc..

Is it not possible to show each time domain's related information instead of server information? For example 1.1.1.2 IP and mail.domain2.com hostname etc?

2 Answers 2

3

I don't think it's possible to have one postfix process listen on all addresses but use multiple hostnames for eg HELO headers, because the SMTP protocol doesn't support any way for the client to specify the hostname.

Consider for a moment HTTP Virtual hosting as a similar scenairo, perhaps the one you have in mind. The client resolves the hostname, then makes an HTTP request, specifying the hostname in the Host header. This header is what makes virtual hosting possible.

Now consider HTTPS. Until relatively recently, there was no way to host multiple HTTPS virtual hosts on a server because the Host header was part of the encrypted payload, and thus the TLS session had to be established before the Host header would be sent. But since the certificate provided by the server was dependent on the Host name used, this meant that an IP address had to be dedicated to each distinct HTTPS server name ( or more accurately, each https certificate common name. Wildcards could match multiples ).

Relatively recently the SNI extension was added to HTTPS to alleviate that problem, so now the Host header is available to the server before the TLS session is established.

OK, let's jump back to SMTP. An SMTP client doesn't specify a particular server name when it connects. The server actually identifies itself before the host asks anything!

$ telnet  gmail-smtp-in.l.google.com. 25
Trying 74.125.29.27...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP 11si20717228qkl.61 - gsmtp

There is, however, something you can do in your situation, but it's rather inconvenient. You can run multiple postfix servers, each listening on a dedicated IP, and each configured to respond with the appropriate name. It is in my understanding the only way to achieve what you want, and analogous to running https servers on dedicated IPs in the pre-SNI days.

Hope it helps.

2

You'd need a Postfix setup using "multiple instances" for that. Each instance would bing to it's specific IP (and only that IP), for both incoming and outgoing mail.

http://www.postfix.org/MULTI_INSTANCE_README.html

Theoretically, one could define dedicated "smtp" transports in master.cf (each bound to exactly one IP) - but there would be no easy way of telling Postfix which IP to use for an outgoing mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.