Define myhostname in Postfix for each server with dedicated IP address

10 posts / 0 new
Last post
#1 Tue, 10/09/2018 - 12:34
regodon

Define myhostname in Postfix for each server with dedicated IP address

I don't know if it can be called a bug or a feature request...

We host several domains, and each domain has its own dedicated IP address. We configured Postfix to use "Sender Dependent Transport Mapping" So the outgoing mail uses the domain's IP address and it works well. The problem comes when you (or any Internet mail server) connect to our mail server through the domain's dedicated ip address because the smtpd banner they get includes the server's hostname instead of the hosted domain name.

I think it can be called a "bug" because this issue is causing trouble with some servers tagging our emails as spam because the hostname in the banner doesn't match reverse IP address hostname or MX or SPF outgoing mail server name.

I can manually fix the issue editing /etc/postfix/master.cf and adding "-o myhostname=ourdomainname.com" to every domain we host, but I think it should be automatically added when Dependent transport mapping is in use or at least, be a configurable option.

Tue, 10/09/2018 - 14:26
atleast
atleast's picture

Appreciate your posting this issue. I have the same issue. But I have just followed the common settings and in myhostname and mydomain is the name of host. Can you post your configs here if possible. Have you seen other config files like /etc/postfix/canonical /transport /virtual /generic etc?

When you say manual fix of adding to every domain does that really work? Also if possible kindly suggest how do we add Sender Depend. Transport Mapping?

Besides the issue of Letsencrypt certificate for each domain on unique IP is not clear - as when we use ADD TO POSTFIX it only adds the last domain which becomes default. ADD TO DOVECOT creates the follow entry on dovecot.conf for each domain which perhaps is good. BUT can similar be done for postfix? ANY HELP will be greatly appreciated.

local_name www.domain.com {
ssl_cert = </home/user/ssl.cert
ssl_key = </home/user/ssl.key
}
Tue, 10/09/2018 - 14:28
andreychek

Howdy,

regodon, that's a reasonable request.

Could you post your solution as a Feature Request in the Support Tracker?

There, we can get Jamie to take a look and we'll see if that's feasible to code in.

-Eric

Tue, 10/09/2018 - 15:20
atleast
atleast's picture

Hello Eric @andreychek I found this old link https://www.virtualmin.com/node/24115 where you explained about sender dependent transport mapping. Is there any step by step guide to configure Postfix and dovecot anywhere? There are many links but its all fractions of info.

Tue, 10/09/2018 - 18:02
andreychek

The link Jamie shared in Comment #2 of that thread should be what you're after.

Tue, 10/09/2018 - 18:07 (Reply to #5)
atleast
atleast's picture

Dear Eric @andreychek I appreciate so much your help. You and Jamie both are angels of very higher dimension and I admire you. You both have helped thousands of people you dont know but know that you both get blessings. Grateful to you for always being there..

Tue, 10/09/2018 - 23:59
atleast
atleast's picture

Hello Regodon - Eric

Should one add for each domain to smtp : -o $myhostname=domain.com o $myhostname=domain2.com ?

Is that all?

Kindly advise if by adding manually it would work? I would be very grateful if you could kindly confirm me. Thanks to you I was able to configure Sender dependent Transport Mapping to choose virtual servers address IP > from email settings. It worked great. I just need to be sure of above. Pl reply whenever you could.

Wed, 10/10/2018 - 11:55
regodon

@atleast this is the change i do in master.cf. Each site has a line similar to this:

100.100.100.100:smtp inet n - y - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/mydomain.com/ssl.cert -o smtpd_tls_key_file=/home/mydomain.com/ssl.key -o smtpd_tls_CAfile=/home/mydomain.com/ssl.ca

I just add -o myhostname=mydomain.com so the lines end up like this:

100.100.100.100:smtp inet n - y - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_cert_file=/home/mydomain.com/ssl.cert -o smtpd_tls_key_file=/home/mydomain.com/ssl.key -o smtpd_tls_CAfile=/home/mydomain.com/ssl.ca -o myhostname=mydomain.com

@andreychek I'm using Virtualmin GPL version. I didn't try the issue tracker because it says it's for premium users only and I'm using Virtualmin GPL. May I still create the issue?

Wed, 10/10/2018 - 20:09 (Reply to #8)
atleast
atleast's picture

Dear Regodon I am so grateful for giving me this creative solution and will test it for sure and let you know. I think for a server with few domains one can do it manually. I am so thankful as I was searching for long time how to add the cert file path on postfix. If this is working this is a really practical solution. It may help a lot of users. I will test it and revert. I am sorry for late reply as I have been under great turmoil n stress today.

Wed, 10/10/2018 - 12:21
andreychek

Yup! I completely understand. You have an interesting idea though, and that may be feasible for us to add into Virtualmin (though Jamie will know for sure). Go right ahead and create that feature request in the support tracker, no one will give you a hard time. Thanks!