Hello Hestia community,
I noticed the following in a couple of Hestia installations, and I would like your thoughts on this. But first some info:
HestiaCP Version: 1.0.6, release
OS & Version: Ubuntu 18.04.3 LTS
Installed Software: apache+nginx, multi-php, bind9, exim4, MariaDB
Steps to replicate the issue
- Create a user via Web-UI and login that user (through admin)
- Click Web > Add Web Domain
- Type in the domain name (e.g. xxx.yyy) > Either Select or not select the check box to create DNS zone (it doesn’t matter, since the outcome is the same in both cases) > Save
- Click Back > Click on domain
The actual Issue
By default 2 Aliases were created:
I can understand the first one, but what about the second alias? I guess it is created as another way to access the site, instead of the domain name (when for example we want to be able to access a new site that is being developed without using the domain name).
If that was the case, a DNS record should have been created in order to resolve xxx-yyy.[Server-FQDN]. But this is not bullet-proof, because we can not tell for sure that the DNS Zone of the Server’s FQDN is on the same server, so we could add that record.
I think that alias should be optional, because it is causing problems when trying to get a Let’s Encrypt Certificate. The user/admin needs to delete that alias before they can get a Let’s Encrypt Certificate for the domain.
Hmm that’s weird, I cant reproduce this issue on our system. There should be only one alias, and also only if the domain isnt a subdomain: https://github.com/hestiacp/hestiacp/blob/edefae98b3480df23fba211f05becb4c9a5ad809/web/js/pages/add_web.js#L175-L182
You can click on avanced, to preview or modify the aliases. Can you do that, followed by some domain names to check what you get? As soon as you jump out of the domain name field, the js above will create the alias values.
Do you do the steps logged in over admin or directly as a user?
Thank you @ScIT for the follow-up on this! I think I have found the reason although I can not understand the logic. But first lets set the stage…
I setup a new VPS, to make a side-by-side comparison with the problematic VPS. Lets call them VPS-PR the VPS with the PRoblem and VPS-OK the freshly installed VPS which is behaving as expected.
I understand that every Web domain is created by the bash command v-add-web-domain. So I had a closer look at line 128 of v-add-web-domain which lead me to line 43 of ip.sh, which in turn lead me to have a look inside /usr/local/hestia/data/ips/[IP HERE].
In there I found the difference in the two VPSes and then it hit me! Some time ago, while trying to solve the problem I described here, I set the option Assigned Domain (Optional) (Web UI > Server > Network > Edit IP) to the FQDN of the VPS-PR.
It seems that whatever is set in that box, will cause the creation of extra Domain Alias, when creating a domain.
For example, if the Assigned Domain (Optional) is set to TEST, then every new Web Domain that is created (e.g. example.com), is going to have an alias of [Web-Domain].TEST (e.g. example-com.TEST.)
The VPS-OK, didn’t have that option set. So every Web Domain I created, was fine. When I set the option Assigned Domain (Optional) in VPS-OK, then the same problem appeared. Now I can reproduce the problem 100% of the times and I believe you will be able too.
When I cleared the box Assigned Domain (Optional) in the VPS-PR, then new Web Domains are created without any extra alias. Which leads us to the question: What is the purpose of Assigned Domain (Optional) setting and when (if ever) should anyone set something in there?
I suppose we can mark this thread as solved, unless someone wants to shed some more light in this…