Skip to content

Commit

Permalink
Merge pull request #2039 from moucho/acme_v2_GET
Browse files Browse the repository at this point in the history
Deprecate GET acme v2
  • Loading branch information
dpeca committed Oct 25, 2020
2 parents af94a23 + 2dc4adb commit d7de756
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bin/v-add-letsencrypt-domain
Expand Up @@ -53,7 +53,10 @@ query_le_v2() {
post_data=$post_data'"payload":"'"$payload_"'",'
post_data=$post_data'"signature":"'"$signature_"'"}'

curl -s -i -d "$post_data" "$1" -H "$content"
# Save http response to file passed as "$4" arg or print to stdout if not provided
# http response headers are always sent to stdout
local save_to_file=${4:-"/dev/stdout"}
curl --silent --dump-header /dev/stdout --data "$post_data" "$1" --header "$content" --output "$save_to_file"
}


Expand Down Expand Up @@ -232,7 +235,12 @@ if [[ "$status" -ne 200 ]]; then
fi

# Downloading signed certificate / STEP 7
curl -s "$certificate" -o $ssl_dir/$domain.pem
answer=$(query_le_v2 "$certificate" "" "$nonce" "$ssl_dir/$domain.pem")
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
if [[ "$status" -ne 200 ]]; then
[ -d "$ssl_dir" ] && rm -rf "$ssl_dir"
check_result $E_NOTEXIST "Let's Encrypt downloading signed cert failed status: $status"
fi

# Splitting up downloaded pem
crt_end=$(grep -n END $ssl_dir/$domain.pem |head -n1 |cut -f1 -d:)
Expand Down

0 comments on commit d7de756

Please sign in to comment.