Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom DNS API for txt record results in "No value for the record provided" #121

Open
ghost opened this issue Mar 25, 2023 · 6 comments
Open
Labels
Documentation Everything doc-related

Comments

@ghost
Copy link

ghost commented Mar 25, 2023

The context for this is im trying to setup acme on pfsense to create a wildcard cert using the DNS-MailinaBox method, but its failing. But that is just the context of where im hitting this issue i understand that is external to power-mailinabox

However, in the Custom DNS panel, at the bottom it shows an example of how this should work, where a command such as curl -X POST --user "username@mydomain.tld:my awesome passphrase" -d "some text here" https://box.mydomain.tld/admin/dns/custom/_subdomain.mydomain.tld/txt should result in the text record created. But instead i get the error message No value for the record provided.

This is the same error message i get from acme when i try to use the staging account to create a test wildcard certificate. Again i know that part is out of scope but it shows im getting the same error with two different methods. The log shows it hitting the same endpoint.

[Sat Mar 25 23:33:46 AEST 2023] Adding txt value: somelongstring for domain:  _acme-challenge.mydomain.tld
[Sat Mar 25 23:33:46 AEST 2023] Using miab challange add
[Sat Mar 25 23:33:46 AEST 2023] MIAB_Username='username@mydomain.tld'
[Sat Mar 25 23:33:46 AEST 2023] MIAB_Password='my awesome passphrase'
[Sat Mar 25 23:33:46 AEST 2023] MIAB_Server='box.mydomain.tld'
[Sat Mar 25 23:33:46 AEST 2023] _api_path='zones'
[Sat Mar 25 23:33:46 AEST 2023] _url='https://box.mydomain.tld/admin/dns/zones'
[Sat Mar 25 23:33:46 AEST 2023] _credentails='somelongstring'
[Sat Mar 25 23:33:46 AEST 2023] _httpmethod='GET'
[Sat Mar 25 23:33:46 AEST 2023] GET
[Sat Mar 25 23:33:46 AEST 2023] url='https://box.pavocracy.dev/admin/dns/zones'
[Sat Mar 25 23:33:47 AEST 2023] ret='0'
[Sat Mar 25 23:33:47 AEST 2023] response='["mydomain.tld"]'
[Sat Mar 25 23:33:47 AEST 2023] _test_domain='mydomain.tld'
[Sat Mar 25 23:33:47 AEST 2023] _sub_domain='_acme-challenge'
[Sat Mar 25 23:33:47 AEST 2023] _api_path='custom/_acme-challenge.mydomain.tld/txt'
[Sat Mar 25 23:33:47 AEST 2023] _url='https://box.mydomain.tld/admin/dns/custom/_acme-challenge.mydomain.tld/txt'
[Sat Mar 25 23:33:47 AEST 2023] _credentails='somelongstring'
[Sat Mar 25 23:33:47 AEST 2023] _httpmethod='POST'
[Sat Mar 25 23:33:47 AEST 2023] POST
[Sat Mar 25 23:33:47 AEST 2023] _post_url='https://box.mydomain.tld/admin/dns/custom/_acme-challenge.mydomain.tld/txt'
[Sat Mar 25 23:33:47 AEST 2023] body='somelongstring'
[Sat Mar 25 23:33:48 AEST 2023] _ret='0'
[Sat Mar 25 23:33:48 AEST 2023] response='No value for the record provided.'

This is a brand new debian 11 VPS and is otherwise working where i can send and receive emails and access the mail and admin panels, and manually create DNS entrys. FWIW my domain is with godaddy and i changed the default nameservers to be ns1.box.mydomain.tld and ns2.box.mydomain.tld that both resolve to the public IP address of my VPS, so all the dns entries for my domain should be coming from the maib server.

Any help with this issue would be greatly appreciated.

@ghost
Copy link
Author

ghost commented Mar 26, 2023

Do i need to setup an alias for this subdomain for it to work? I may just be confused how these custom domain works with miab. What im trying to do is use custom domains to forward to an nginx server i have with other services running, since i gave up that ability at a DNS level because i switched my name servers to be using the dns on this box.

Do i need an alias for every subdomain i want to setup with miab?

@ghost
Copy link
Author

ghost commented Mar 27, 2023

https://discourse.mailinabox.email/t/solved-but-a-bug-miab-dns-added-new-custom-dns-did-not-work/5550

Is this related at all? Is this an actual bug hanging around? What is the correct way to setup custom DNS entries on a MIAB server? As i said all i want to do is create a sub domain using an CNAME record that points to my other domains (eg homelab.otherdomain.tld) and a txt record for the acme challenges to work to get certificates from lets encrypt for that homelab domain from external to the MIAB.

@ddavness ddavness added the Documentation Everything doc-related label Apr 27, 2023
@ddavness
Copy link
Owner

ddavness commented Apr 27, 2023

Hello!

I don't think this is a bug, rather than a feature I've introduced a few releases ago (#28) made the documentation incorrect 😅

Since curl submits POST data as a x-www-form-urlencoded you'll want to prepend value= before the actual value you want (this is valid for all record types!)

So for your case:

curl -X POST --user "username@mydomain.tld:my awesome passphrase" -d "value=some text here" https://box.mydomain.tld/admin/dns/custom/_subdomain.mydomain.tld/txt

You can add a TTL to the record (optional) by appending &ttl=<seconds>. Example:

curl -X POST --user "username@mydomain.tld:my awesome passphrase" -d "value=some text here&ttl=3600" https://box.mydomain.tld/admin/dns/custom/_subdomain.mydomain.tld/txt

@ghost
Copy link
Author

ghost commented Apr 27, 2023

Thanks for the clarification. Would be awesome to get the docs updated at some stage. But thanks for posting the correct method to solve my issues :)

@lifeboy
Copy link

lifeboy commented Aug 19, 2024

@ddavness, can we update the documentation to reflect this please?

@lifeboy
Copy link

lifeboy commented Oct 13, 2024

Also, would you mind clarifying for me, @ddavness, please? It looks like the API to add a TXT record in Power-Mailinabox now differs from that for Mailinabox? I have updated the acme.sh project's dns_miab.sh file to reflect this change, but now it seems that MIAB users are getting an error.

If this is indeed only a change for P-MIAB, then I will have to create a separate dns update script for Power-Mailinabox in acme.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Everything doc-related
Projects
None yet
Development

No branches or pull requests

2 participants