This should work fine. According to the docs: “When applying the settings, the settings within the most-specific filters override the less-specific filter’s settings, so the order of the filters in config file doesn’t matter.” (Dovecot Config File Syntax — Dovecot documentation)
That previous comment was about Dovecot. Postfix is a different subject, but I guess closely related enough.
A quick glance at the Postfix docs doesn’t tell me how it behaves in this case. But, I’ll repeat the question: Are you actually seeing behavior that is wrong? I’ll need to know what that wrong behavior is, and the exact errors or relevant log entries.
About a year ago, I tried to add a Virtual Host for dev.cleintdomain1.com to a server which had a Virtual Server for clientdomain1.com. It created the Virtual Host but it seems I was unable to install Wordpress or something. It’s been too long to remember the details. I do remember that when I deleted the dev Virtual Server, it left behind the ssl entries in Dovecot. I’ve seen this on more than one system. Oddly the deletion completed and all was good, but maybe days later, restarting Dovecot failed. I had to edit the conf file and removed the dev.clientdomain1.com entries. Dovecot then started as expected.
Joe, I apologize for not being a good writer and thank you for hanging with me. I’m stuck in the bad corner of the pig sty… very unpleasant and likely more terse than I should be.
I can retest what I did in the past and let you know, but at the moment all of my systems are live, most still have hostname.ew3d.com Virtual Servers. I have a lot of clean up to do. If I can get to the bottom of “best practice” and make to corrections, that would be fantastic. I don’t wish to do much until I have dealt with hostnames and also with the best way to handle my subdomains in Virtualmin. I thought I was there, but you questioned what I thought was the best resolve.
OK, so that would be a bug. Not something you should try to workaround or assume means things can’t work. We would need to know how to reproduce it to fix it, I’ve not seen it.
You don’t have to do anything if things are working the way you want. If you aren’t trying to host mail in Virtualmin for a domain that matches the name of your server, just leave it alone. We’re just trying to make Virtualmin more robust to simple mistakes, it isn’t the law.
It’s not secret or complicated:
Don’t name your server the same as something you’ll be hosting mail for in Virtualmin. That’s it. Anything else you think I’m saying, I definitely am not.
The warning Virtualmin now has is to try to protect people from making that very common mistake. That’s all. You don’t need to do anything with the system hostname. You never need to talk to it. Forget about it.
Here is what I want you to know about domains and subdomains: They are just names!
They don’t have any meaning to Virtualmin or anything else except the DNS system (where the only relation is possibly delegation records if giving them their own zone or putting them into the same zone). virtualmin.com and sub.virtualmin.com are two independent things. They are not related if you don’t make them related. If you are the only administrator on your server: Make domain.tld a Virtual Server. Make sub.domain.tld a Virtual Server. You’re done. There is nothing else to know. Don’t make it complicated.
I just to try to understand your setup. But if all these subdomain are here to access the right admin panel.
Are you developer and using your own app (to manage this) or do you manage all of this from Virtualmin.
Because personally, and to help beginner to follow, you can simply record every single mail in MariaDB Database and then develop your own app (In PHP). This is, according to me, the best practice.
You talked about postfix so I guess you manage everything from Virtualmin. From here, as Joe said, several virtual server shall be good. And I suppose you access them through subdomain redirection (No ?).
For SSL certificate only the DNS configuration will allow you to get it (Server configuration, as already said, is not relevant concerning SSL certificate,).
Sorry for this post, it might not help a lot, but I was not sure to understand.
I have successfully created Virtual Servers for the following sub-domains. mail3.ew3d.com, mail4.ew3d.com and mail5.ew3d.com. Each succeeded and each was successful in obtaining a LetsEncrypt certificate. I believe this is the best practice to prevent confusion in Dovecot and Postfix.
After a week, I have no reports from any clients having any issues.
I did create additional sub-domains to use for logins to replace the hostnames for logging in to the individual systems. I know this is not needed, but I do like to keep all of my systems in tabs on my private workstation. This was so I can immediately see if there are any updates on any of these systems without any confusion about which domain is on which physical system.
There is a lot of misinformation out there stating you must have a cert for the hostname. As Joe has stated (over and over), I can verify that it is not needed.