Closed ldez closed 3 months ago
It was not an easy job because only one page is in English and the response examples are not really JSON valid.
It seems it's not recognizing my domain:
SHELLRENT_USERNAME=nnn@nnn.yy \
SHELLRENT_TOKEN=abcdefg \
./dist/lego -m xxx@xxx.yy --dns shellrent -d *.mydomain.tld -d mydomain.tld -s https://acme-staging-v02.api.letsencrypt.org/directory run
No key found for account xxx@xxx.yy. Generating a P256 key.
Saved key to /my/folder
unrecognized DNS provider: shellrent
steps i did:
git clone git@github.com:go-acme/lego.git
cd lego
make build
rm -rf .lego
SHELLRENT_USERNAME=xxxx \
SHELLRENT_TOKEN=yyyy \
./dist/lego -m your@email.com --dns shellrent -d *.example.com -d example.com -s https://acme-staging-v02.api.letsencrypt.org/directory run
You should checkout my PR:
git clone git@github.com:ldez/lego.git
cd lego
git switch feat/shellrent
make build
Thanks for the head up.
dns request is passing thorugh now, I receive a missing domain zone error (although I have it up and running):
$ SHELLRENT_USERNAME="xxxxx" \
SHELLRENT_TOKEN="yyyyy" \
./dist/lego -m mail@domain.tld --dns shellrent -d *.myshellrentdomain.tld -d myshellrentdomain.tld -s https://acme-staging-v02.api.letsencrypt.org/directory run
2024/03/06 15:43:01 [INFO] [*.myshellrentdomain.tld, myshellrentdomain.tld] acme: Obtaining bundled SAN certificate
2024/03/06 15:43:02 [INFO] [*.myshellrentdomain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11540662944
2024/03/06 15:43:02 [INFO] [myshellrentdomain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11540662954
2024/03/06 15:43:02 [INFO] [*.myshellrentdomain.tld] acme: use dns-01 solver
2024/03/06 15:43:02 [INFO] [myshellrentdomain.tld] acme: Could not find solver for: tls-alpn-01
2024/03/06 15:43:02 [INFO] [myshellrentdomain.tld] acme: Could not find solver for: http-01
2024/03/06 15:43:02 [INFO] [myshellrentdomain.tld] acme: use dns-01 solver
2024/03/06 15:43:02 [INFO] [*.myshellrentdomain.tld] acme: Preparing to solve DNS-01
2024/03/06 15:43:02 [INFO] [myshellrentdomain.tld] acme: Preparing to solve DNS-01
2024/03/06 15:43:02 [INFO] [*.myshellrentdomain.tld] acme: Cleaning DNS-01 challenge
2024/03/06 15:43:02 [WARN] [*.myshellrentdomain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.myshellrentdomain.tld.' 'I2mdfswIwEjZOhKhkS1b_jLZjqt6AdN_02A_vmn-C3s'
2024/03/06 15:43:02 [INFO] [myshellrentdomain.tld] acme: Cleaning DNS-01 challenge
2024/03/06 15:43:02 [WARN] [myshellrentdomain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.myshellrentdomain.tld.' 'FflGJUvk_so2f20Z274j5ZGdv5JVcYPsLFfmNzYl_1U'
2024/03/06 15:43:02 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11540662944
2024/03/06 15:43:03 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11540662954
2024/03/06 15:43:03 Could not obtain certificates:
error: one or more domains had a problem:
[*.myshellrentdomain.tld] [*.myshellrentdomain.tld] acme: error presenting token: shellrent: could not find zone for domain "myshellrentdomain.tld": list services: unable to unmarshal response: [status code: 200] body: {"error":0,"title":"","message":"","data":["155539","208481"]} error: json: cannot unmarshal string into Go struct field Response[[]int].data of type int
[myshellrentdomain.tld] [myshellrentdomain.tld] acme: error presenting token: shellrent: could not find zone for domain "myshellrentdomain.tld": list services: unable to unmarshal response: [status code: 200] body: {"error":0,"title":"","message":"","data":["155539","208481"]} error: json: cannot unmarshal string into Go struct field Response[[]int].data of type int
The problem is related to API response:
list services: unable to unmarshal response: [status code: 200] body: {"error":0,"title":"","message":"","data":["155539","208481"]} error: json: cannot unmarshal string into Go struct field Response[[]int].data of type int
The doc is not accurate. The IDs are string, not int.
I fixed the problem, can you try again? Don't forget to update your local clone.
still receiving the same error:
[*.domain.tld] [*.domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": zone not found
[domain.tld] [domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": zone not found
Let me know if I can debug a bit more
EDIT: just to confirm I deleted and re-git cloned the repo changing branch to feat/shellrent
It's not exactly the same error:
Before:
[domain.tld] [domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": list services: unable to unmarshal response: [status code: 200] body: {"error":0,"title":"","message":"","data":["155539","208481"]} error: json: cannot unmarshal string into Go struct field Response[[]int].data of type int
After:
[domain.tld] [domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": zone not found
I added debug logs, can you try again?
here is the full new output:
2024/03/07 14:25:26 [INFO] [*.domain.tld, domain.tld] acme: Obtaining bundled SAN certificate
2024/03/07 14:25:27 [INFO] [*.domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11557764184
2024/03/07 14:25:27 [INFO] [domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11557764194
2024/03/07 14:25:27 [INFO] [*.domain.tld] acme: use dns-01 solver
2024/03/07 14:25:27 [INFO] [domain.tld] acme: Could not find solver for: tls-alpn-01
2024/03/07 14:25:27 [INFO] [domain.tld] acme: Could not find solver for: http-01
2024/03/07 14:25:27 [INFO] [domain.tld] acme: use dns-01 solver
2024/03/07 14:25:27 [INFO] [*.domain.tld] acme: Preparing to solve DNS-01
services [155539 208481]
(_acme-challenge.domain.tld) services details: &internal.ServiceDetails{ID:155539, Name:"Dominio: domainnumber2.tld", DomainID:89531}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:89531, DomainName:"domainnumber2.tld", DomainNameASCII:"domainnumber2.tld"}
(net) services details: &internal.ServiceDetails{ID:208481, Name:"Dominio: domain.tld", DomainID:103527}
(net) domain details: &internal.DomainDetails{ID:103527, DomainName:"domain.tld", DomainNameASCII:"domain.tld"}
2024/03/07 14:25:28 [INFO] [domain.tld] acme: Preparing to solve DNS-01
services [155539 208481]
(_acme-challenge.domain.tld) services details: &internal.ServiceDetails{ID:155539, Name:"Dominio: domainnumber2.tld", DomainID:89531}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:89531, DomainName:"domainnumber2.tld", DomainNameASCII:"domainnumber2.tld"}
(net) services details: &internal.ServiceDetails{ID:208481, Name:"Dominio: domain.tld", DomainID:103527}
(net) domain details: &internal.DomainDetails{ID:103527, DomainName:"domain.tld", DomainNameASCII:"domain.tld"}
2024/03/07 14:25:29 [INFO] [*.domain.tld] acme: Cleaning DNS-01 challenge
2024/03/07 14:25:29 [WARN] [*.domain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.domain.tld.' '37m98IbuTDGas1WiFKB54UMy1en82nf_ue0ojRftgdo'
2024/03/07 14:25:29 [INFO] [domain.tld] acme: Cleaning DNS-01 challenge
2024/03/07 14:25:29 [WARN] [domain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.domain.tld.' 'iFXyEr_oDaZgl-mG0ZFXaNumvMk-vGQ_OkJxhUEOlGA'
2024/03/07 14:25:29 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11557764184
2024/03/07 14:25:29 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11557764194
2024/03/07 14:25:29 Could not obtain certificates:
error: one or more domains had a problem:https://github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_shellrent
[*.domain.tld] [*.domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": zone not found
[domain.tld] [domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": zone not found
i think i found the issue; i have two domains configured on my account and i'm trying to edit only one of them; it seems the reqeust is trying to change wrong domain, as you can see from the logs
we might need to pass over the domain ID with username and api key as it was written on the wiki (although never imnplemented)? https://github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_shellrent
i think i found the issue; i have two domains configured on my account and i'm trying to edit only one of them; it seems the reqeust is trying to change wrong domain, as you can see from the logs
It's not what the log says.
To find the domain ID, I should browse the domains. It's the same approach as here: https://github.com/shellrent/certbot-dns-shellrent/blob/8bb65012fed772da674332f483fa66de4a7ec9b5/certbot_dns_shellrent/dns_shellrent.py#L187-L200
we might need to pass over the domain ID with username and api key as it was written on the wiki (although never implemented)?
As I already said: the acme.sh
wiki is not a reference because the PR was never merged.
https://github.com/go-acme/lego/issues/2124#issuecomment-1975179630
Also, the implementation is not the same as mine.
I'm trying to find the domain ID automatically.
I added more logs and changed something, can you try again?
here are new logs:
2024/03/07 15:03:07 [INFO] [*.domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11558323514
2024/03/07 15:03:07 [INFO] [domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11558323524
2024/03/07 15:03:07 [INFO] [*.domain.tld] acme: use dns-01 solver
2024/03/07 15:03:07 [INFO] [domain.tld] acme: Could not find solver for: tls-alpn-01
2024/03/07 15:03:07 [INFO] [domain.tld] acme: Could not find solver for: http-01
2024/03/07 15:03:07 [INFO] [domain.tld] acme: use dns-01 solver
2024/03/07 15:03:07 [INFO] [*.domain.tld] acme: Preparing to solve DNS-01
services [155539 208481]
(_acme-challenge.domain.tld) services details: &internal.ServiceDetails{ID:155539, Name:"Dominio: domainnumber2.tld", DomainID:89531}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:89531, DomainName:"domainnumber2.tld", DomainNameASCII:"domainnumber2.tld"}
check domain name: domainnumber2.tld -- _acme-challenge.domain.tld
check domain name: domainnumber2.tld -- domain.tld
(net) services details: &internal.ServiceDetails{ID:208481, Name:"Dominio: domain.tld", DomainID:103527}
(net) domain details: &internal.DomainDetails{ID:103527, DomainName:"domain.tld", DomainNameASCII:"domain.tld"}
2024/03/07 15:03:08 [INFO] [domain.tld] acme: Preparing to solve DNS-01
services [155539 208481]
(_acme-challenge.domain.tld) services details: &internal.ServiceDetails{ID:155539, Name:"Dominio: domainnumber2.tld", DomainID:89531}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:89531, DomainName:"domainnumber2.tld", DomainNameASCII:"domainnumber2.tld"}
check domain name: domainnumber2.tld -- _acme-challenge.domain.tld
check domain name: domainnumber2.tld -- domain.tld
(net) services details: &internal.ServiceDetails{ID:208481, Name:"Dominio: domain.tld", DomainID:103527}
(net) domain details: &internal.DomainDetails{ID:103527, DomainName:"domain.tld", DomainNameASCII:"domain.tld"}
2024/03/07 15:03:09 [INFO] [*.domain.tld] acme: Cleaning DNS-01 challenge
2024/03/07 15:03:09 [WARN] [*.domain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.domain.tld.' 'k6edYIgkIVCWCrH16XQBE0dTvEv9T1zTj6eXxW4T9U4'
2024/03/07 15:03:09 [INFO] [domain.tld] acme: Cleaning DNS-01 challenge
2024/03/07 15:03:09 [WARN] [domain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.domain.tld.' 'O-aVJ6W6xBTo19mIajWFzE5VOp573vwml6mZpAsBWxA'
2024/03/07 15:03:09 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11558323514
2024/03/07 15:03:09 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11558323524
2024/03/07 15:03:09 Could not obtain certificates:
error: one or more domains had a problem:
[*.domain.tld] [*.domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": zone not found
[domain.tld] [domain.tld] acme: error presenting token: shellrent: could not find zone for domain "domain.tld": zone not found
I found the problem, can you try again?
new logs, seems you got progresses:
2024/03/07 15:49:27 [INFO] [*.domain.tld, domain.tld] acme: Obtaining bundled SAN certificate
2024/03/07 15:49:28 [INFO] [*.domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11559082574
2024/03/07 15:49:28 [INFO] [domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11559082584
2024/03/07 15:49:28 [INFO] [*.domain.tld] acme: use dns-01 solver
2024/03/07 15:49:28 [INFO] [domain.tld] acme: Could not find solver for: tls-alpn-01
2024/03/07 15:49:28 [INFO] [domain.tld] acme: Could not find solver for: http-01
2024/03/07 15:49:28 [INFO] [domain.tld] acme: use dns-01 solver
2024/03/07 15:49:28 [INFO] [*.domain.tld] acme: Preparing to solve DNS-01
services [155539 208481]
(_acme-challenge.domain.tld) service 155539 details: &internal.ServiceDetails{ID:155539, Name:"Dominio: domainnumber2.tld", DomainID:89531}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:89531, DomainName:"domainnumber2.tld", DomainNameASCII:"domainnumber2.tld"}
check domain name: domainnumber2.tld -- _acme-challenge.domain.tld
check domain name: domainnumber2.tld -- domain.tld
(_acme-challenge.domain.tld) service 208481 details: &internal.ServiceDetails{ID:208481, Name:"Dominio: domain.tld", DomainID:103527}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:103527, DomainName:"domain.tld", DomainNameASCII:"domain.tld"}
check domain name: domain.tld -- _acme-challenge.domain.tld
check domain name: domain.tld -- domain.tld
2024/03/07 15:49:29 [INFO] [domain.tld] acme: Preparing to solve DNS-01
services [155539 208481]
(_acme-challenge.domain.tld) service 155539 details: &internal.ServiceDetails{ID:155539, Name:"Dominio: domainnumber2.tld", DomainID:89531}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:89531, DomainName:"domainnumber2.tld", DomainNameASCII:"domainnumber2.tld"}
check domain name: domainnumber2.tld -- _acme-challenge.domain.tld
check domain name: domainnumber2.tld -- domain.tld
(_acme-challenge.domain.tld) service 208481 details: &internal.ServiceDetails{ID:208481, Name:"Dominio: domain.tld", DomainID:103527}
(_acme-challenge.domain.tld) domain details: &internal.DomainDetails{ID:103527, DomainName:"domain.tld", DomainNameASCII:"domain.tld"}
check domain name: domain.tld -- _acme-challenge.domain.tld
check domain name: domain.tld -- domain.tld
2024/03/07 15:49:30 [INFO] [*.domain.tld] acme: Cleaning DNS-01 challenge
2024/03/07 15:49:30 [WARN] [*.domain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.domain.tld.' 'uFgcl86IFBQGmtaWGVsYfqxstRsC2fd3TIutvDih4k4'
2024/03/07 15:49:30 [INFO] [domain.tld] acme: Cleaning DNS-01 challenge
2024/03/07 15:49:30 [WARN] [domain.tld] acme: cleaning up failed: shellrent: unknown request key for '_acme-challenge.domain.tld.' '3updSJwTgnEFRa34hIEwZBkxPbMcFLt2LYvJOugKN4I'
2024/03/07 15:49:30 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11559082574
2024/03/07 15:49:30 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11559082584
2024/03/07 15:49:30 Could not obtain certificates:
error: one or more domains had a problem:
[*.domain.tld] [*.domain.tld] acme: error presenting token: shellrent: create record: code 1: Errore nella creazione del nuovo record DNS
[domain.tld] [domain.tld] acme: error presenting token: shellrent: create record: code 1: Errore nella creazione del nuovo record DNS
code 1: Errore nella creazione del nuovo record DNS
The error comes from the Shellrent API. The API error messages are not helpful, I don't know how to diagnose that :thinking:
I updated the code, can you try again?
same logs at the end:
[*.domain.tld] [*.domain.tld] acme: error presenting token: shellrent: create record: code 1: Errore nella creazione del nuovo record DNS
[domain.tld] [domain.tld] acme: error presenting token: shellrent: create record: code 1: Errore nella creazione del nuovo record DNS
i can try to open them a ticket and see what they answer
I think I found the problem, can you try again?
latest log output:
error: one or more domains had a problem:
[*.domain.tld] [*.domain.tld] acme: error presenting token: shellrent: create record: unable to unmarshal response: [status code: 200] body: {"error":0,"title":"","message":"Record DNS aggiunto con successo","data":{"id":"2255673"}} error: json: cannot unmarshal string into Go struct field Record.data.id of type int
[domain.tld] [domain.tld] acme: error presenting token: shellrent: create record: unable to unmarshal response: [status code: 200] body: {"error":0,"title":"","message":"Record DNS aggiunto con successo","data":{"id":"2255674"}} error: json: cannot unmarshal string into Go struct field Record.data.id of type int
I fixed the problem, can you try again?
no errors, all should be fine now:
2024/03/08 15:29:55 [INFO] [*.domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11576583754
2024/03/08 15:29:55 [INFO] [domain.tld] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/11576583764
2024/03/08 15:29:55 [INFO] [*.domain.tld] acme: use dns-01 solver
2024/03/08 15:29:55 [INFO] [domain.tld] acme: Could not find solver for: tls-alpn-01
2024/03/08 15:29:55 [INFO] [domain.tld] acme: Could not find solver for: http-01
2024/03/08 15:29:55 [INFO] [domain.tld] acme: use dns-01 solver
2024/03/08 15:29:55 [INFO] [*.domain.tld] acme: Preparing to solve DNS-01
2024/03/08 15:29:57 [INFO] [domain.tld] acme: Preparing to solve DNS-01
2024/03/08 15:29:59 [INFO] [*.domain.tld] acme: Trying to solve DNS-01
2024/03/08 15:29:59 [INFO] [*.domain.tld] acme: Checking DNS record propagation. [nameservers=127.0.0.53:53]
2024/03/08 15:30:09 [INFO] Wait for propagation [timeout: 5m0s, interval: 10s]
2024/03/08 15:30:09 [INFO] [*.domain.tld] acme: Waiting for DNS record propagation.
2024/03/08 15:30:19 [INFO] [*.domain.tld] acme: Waiting for DNS record propagation.
2024/03/08 15:30:29 [INFO] [*.domain.tld] acme: Waiting for DNS record propagation.
2024/03/08 15:30:44 [INFO] [*.domain.tld] The server validated our request
2024/03/08 15:30:44 [INFO] [domain.tld] acme: Trying to solve DNS-01
2024/03/08 15:30:44 [INFO] [domain.tld] acme: Checking DNS record propagation. [nameservers=127.0.0.53:53]
2024/03/08 15:30:54 [INFO] Wait for propagation [timeout: 5m0s, interval: 10s]
2024/03/08 15:31:02 [INFO] [domain.tld] The server validated our request
2024/03/08 15:31:02 [INFO] [*.domain.tld] acme: Cleaning DNS-01 challenge
2024/03/08 15:31:02 [INFO] [domain.tld] acme: Cleaning DNS-01 challenge
2024/03/08 15:31:03 [INFO] [*.domain.tld, domain.tld] acme: Validations succeeded; requesting certificates
2024/03/08 15:31:03 [INFO] Wait for certificate [timeout: 30s, interval: 500ms]
2024/03/08 15:31:05 [INFO] [*.domain.tld] Server responded with a certificate.
FYI most of the problems were related to the API documentation containing wrong information.
I'm happy that is working now!
I will clean "WIP" commits.
Sponsoring is a good way to sustain open source maintainers: sponsor me
Thanks a lot for your patience and your support!
go mod tidy
Ping @urgali, can you run the command (with your domain, email, and credentials)?
Closes #2124
Sponsoring is a good way to sustain open source maintainers: sponsor me