From bcef3c6c9b5d464d05db2cbe7d061304ce2cb7dc Mon Sep 17 00:00:00 2001 From: Nicolas Rosset Date: Sun, 28 Aug 2022 11:35:13 +0200 Subject: [PATCH 1/4] Use US English to format date MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DNS Made Easy API checks for an English date header otherwise it create an error. In deed, we have in logs: `response='{"error": ["Invalid request date header: dim., 28 août 2022 09:24:45 UTC"]}'` (my system was in French) Using local locale makes it work fine. --- dnsapi/dns_me.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnsapi/dns_me.sh b/dnsapi/dns_me.sh index 49007402..14ab79a4 100644 --- a/dnsapi/dns_me.sh +++ b/dnsapi/dns_me.sh @@ -134,7 +134,7 @@ _me_rest() { data="$3" _debug "$ep" - cdate=$(LANG=C date -u +"%a, %d %b %Y %T %Z") + cdate=$(LC_TIME=en_US.utf8; LANG=C date -u +"%a, %d %b %Y %T %Z") hmac=$(printf "%s" "$cdate" | _hmac sha1 "$(printf "%s" "$ME_Secret" | _hex_dump | tr -d " ")" hex) export _H1="x-dnsme-apiKey: $ME_Key" From 42ad49a761b3bced0d5873c231dd610eb99af2b6 Mon Sep 17 00:00:00 2001 From: Nicolas Rosset Date: Tue, 6 Sep 2022 15:03:50 +0200 Subject: [PATCH 2/4] Follow shfmt CI feedbacks --- dnsapi/dns_me.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dnsapi/dns_me.sh b/dnsapi/dns_me.sh index 14ab79a4..58c3a230 100644 --- a/dnsapi/dns_me.sh +++ b/dnsapi/dns_me.sh @@ -134,7 +134,11 @@ _me_rest() { data="$3" _debug "$ep" - cdate=$(LC_TIME=en_US.utf8; LANG=C date -u +"%a, %d %b %Y %T %Z") + cdate=$( + LC_TIME=en_US.utf8 + LANG=C date -u +"%a, %d %b %Y %T %Z" + ) + hmac=$(printf "%s" "$cdate" | _hmac sha1 "$(printf "%s" "$ME_Secret" | _hex_dump | tr -d " ")" hex) export _H1="x-dnsme-apiKey: $ME_Key" From bc4a699e49a4f5b810ef6249ae627b4defa0c992 Mon Sep 17 00:00:00 2001 From: Nicolas Rosset Date: Tue, 6 Sep 2022 15:39:15 +0200 Subject: [PATCH 3/4] Try to make it work with DragonFlyBSD --- dnsapi/dns_me.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dnsapi/dns_me.sh b/dnsapi/dns_me.sh index 58c3a230..3b587223 100644 --- a/dnsapi/dns_me.sh +++ b/dnsapi/dns_me.sh @@ -134,10 +134,7 @@ _me_rest() { data="$3" _debug "$ep" - cdate=$( - LC_TIME=en_US.utf8 - LANG=C date -u +"%a, %d %b %Y %T %Z" - ) + cdate=$(LC_TIME='en_US.utf8' LANG='C' date -u +"%a, %d %b %Y %T %Z") hmac=$(printf "%s" "$cdate" | _hmac sha1 "$(printf "%s" "$ME_Secret" | _hex_dump | tr -d " ")" hex) From a4c415765b3d4a4997594063cb6fa8213dd37129 Mon Sep 17 00:00:00 2001 From: Nicolas Rosset Date: Tue, 6 Sep 2022 16:04:14 +0200 Subject: [PATCH 4/4] Run tests --- dnsapi/dns_me.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnsapi/dns_me.sh b/dnsapi/dns_me.sh index 3b587223..67529aee 100644 --- a/dnsapi/dns_me.sh +++ b/dnsapi/dns_me.sh @@ -134,7 +134,7 @@ _me_rest() { data="$3" _debug "$ep" - cdate=$(LC_TIME='en_US.utf8' LANG='C' date -u +"%a, %d %b %Y %T %Z") + cdate=$(LC_TIME=en_US.utf8 LANG=C date -u +"%a, %d %b %Y %T %Z") hmac=$(printf "%s" "$cdate" | _hmac sha1 "$(printf "%s" "$ME_Secret" | _hex_dump | tr -d " ")" hex)