From badb7bc4d4505a2e74929f59a238c5f6df999aa8 Mon Sep 17 00:00:00 2001 From: Ruben Bosch Date: Sat, 15 Aug 2020 16:12:32 +0200 Subject: [PATCH] Update url grep to https:// to prevent matching on token I came across the issue where the token contains `url` in the string, which leads to grep matching on both url and token causing the `query_le_v2` to fail because the first parsed argument is the url which is separated by a newline and the token. This eventually leads to error 15 while requesting a certificate. After some debugging I found what the issue was. Therefore I'm proposing to make the grep more strict on `https://`. --- bin/v-add-letsencrypt-domain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/v-add-letsencrypt-domain b/bin/v-add-letsencrypt-domain index 0e9438ed7..1d9bf0aea 100755 --- a/bin/v-add-letsencrypt-domain +++ b/bin/v-add-letsencrypt-domain @@ -137,7 +137,7 @@ fi for auth in $authz; do payload='' answer=$(query_le_v2 "$auth" "$payload" "$nonce") - url=$(echo "$answer" |grep -A3 $proto |grep url |cut -f 4 -d \") + url=$(echo "$answer" |grep -A3 $proto |grep "https://" |cut -f 4 -d \") token=$(echo "$answer" |grep -A3 $proto |grep token |cut -f 4 -d \") nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n') status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')