mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-20 23:41:21 +02:00
compatibility with "pretty" json (fixes #202)
This commit is contained in:
@@ -14,6 +14,7 @@ This file contains a log of major changes in letsencrypt.sh
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Fixed bug with uppercase names in domains.txt (script now converts everything to lowercase)
|
- Fixed bug with uppercase names in domains.txt (script now converts everything to lowercase)
|
||||||
- mktemp no longer uses the deprecated `-t` parameter.
|
- mktemp no longer uses the deprecated `-t` parameter.
|
||||||
|
- Compatibility with "pretty" json
|
||||||
|
|
||||||
## [0.1.0] - 2016-03-25
|
## [0.1.0] - 2016-03-25
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -209,6 +209,11 @@ _exiterr() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove newlines and whitespace from json
|
||||||
|
clean_json() {
|
||||||
|
tr -d '\r\n' | _sed -e 's/ +/ /g' -e 's/\{ /{/g' -e 's/ \}/}/g' -e 's/\[ /[/g' -e 's/ \]/]/g'
|
||||||
|
}
|
||||||
|
|
||||||
# Encode data as url-safe formatted base64
|
# Encode data as url-safe formatted base64
|
||||||
urlbase64() {
|
urlbase64() {
|
||||||
# urlbase64: base64 encoded string with '+' replaced with '-' and '/' replaced with '_'
|
# urlbase64: base64 encoded string with '+' replaced with '-' and '/' replaced with '_'
|
||||||
@@ -376,7 +381,7 @@ sign_csr() {
|
|||||||
for altname in ${altnames}; do
|
for altname in ${altnames}; do
|
||||||
# Ask the acme-server for new challenge token and extract them from the resulting json block
|
# Ask the acme-server for new challenge token and extract them from the resulting json block
|
||||||
echo " + Requesting challenge for ${altname}..."
|
echo " + Requesting challenge for ${altname}..."
|
||||||
response="$(signed_request "${CA_NEW_AUTHZ}" '{"resource": "new-authz", "identifier": {"type": "dns", "value": "'"${altname}"'"}}')"
|
response="$(signed_request "${CA_NEW_AUTHZ}" '{"resource": "new-authz", "identifier": {"type": "dns", "value": "'"${altname}"'"}}' | clean_json)"
|
||||||
|
|
||||||
challenges="$(printf '%s\n' "${response}" | sed -n 's/.*\("challenges":[^\[]*\[[^]]*]\).*/\1/p')"
|
challenges="$(printf '%s\n' "${response}" | sed -n 's/.*\("challenges":[^\[]*\[[^]]*]\).*/\1/p')"
|
||||||
repl=$'\n''{' # fix syntax highlighting in Vim
|
repl=$'\n''{' # fix syntax highlighting in Vim
|
||||||
@@ -428,7 +433,7 @@ sign_csr() {
|
|||||||
|
|
||||||
# Ask the acme-server to verify our challenge and wait until it is no longer pending
|
# Ask the acme-server to verify our challenge and wait until it is no longer pending
|
||||||
echo " + Responding to challenge for ${altname}..."
|
echo " + Responding to challenge for ${altname}..."
|
||||||
result="$(signed_request "${challenge_uris[${idx}]}" '{"resource": "challenge", "keyAuthorization": "'"${keyauth}"'"}')"
|
result="$(signed_request "${challenge_uris[${idx}]}" '{"resource": "challenge", "keyAuthorization": "'"${keyauth}"'"}' | clean_json)"
|
||||||
|
|
||||||
reqstatus="$(printf '%s\n' "${result}" | get_json_string_value status)"
|
reqstatus="$(printf '%s\n' "${result}" | get_json_string_value status)"
|
||||||
|
|
||||||
@@ -678,7 +683,7 @@ command_revoke() {
|
|||||||
echo "Revoking ${cert}"
|
echo "Revoking ${cert}"
|
||||||
|
|
||||||
cert64="$(openssl x509 -in "${cert}" -inform PEM -outform DER | urlbase64)"
|
cert64="$(openssl x509 -in "${cert}" -inform PEM -outform DER | urlbase64)"
|
||||||
response="$(signed_request "${CA_REVOKE_CERT}" '{"resource": "revoke-cert", "certificate": "'"${cert64}"'"}')"
|
response="$(signed_request "${CA_REVOKE_CERT}" '{"resource": "revoke-cert", "certificate": "'"${cert64}"'"}' | clean_json)"
|
||||||
# if there is a problem with our revoke request _request (via signed_request) will report this and "exit 1" out
|
# if there is a problem with our revoke request _request (via signed_request) will report this and "exit 1" out
|
||||||
# so if we are here, it is safe to assume the request was successful
|
# so if we are here, it is safe to assume the request was successful
|
||||||
echo " + Done."
|
echo " + Done."
|
||||||
|
|||||||
Reference in New Issue
Block a user