Postfix connected on right IP address comes back with wrong server name

SYSTEM INFORMATION
OS type and version Ubuntu Linux 24.04.5
Virtualmin version 8.3.0 GPL
Webmin version 2.670
Usermin version 2.570
Authentic theme version 26.70
Kernel and CPU Linux 6.8.0-139-generic on x86_64
Processor information 12th Gen Intel(R) Core™ i5-12500, 12 cores

Since my last posts, I’m still having some weird issues.
Everything is working, not a real problem, but…

For some reason my postfix comes back with the first server name, and not the domain name when accessing it.

For example:
And I hope this makes sense.

  • Ip addresses and names changed for privacy perposes.
Transcript: Connecting to 192.168.171.222
Transcript:
Transcript: 220 linux2.my.firstdomain ESMTP Postfix (Ubuntu) [240 ms]
Transcript: EHLO keeper-us-east-1d.mxtoolbox.com
Transcript: 250-linux2.my.firstdomain
Transcript: 250-PIPELINING
Transcript: 250-SIZE 10240000
Transcript: 250-VRFY
Transcript: 250-ETRN
Transcript: 250-STARTTLS
Transcript: 250-AUTH PLAIN LOGIN
Transcript: 250-AUTH=PLAIN LOGIN
Transcript: 250-ENHANCEDSTATUSCODES
Transcript: 250-8BITMIME
Transcript: 250-DSN
Transcript: 250-SMTPUTF8
Transcript: 250 CHUNKING [223 ms]
Transcript: MAIL FROM:<supertool@mxtoolboxsmtpdiag.com>
Transcript: 250 2.1.0 Ok [226 ms]
Transcript: RCPT TO:<test@mxtoolboxsmtpdiag.com>
Transcript: 454 4.7.1 <test@mxtoolboxsmtpdiag.com>: Relay access denied [224 ms]
Transcript:
Transcript:
Transcript: - LookupServer [smtp:mail.my.correctdomain] 1522ms
Transcript:

192.168.171.222 = the correct IP addres for my.correctdomain
my.firstdomain = the main server domain (IP 192.168.171.220)
my.correctdomain = the domain it should be

When sending mail it comes withe a certificate problem because it also comes back with the linux2.my.firstdomain certificate.

Even the domains hosted on the 129.168.171.221 Address comes back with this server.

The main server (first address; linux2.my.firstdomain) is 129.168.171.220.

I hope this make sese to anyone, because It doesn’t to me -lol-

Again, everything seems to be working as it supposed to do,
but some things aren’t working smoothly in the backend.

if more information is needed, let me know.
Please and thank you.

it usually comes back as hostname.

postfix should be set to use main cert of the domain with that hostname.

in my example:

Network Tools: DNS,IP,Email

Just to add to what lawk said — the 220 banner showing the main hostname on every IP is actually normal Postfix behavior. The banner comes from smtpd_banner, which defaults to $myhostname, so it doesn’t change based on which IP the client connected to. You can confirm with postconf smtpd_banner myhostname.

The certificate part is the real issue for you. By default Postfix serves one certificate for all connections (whatever smtpd_tls_cert_file points at). To serve a different cert per domain you need SNI configured (tls_server_sni_maps). A quick way to see what’s actually being served on that IP:

openssl s_client -connect 192.168.171.222:25 -starttls smtp -servername my.correctdomain

and check the CN/SAN in the output.

In Virtualmin, open the virtual server for my.correctdomain and look under Server Configuration → Manage SSL Certificate — there’s a service certificates section where you can assign that domain’s cert to Postfix. That should get the right cert served without touching the banner.

this is also a fanstastic test:

Hi Everyone, thanks for the replies.

I’ve been working so didn’t had time to reply on the spot.
But I read all the replies.

@lawk:

I have the first two giving me a headache -lol-

Status Warning SMTP Valid Hostname || Reverse DNS is not a valid Hostname

Status Warning SMTP Banner Check || Reverse DNS does not match SMTP Banner

This looks like a reverse DNS and / or Certificate

I do have a reverse DNS enables but the address is the my.correctdomain and the postfix has a mail.my.correctdomain

Should I lose that so that everything is just like my.correctdomain to fix this??

@kitaabnagri_vmin
Thanks you for the elaborate answer.

It does makes sense that this is the default behavior.
I haver to look into the certificate issue, it’s not a big problem, but something that needs to be addressed in my opinion.
standard is indeed the first server name, linux2… that is bering referred to.

And for the next:

I can’t find the route you posted

Server Configuration → Manage SSL Certificate —

I have a

manage virtual server - Setup SSL Certificate

Where I can set

Default Service Certificate

but that is to

Use this SSL certificate as the default in Webmin, Usermin, Dovecot, Postfix, ProFTPD, MariaDB and BIND

But won’t I lose the certificate I have for Webmin/Virtualmin on the linux2.my.firstdomain domain if I enable that?
That might be giving issues connecting to Webmin/Virtualmin on linux2.my.firstdomain:10000.

Yes It is, thank you for pointing that out.

Tried it and it seem to work, Still need to fix some quirks .
I got a 6 out of 10, so not bad, gray listing works very nice.
Mostly IPv6 isn’t working, I know that I don’t have IPv6 on this Subnet, it’s just IP4.

–

Again, thank all you for the replies.
It’s mostly that I expected things to work on IP basses, now realizing my assumptions were wrong.
For what I’ve learned it’s on hostname base and the first you named your server.
So that’s a thing learned.

Now I’m just wondering, maybe I should change the mail server in DNS to the linux2.my.firstdomain ??
(using a CNAME?)

that might solve some issues, wouldn’t it?
just thinking out loud here.

Another update:

I think I got it now, changed the mail server to linux2.my.firstdomain and this works perfectly.

I used the MX records to point to linux2.my.firstdomain.
and used a CNAME for the mail.my.othersdomains just to be sure.
and this seems to do the trick.

I have less issues now;
The certificate for postfix is Okay.
Reverse DNS name for it is also Okay.
(linux2.my.firstdomain)

Still have to solve the DMARC issue and BIMI , but that is for another day.

Thanks for your valued input, It did pointed me in the right direction.