# Incorrect DNS for DKIM if using subdomains

**URL:** <https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664>\
**Category:** DNS\
**Created:** [October 28, 2023, 10:54am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664 "2023-10-28T10:54:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 10:54am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/1 "2023-10-28T10:54:57Z")

</div>

Lets say, we are using subdomain [srv1.XXX.ru](http://srv1.XXX.ru) for the mail:

 ![Снимок экрана 2023-10-28 135050](https://forum.hestiacp.com/uploads/default/original/2X/6/632c77dfe07ae06d13832c7dc3243c9c3cb79622.png)

The DKIM record for [srv1.XXX.ru](http://srv1.XXX.ru) should be `mail._domainkey.srv1`, but it is `mail._domainkey` in HestiaCP:

 ![Снимок экрана 2023-10-28 135130](https://forum.hestiacp.com/uploads/default/original/2X/8/87af529c7ecd1dad009fddfe22254fb0298fe700.png)

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [October 28, 2023, 10:57am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/2 "2023-10-28T10:57:45Z")

</div>

Please create an issue on Github…

---

<div class="post-metadata">

**Author:** ![sahsanu](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/sahsanu/32/9318_2.png) [@sahsanu](https://forum.hestiacp.com/u/sahsanu)\
**Post date:** [October 28, 2023, 11:05am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/3 "2023-10-28T11:05:54Z")

</div>

I don’t think that is an error, if you use `subdomain.domain.tld` Hestia should assume (as it does currently) that your zone is `subdomain.domain.tld` instead of `domain.tld` In my opinion that should not change.

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 11:08am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/4 "2023-10-28T11:08:35Z")

</div>

If you create mail for a subdomain and a domain at the same time, you get two DKIM records with the same ID mail.\_domainkey

---

<div class="post-metadata">

**Author:** ![sahsanu](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/sahsanu/32/9318_2.png) [@sahsanu](https://forum.hestiacp.com/u/sahsanu)\
**Post date:** [October 28, 2023, 11:10am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/5 "2023-10-28T11:10:06Z")

</div>

Are you talking about records added into DNS system included in Hestia?

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 11:10am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/6 "2023-10-28T11:10:59Z")

</div>

Yes, it is DNS records in Hestia.

Google recomendations for DKIM for subdomains: [Add a DKIM key for a subdomain - Google Workspace Admin Help](https://support.google.com/a/answer/177063?hl=en)

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 11:11am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/7 "2023-10-28T11:11:20Z")

</div>

Github bug is here: [[Bug] Incorrect DNS for DKIM if using subdomain · Issue #4113 · hestiacp/hestiacp (github.com)](https://github.com/hestiacp/hestiacp/issues/4113)

---

<div class="post-metadata">

**Author:** ![sahsanu](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/sahsanu/32/9318_2.png) [@sahsanu](https://forum.hestiacp.com/u/sahsanu)\
**Post date:** [October 28, 2023, 11:17am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/8 "2023-10-28T11:17:15Z")

</div>

But you are assuming that `subdomain.domain.tld` is not an independent zone and it is part of `domain.tld` and it is not (or at least couldn’t be).

So, in your screenshot, `mail._domainkey` will be translated to `mail._domainkey.subdomain.domain.tld` but if you add `mail._domainkey.subdomain` it will translate to `mail._domainkey.subdomain.subdomain.domain.tld` which is wrong.

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 11:22am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/9 "2023-10-28T11:22:52Z")

</div>

In my case `subdomain.domain.tld` and `domain.tld` are two independent zones and belongs to different hestia users. All other DNS records created in right way with using subdomain, but not DKIM record.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [October 28, 2023, 11:27am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/10 "2023-10-28T11:27:27Z")

</div>

It depends if you add it to the [sub.domain.com](http://sub.domain.com) zone of [domain.com](http://domain.com) zone

Assuming the the first it should be correct…

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 11:33am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/11 "2023-10-28T11:33:01Z")

</div>

Guys, maybe I’m wrong and Hestia is creating the records correctly, but I see in the screenshot above that the DKM for subdomains doesn’t match the recommendations. Or the record is not created at all for subdomain.

Here’s another link: [domain name system - Setting up SPF and DKIM records of a subdomain - Server Fault](https://serverfault.com/questions/851215/setting-up-spf-and-dkim-records-of-a-subdomain)

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [October 28, 2023, 11:37am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/12 "2023-10-28T11:37:07Z")

</div>

There are all talking to add them to the [domain.com](http://domain.com) zone in that case it is correct you should use:

mail.\_domainkey.subdomain

But when you add tot he

[subdomain.domain.com](http://subdomain.domain.com) zone it should be:

`mail._domainkey`

Assuming we don’t know how a user is going to use the DNS how the hell are we supposed to know what we should display…

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 11:42am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/13 "2023-10-28T11:42:31Z")

</div>

I think that if `subdomain.domain.tld` is created as a mail domain in Hestia, the DKIM DNS should be `mail._domainkey.subdomain` anyway

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [October 28, 2023, 11:53am UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/14 "2023-10-28T11:53:11Z")

</div>

It depends if you use [subdomain.domain.com](http://subdomain.domain.com) or [domain.com](http://domain.com) as zone…

I think it is hard to know the difference for us… What a user is going to use …

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 12:03pm UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/15 "2023-10-28T12:03:11Z")

</div>

If, for example, we create two mail domains in the Hestia interface:  
`domain.tld`  
`subdomain.domain.tld`

And **switch off** DKIM support on `domain.tld` and **switch on** DKIM support on `subdomain.domain.tld`?

Then, with only one DNS record `mail._domainkey`, mail will probably stop coming.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [October 28, 2023, 12:07pm UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/16 "2023-10-28T12:07:35Z")

</div>

Did you have created a DNS zone for subdomain.domain.tld

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 12:13pm UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/17 "2023-10-28T12:13:31Z")

</div>

I just wanted to use my own server with the Hestia panel as an ns server and thought Hestia creates the correct DNS records automatically.

If I create records on a 3rd party DNS provider manually, then of course I create DNS zones for each domain/subdomain.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [October 28, 2023, 12:15pm UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/18 "2023-10-28T12:15:52Z")

</div>

It you add the DNS zone for [sub.domain.com](http://sub.domain.com) the DNS creates them correctly…

---

<div class="post-metadata">

**Author:** ![ram108](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/ram108/32/64_2.png) [@ram108](https://forum.hestiacp.com/u/ram108)\
**Post date:** [October 28, 2023, 12:24pm UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/19 "2023-10-28T12:24:43Z")

</div>

I didn’t create anything manually on the server, just used the panel to create a web server and a mail server independent for the domain and subdomain.

By now we create all DNS records with the domain name registrar, but we have been tasked to use our own NS servers with Hestia.

This is where I saw that visually the DKIM records in Hestia are not created correctly.

Then again, maybe it’s all visual and the records themselves are correct. Sorry for that.

---

<div class="post-metadata">

**Author:** ![eris](https://forum.hestiacp.com/user_avatar/forum.hestiacp.com/eris/32/1241_2.png) [@eris](https://forum.hestiacp.com/u/eris)\
**Post date:** [October 28, 2023, 12:44pm UTC](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664/20 "2023-10-28T12:44:35Z")

</div>

Then setup the name servers first…

DNS records under the mail tab are only for info… Not used for DNS …

[Next page](https://forum.hestiacp.com/t/incorrect-dns-for-dkim-if-using-subdomains/11664.md?page=2)
