# Host default domain: SSL certificate and mail-related features

**URL:** <https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684>\
**Category:** Virtualmin\
**Created:** [May 14, 2024, 4:01pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684 "2024-05-14T16:01:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nico94](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/nico94/32/68_2.png) [@Nico94](https://forum.virtualmin.com/u/Nico94)\
**Post date:** [May 14, 2024, 4:01pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/1 "2024-05-14T16:01:01Z")

</div>

| SYSTEM INFORMATION | |
| --- | --- |
| OS type and version | Debian Linux 12 |
| Webmin version | 2.111 |
| Usermin version | 2.010 |
| Virtualmin version | 7.10.0 |
| Theme version | 21.10 |
| Package updates | All installed packages are up to date |

Hi there!

I just installed a server with the new installer. Nothing to report on Debian 12, it still runs smoothly (I’m running Apache).

Still, I noticed that the installation now includes a Let’s Encrypt Certificate and that there is an Apache VirtualHost named after the server’s hostname. This is pretty cool, thanks … but it also raises some questions:

- Is the default certificate copied to all services (I used to manually create a Virtual Server and to use the “Set as Default Services Certificate button”).
- Where is it managed? Just in case there is a problem with Let’s Encrypt in the future…
- Can I still create a Virtual Server with the same name of the default VirtualHost?

---

<div class="post-metadata">

**Author:** ![Nico94](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/nico94/32/68_2.png) [@Nico94](https://forum.virtualmin.com/u/Nico94)\
**Post date:** [May 14, 2024, 10:02pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/2 "2024-05-14T22:02:55Z")

</div>

OK, found it: System Settings → Virtualmin Configuration → SSL settings → Create host default domain with Let’s Encrypt certificate

Sorry for the silly question, I never used that before.

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 14, 2024, 10:16pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/3 "2024-05-14T22:16:41Z")

</div>

> [@Nico94](#):
>
> Is the default certificate copied to all services (I used to manually create a Virtual Server and to use the “Set as Default Services Certificate button”).

Yes, it is.

> [@Nico94](#):
>
> Where is it managed? Just in case there is a problem with Let’s Encrypt in the future

Visibility for host default domain can be change in **System Settings ⇾ Virtualmin Configuration: SSL settings** page.

> [@Nico94](#):
>
> Can I still create a Virtual Server with the same name of the default VirtualHost?

No, you cannot.

> [@Nico94](#):
>
> This is pretty cool, thanks

Thanks for the positive feedback. ☺

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [May 14, 2024, 10:40pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/4 "2024-05-14T22:40:33Z")

</div>

> [@Nico94](#):
>
> Can I still create a Virtual Server with the same name of the default VirtualHost?

You should not! That should never have been a thing you were going to do, regardless of the default host domain.

It makes no sense to virtually host a name when it’s the name of the system itself. You’ll confuse Postfix (and possibly some other services, but definitely Postfix).

This is covered in the install docs: [Automated Installation | Virtualmin — Open Source Web Hosting Control Panel](https://www.virtualmin.com/docs/installation/automated/#fully-qualified-domain-name)

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 14, 2024, 10:48pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/5 "2024-05-14T22:48:39Z")

</div>

> [@Joe](#):
>
> It makes no sense to virtually host a name when it’s the name of the system itself. You’ll confuse Postfix (and possibly some other services, but definitely Postfix).

@Joe, do you mind if we completely remove the mail feature for the host default domain, making it impossible for users to enable it and potentially break things?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [May 14, 2024, 11:03pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/6 "2024-05-14T23:03:26Z")

</div>

I mean, I guess if we have to have a host default domain, then it should protect users from doing things that can’t work right. (I still don’t love the idea.)

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 14, 2024, 11:14pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/7 "2024-05-14T23:14:29Z")

</div>

Alright, I’ll send @Jamie a PR tomorrow.

---

<div class="post-metadata">

**Author:** ![Shirehosting](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/shirehosting/32/25228_2.png) [@Shirehosting](https://forum.virtualmin.com/u/Shirehosting)\
**Post date:** [May 15, 2024, 5:15am UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/8 "2024-05-15T05:15:46Z")

</div>

+1 from me…

insert fluff for this formum

---

<div class="post-metadata">

**Author:** ![shoulders](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/shoulders/32/10086_2.png) [@shoulders](https://forum.virtualmin.com/u/shoulders)\
**Post date:** [May 15, 2024, 7:11am UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/9 "2024-05-15T07:11:12Z")

</div>

> [@Ilia](#):
>
> Visibility for host default domain can be change in **System Settings ⇾ Virtualmin Configuration: SSL settings** page.
> 
> > [@Nico94](#):
> >
> > Can I still create a Virtual Server with the same name of the default VirtualHost?
> 
> No, you cannot.

But you can manually create the vitual server with your servers hostname before you use **System Settings ⇾ Virtualmin Configuration: SSL settings**

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 15, 2024, 11:34am UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/10 "2024-05-15T11:34:47Z")

</div>

> [@Shirehosting](#):
>
> +1 from me…
> 
> insert fluff for this formum

I don’t understand the comment!

> [@shoulders](#):
>
> But you can manually create the vitual server with your servers hostname before you use **System Settings ⇾ Virtualmin Configuration: SSL settings**

Well, that’s right. I will see if we can address it too.

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 15, 2024, 12:59pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/11 "2024-05-15T12:59:16Z")

</div>

Alright, this feature was implemented in the PR linked below. It turned out to be way more challenging to implement cleanly than I initially expected.

> <https://github.com/virtualmin/virtualmin-gpl/pull/810>
>
> Hey Jamie!
> 
> As discussed in \[this thread\](https://forum.virtualmin.com/t/new-i…nstaller-questions-about-the-default-ssl-certificate/126684/10?u=ilia) this PR protects users from enabling mail for a virtual server that matches hostname.

---

<div class="post-metadata">

**Author:** ![Nico94](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/nico94/32/68_2.png) [@Nico94](https://forum.virtualmin.com/u/Nico94)\
**Post date:** [May 16, 2024, 9:06am UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/12 "2024-05-16T09:06:30Z")

</div>

Thank you all for your answers!

> [@Joe](#):
>
> You should not! That should never have been a thing you were going to do, regardless of the default host domain.

I think there has been a misunderstanding here, probably due to my poor English/explanations. I was just talking about the Virtualmin’s Virtual Server wearing the system’s FQDN (like “[host1.example.com](http://host1.example.com)”). Until recently, the Install Wizard asked (at the very end of the process) if we wanted (or not) to automatically create it. Personally, I always answered “no” to that question and created it manually afterwards … and that explains why I was not familiar with the “Virtualmin Configuration → SSL settings” option. Note however that the default domain that I created thus only had 3 features activated: “Apache”, “apache SSL” and “MariaDB”. Was I really wrong to do so?

Anyway, from now on it looks like the question is not asked anymore during the Install Wizard process and it is automatically created.

> [@Joe](#):
>
> It makes no sense to virtually host a name when it’s the name of the system itself.

I’m not sure I quite understand this sentence, isn’t it the exact purpose of the “Virtualmin Configuration → SSL settings” option?

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 16, 2024, 11:40am UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/13 "2024-05-16T11:40:30Z")

</div>

> [@Nico94](#):
>
> Until recently, the Install Wizard asked (at the very end of the process) if we wanted (or not) to automatically create it. Personally, I always answered “no” to that question and created it manually afterwards

Yes, we’ve changed it to happen during the Virtualmin installation time. The goal was to pre-create an SSL certificate for the hostname and provide users with a better initial experience on the first login, avoiding errors related to self-signed SSL certificate. It might sound simple, but it’s quite complex to get everything right.

Additionally, the latest changes can prevent users from easily enabling mail-related features for a domain name that matches the hostname within certain configurations, regardless of whether the domain was created automatically during installation time or manually later.

> [@Nico94](#):
>
> > [@Joe](#):
> >
> > It makes no sense to virtually host a name when it’s the name of the system itself.
> 
> I’m not sure I quite understand this sentence

@Joe, is this what we wanted in terms of hosting a default hostname virtual domain, right? I mean, having an ability to disable mail-related features for host default domain (i.e. domain that matches the hostname) on certain systems?

I’ve been reflecting on it (again), and it may be confusing for some users why the mail for their `host10.example.com` domain has to be disabled? We can give them a million reasons, but I doubt anyone would listen, and practice has made it very clear.

I wouldn’t be surprised if some admins wanted mail work (in a straightforward way) for addresses like `dns@host10.example.com`.

Why not?

What stops us from leaving things as is, i.e. allowing mail-related features to be enabled for host default domain?

If we don’t:

1. What exactly is going to break?
2. Which exact Postfix and/or network configuration would cause mail delivery issues with host default domain (i.e. hostname placed in virtual map)?

I myself never faced any issues when having a hostname placed into `/etc/postfix/virtual` map file, i.e. the following works just fine across numerous systems:

```plaintext
root@alma9-pro:/etc# hostname

host.alma9-pro.virtualmin.dev

```

My `/etc/postfix/virtual` file has:

```plaintext
root@alma9-pro:/etc# cat /etc/postfix/virtual | grep 'host.alma9-pro.virtualmin.dev'

host.alma9-pro.virtualmin.dev host.alma9-pro.virtualmin.dev
dns@host.alma9-pro.virtualmin.dev dns\@host.alma9-pro.virtualmin.dev

```

My `main.cf` file has:

```plaintext
root@alma9-pro:/etc# cat /etc/postfix/main.cf | grep -E '^(myhostname|mydestination|resolve_dequoted_address)'

myhostname = host.alma9-pro.virtualmin.dev
mydestination = $myhostname, host.alma9-pro.virtualmin.dev, localhost.$mydomain, localhost
resolve_dequoted_address = no

```

The same configuration I have on another Ubuntu 22.04 system, which also work just fine.

With all the recent Virtualmin patches, we now have an API to control when the mail feature for the default domain (i.e., the hostname) should be allowed or disallowed. To be honest, I prefer to keep it always enabled unless it’s specifically disabled in the Virtualmin Config during installation.

So, what specific configurations should be considered risky enough to disable the mail feature for the default domain?

---

<div class="post-metadata">

**Author:** ![Nico94](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/nico94/32/68_2.png) [@Nico94](https://forum.virtualmin.com/u/Nico94)\
**Post date:** [May 16, 2024, 4:21pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/14 "2024-05-16T16:21:49Z")

</div>

Thank you @Ilia for this extensive post. I personally never use any address like [mail@host.example.com](mailto:mail@host.example.com) … but I am also very interested in knowing what could be broken in doing so.

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 16, 2024, 10:32pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/15 "2024-05-16T22:32:42Z")

</div>

> [@Nico94](#):
>
> I am also very interested in knowing what could be broken in doing so.

We can have a more in-depth discussion with Joe and @Jamie about this. It’s been an ongoing topic for decades and has confused many people.

While Joe has been incredibly patient, I worry he might lose his patience if he has to answer these questions again. He did answer them before, but in a more tech-savvy way.

My aim, though, is to compile all the ideas into a single, simple and more comprehensive post.

This is my take on it.

**Long story short:**

1. We are simply _trapped_ when it comes to having mail enabled (using virtual maps) with the host default domain (matching hostname) and keeping Postfix happy!

2. Even though the configuration examples I provided in [previous comment](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/13) will work most of the time in practice, it will always be against what the Postfix [documentation recommends](https://www.postfix.org/VIRTUAL_README.html#virtual_alias), which clearly states:

Though, it isn’t clear to me personally why Postfix developers made this configuration work almost flawlessly, yet generate so much noise and confusion.

The idea of having the hostname in `mydestination` is to make the current machine consider itself the final destination; yet, configuring the same hostname as a virtual domain without using aliases is not extreme; on the contrary, it’s straightforward. Practices prove it, as thousands of people intuitively want this functionality to work. But we are where we are.

**Summary:**

1. Can you enable mail for the default domain that matches the hostname? Potentially, yes, but it depends on the configuration. The default configuration, closest to what Virtualmin sets as default, has worked with no issues every time;
2. Will forwarding to local and remote email addresses work with such a configuration? Yes, it should;
3. Is there a way to make this same configuration work without Postfix logging a warning every time? No, there is no way to do it. The only “solution” I’ve found is to set `myhostname` to `localhost`. However, this isn’t recommended for a production mail server. Although delivery works fine and no warnings are produced (logged), it does not uniquely identify the server on the network and can be a red flag for spam filters.

All that said, I don’t think we should limit users from enabling mail for the host default domain.

P.S. The tests were run on Postfix versions 3.5.9 ↔ 3.6.4.

---

<div class="post-metadata">

**Author:** ![Jamie](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/jamie/32/8589_2.png) [@Jamie](https://forum.virtualmin.com/u/Jamie)\
**Post date:** [May 17, 2024, 3:24am UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/16 "2024-05-17T03:24:07Z")

</div>

Hmm, seems like we shouldn’t allow the default domain which matches the `myhostname` line in the Postfix config to be used for a Virtualmin domain with email then. We shouldn’t just check against the hostname though, because `myhostname` might be set to something else…

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 17, 2024, 9:50am UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/17 "2024-05-17T09:50:31Z")

</div>

> [@Jamie](#):
>
> we shouldn’t allow the default domain which matches the `myhostname` line in the Postfix config to be used for a Virtualmin domain with email then.

Sadly, it isn’t possible to do in a straightforward way, which means configuring the system as Postfix expects. This might involve using an additional name like `mail.host.example.com` or using boring and generic hostname like `ns100.example.com`, which shouldn’t be used for anything else.

Then again, we’re back to square one. What if a user wants their hostname to have a nice webpage or at least a redirect to some website? Ideally, users shouldn’t want any of this. But users did and most probably will always want it, because it’s pretty natural I’ve got to admit – here is why – if a user has 10 pretty hosts named `host1.example.com`, `host2.example.com`, etc. Each host has a service associated with an email like `dns@host2.example.com` or `webmin@host2.example.com`, and all these hosts could after all forward emails to lets say `root@mail.masterhost.example.com`.

Postfix doesn’t want us to have such a configuration, we all get it. Yet, it still delivers mail just fine in 99% of cases. This is bonkers!

That said, currently all the latest patches merged in my latest PRs do things the right way, even though I don’t find it neither intuitive nor user-friendly! I think some users will complain still.

Therefore, I wanted to discuss the possibility:

1. Of checking during Virtualmin installation if mail delivery support works on a system where the mail is enabled and the default host domain exists and matches the `myhostname` line in the Postfix config — if not supported, then we would disable it during installation time using `nocheck_forbidden_domain_features` option.

2. Update the installation documentation for Virtualmin, suggesting that if a user intend to use the Virtualmin system for mail, and using hostname for mail with virtual domains map as well, they should also pre-create an additional DNS record for mail, such as `mail.hostname`. During installation, we would check if a DNS record like `mail.hostname` exists. If it does, and it points to the same system as `hostname`, then we set the `myhostname` option in Postfix to that.

Could that be a solution?

Or just duck it and let users do their thing!? After all, you and @Joe always said this warning is as harmless as a kitten in a mitten in [here](https://archive.virtualmin.com/comment/773502#comment-773502) and [here](https://archive.virtualmin.com/comment/709819#comment-709819). 😄

Though seriously, for the moment, I’m gravitating towards **2.** option!

What are your thoughts?

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [May 17, 2024, 2:55pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/18 "2024-05-17T14:55:29Z")

</div>

When I said it was harmless, I also said, “Don’t do that.” And, I still say “Don’t do that.”

If you just don’t do that, you won’t have this problem. Name your server literally anything else. The world is wide and possibilities are endless, there is no reason to name your server the same thing as virtually hosted domains. None.

It isn’t a problem unless you make it a problem. I’d rather we do something to discourage people from making it a problem, rather than working around the problem.

Every possible reason people think they have for naming their server the same as something virtually hosted on the server is a misunderstanding. (Most often something misunderstood about PTRs and spam filters, but there are others.)

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [May 17, 2024, 3:29pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/19 "2024-05-17T15:29:02Z")

</div>

> [@Joe](#):
>
> The world is wide and possibilities are endless, there is no reason to name your server the same thing as virtually hosted domains.

It is true. There isn’t for you, and there isn’t for me. Though people still do, and most probably will.

This discussion I brought up is more about what _we_ can do to save users from falling into this trap.

We could keep saying “don’t do it,” or we can try to find a _solution_ that makes it harder for users to misconfigure things while still allowing them to do what they think is right, even if it’s based on a misunderstanding.

---

<div class="post-metadata">

**Author:** ![angstrom](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/angstrom/32/8037_2.png) [@angstrom](https://forum.virtualmin.com/u/angstrom)\
**Post date:** [May 17, 2024, 7:33pm UTC](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684/20 "2024-05-17T19:33:14Z")

</div>

If I may jump in here quickly, may I ask whether the following advice – stated as simply as possible – is sensible/recommended?

- For the main Virtualmin system, choose a FQDN, for example: `subdomain1.domain1.net`
- For a virtual server that you create (using the main Virtualmin system), choose a domain name that _differs_ from `domain1.net`, for example: `domain2.net`
- For best results, keep to this naming convention

[Next page](https://forum.virtualmin.com/t/host-default-domain-ssl-certificate-and-mail-related-features/126684.md?page=2)
