go-acme / lego

Let's Encrypt/ACME client and library written in Go
https://go-acme.github.io/lego/
MIT License
7.96k stars 1.02k forks source link

Wrong host record in CloudXNS #619

Closed PeterPanZH closed 6 years ago

PeterPanZH commented 6 years ago

When I use Caddy as an HTTP server in DNS challenge mode, it cannot get certificate of my domain hosted by CloudXNS.

It seems that there is something wrong with record name generated by Lego. The host record is set to _acme-challenge.example.com.

qq20180816-175531 2x

But CloudXNS will resolve it to _acme-challenge.example.com.example.com.

qq20180816-174143 2x

According to the document of CloudXNS (Chinese version only, sad...), the key host SHOULD NOT contain the domain again. For example _acme-challenge means _acme-challenge.example.com and _acme-challenge.foo means _acme-challenge.foo.example.com.

Since I don't know GO, I cannot bring a PR. But I think the problem is here: https://github.com/xenolf/lego/blob/master/providers/dns/cloudxns/cloudxns.go#L139

Hoping you can fix it. Thanks a lot.

ldez commented 6 years ago

@PeterPanZH Hello, thanks for reporting :+1:

I fixed the bug, you see the tests related to your bug here

domain host
foo.bar.com _acme-challenge.foo
bar.com _acme-challenge