mrhackcz / wedos-hook

Wedos hook shell script for dehydrated ACME client
European Union Public License 1.2
2 stars 2 forks source link

Script unexpectedly ends without error #2

Closed Rohlik closed 1 year ago

Rohlik commented 5 years ago

Hello :)

I have problem with your script. I cannot renew certficate even when I use --force

dehydrated -v:

# INFO: Using main config file /etc/dehydrated/config
Dehydrated by Lukas Schauer
https://dehydrated.io

Dehydrated version: git-master-after-0.6.2
GIT-Revision: unknown

OS: Raspbian GNU/Linux 9
Used software:
 bash: 4.4.12(1)-release
 curl: curl 7.52.1
 awk: mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
 sed: sed (GNU sed) 4.4
 mktemp: mktemp (GNU coreutils) 8.26
 grep: grep (GNU grep) 2.27
 diff: diff (GNU diffutils) 3.5
 openssl: OpenSSL 1.1.0f  25 May 2017

Few last lines with debug enabled:

+ challenge='{"type": "dns-01", "status": "valid", "url": "https://acme-v02.api.letsencrypt.org/acme/challenge/PX0mDoyKv3B9Z2wWrAXWIv1whG4fGdPQYbJieOnbQ_Q/10995614501", "token": "EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI", "validationRecord": [{"hostname": "example.eu"}'
+ '[' -z '{"type": "dns-01", "status": "valid", "url": "https://acme-v02.api.letsencrypt.org/acme/challenge/PX0mDoyKv3B9Z2wWrAXWIv1whG4fGdPQYbJieOnbQ_Q/10995614501", "token": "EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI", "validationRecord": [{"hostname": "example.eu"}' ']'
+ challenge_names[${idx}]=example.eu
++ echo '{"type": "dns-01", "status": "valid", "url": "https://acme-v02.api.letsencrypt.org/acme/challenge/PX0mDoyKv3B9Z2wWrAXWIv1whG4fGdPQYbJieOnbQ_Q/10995614501", "token": "EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI", "validationRecord": [{"hostname": "example.eu"}'
++ get_json_string_value token
++ local filter
+++ printf 's/.*"%s": *"\([^"]*\)".*/\\1/p' token
++ filter='s/.*"token": *"\([^"]*\)".*/\1/p'
++ sed -n 's/.*"token": *"\([^"]*\)".*/\1/p'
+ challenge_tokens[${idx}]=EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI
+ [[ 2 -eq 2 ]]
++ echo '{"type": "dns-01", "status": "valid", "url": "https://acme-v02.api.letsencrypt.org/acme/challenge/PX0mDoyKv3B9Z2wWrAXWIv1whG4fGdPQYbJieOnbQ_Q/10995614501", "token": "EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI", "validationRecord": [{"hostname": "example.eu"}'
++ get_json_string_value url
++ local filter
++ _sed 's/"validationRecord": ?\[[^]]+\]//g'
++ [[ Linux = \L\i\n\u\x ]]
++ sed -r 's/"validationRecord": ?\[[^]]+\]//g'
+++ printf 's/.*"%s": *"\([^"]*\)".*/\\1/p' url
++ filter='s/.*"url": *"\([^"]*\)".*/\1/p'
++ sed -n 's/.*"url": *"\([^"]*\)".*/\1/p'
+ challenge_uris[${idx}]=https://acme-v02.api.letsencrypt.org/acme/challenge/PX0mDoyKv3B9Z2wWrAXWIv1whG4fGdPQYbJieOnbQ_Q/10995614501
+ keyauth=EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI.G6Y5HKEDkwrMmrIVfRS_l65Q3D6xWp9O2SLjtkhvP9c
+ case "${CHALLENGETYPE}" in
++ openssl dgst -sha256 -binary
++ urlbase64
++ printf %s EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI.G6Y5HKEDkwrMmrIVfRS_l65Q3D6xWp9O2SLjtkhvP9c
++ openssl base64 -e
++ tr -d '\n\r'
++ _sed -e 's:=*$::g' -e y:+/:-_:
++ [[ Linux = \L\i\n\u\x ]]
++ sed -r -e 's:=*$::g' -e y:+/:-_:
+ keyauth_hook=NLGYhTlw2Iz-QacFLdjvMMJjzJRGJjDp-yGIQnEeN_w
+ keyauths[${idx}]=EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI.G6Y5HKEDkwrMmrIVfRS_l65Q3D6xWp9O2SLjtkhvP9c
+ deploy_args[${idx}]='example.eu EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI NLGYhTlw2Iz-QacFLdjvMMJjzJRGJjDp-yGIQnEeN_w'
+ idx=1
+ local num_pending_challenges=1
+ echo ' + 1 pending challenge(s)'
 + 1 pending challenge(s)
+ [[ 1 -ne 0 ]]
+ echo ' + Deploying challenge tokens...'
 + Deploying challenge tokens...
+ [[ -n /etc/dehydrated/wedos-hook.sh ]]
+ [[ no = \y\e\s ]]
+ [[ -n /etc/dehydrated/wedos-hook.sh ]]
+ local idx=0
+ '[' 0 -lt 1 ']'
+ /etc/dehydrated/wedos-hook.sh deploy_challenge example.eu EtS1Cksd6oDWaHVa2NIrNB2EboAQM-Z2z3sFnUwfZkI NLGYhTlw2Iz-QacFLdjvMMJjzJRGJjDp-yGIQnEeN_w
{
  "response": {
    "code": 1000,
    "result": "OK",
    "timestamp": 1546461484,
    "svTRID": "1546461484.2126.23022.1",
    "command": "dns-row-update"
  }
}
+ remove_lock
+ rm -f /etc/dehydrated/lock

PS: I replaced my real webhost with example.eu

mrhackcz commented 5 years ago

Hi there ! This behavior is normal. Its caused by wedos and their slow DNS servers. If you put TXT record and commit changes it will take 15-60 minutes to distribute to the internet. I will take a look next week, if is possible to make some improvement. Thank you :)

mrhackcz commented 5 years ago

16:52:26 CET - I put TXT record into Wedos DNS. 16:57:08 CET - TXT was distributed to the ns.wedos.net... I'm thinking, how to solve it.

Rohlik commented 5 years ago

Maybe you can get some inspiration from other Dehydrated external DNS script.

mrhackcz commented 1 year ago

After few years :) Hopefully fixed in 0debc4c0a7d8f22acb157829efbbf802a9a534c0