mirror of
https://github.com/myvesta/vesta
synced 2025-07-06 04:51:54 -07:00
added support for HTTP/2 Let's Encrypt servers
This commit is contained in:
parent
84ef0a118f
commit
ae328a0935
2 changed files with 13 additions and 13 deletions
|
@ -109,8 +109,8 @@ fi
|
||||||
|
|
||||||
# Requesting nonce / STEP 1
|
# Requesting nonce / STEP 1
|
||||||
answer=$(curl -s -I "$API/directory")
|
answer=$(curl -s -I "$API/directory")
|
||||||
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
|
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
|
||||||
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
|
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
|
||||||
if [[ "$status" -ne 200 ]]; then
|
if [[ "$status" -ne 200 ]]; then
|
||||||
check_result $E_CONNECT "Let's Encrypt nonce request status $status"
|
check_result $E_CONNECT "Let's Encrypt nonce request status $status"
|
||||||
fi
|
fi
|
||||||
|
@ -125,10 +125,10 @@ done
|
||||||
payload=$(echo "$payload"|sed "s/,$//")
|
payload=$(echo "$payload"|sed "s/,$//")
|
||||||
payload=$payload']}'
|
payload=$payload']}'
|
||||||
answer=$(query_le_v2 "$url" "$payload" "$nonce")
|
answer=$(query_le_v2 "$url" "$payload" "$nonce")
|
||||||
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
|
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
|
||||||
authz=$(echo "$answer" |grep "acme/authz" |cut -f2 -d '"')
|
authz=$(echo "$answer" |grep "acme/authz" |cut -f2 -d '"')
|
||||||
finalize=$(echo "$answer" |grep 'finalize":' |cut -f4 -d '"')
|
finalize=$(echo "$answer" |grep 'finalize":' |cut -f4 -d '"')
|
||||||
status=$(echo "$answer" |grep HTTP/1.1 |tail -n1 |cut -f2 -d ' ')
|
status=$(echo "$answer" |grep HTTP/ |tail -n1 |cut -f2 -d ' ')
|
||||||
if [[ "$status" -ne 201 ]]; then
|
if [[ "$status" -ne 201 ]]; then
|
||||||
check_result $E_CONNECT "Let's Encrypt new auth status $status"
|
check_result $E_CONNECT "Let's Encrypt new auth status $status"
|
||||||
fi
|
fi
|
||||||
|
@ -139,8 +139,8 @@ for auth in $authz; do
|
||||||
answer=$(query_le_v2 "$auth" "$payload" "$nonce")
|
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 url |cut -f 4 -d \")
|
||||||
token=$(echo "$answer" |grep -A3 $proto |grep token |cut -f 4 -d \")
|
token=$(echo "$answer" |grep -A3 $proto |grep token |cut -f 4 -d \")
|
||||||
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
|
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
|
||||||
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
|
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
|
||||||
if [[ "$status" -ne 200 ]]; then
|
if [[ "$status" -ne 200 ]]; then
|
||||||
check_result $E_CONNECT "Let's Encrypt acme/authz bad status $status"
|
check_result $E_CONNECT "Let's Encrypt acme/authz bad status $status"
|
||||||
fi
|
fi
|
||||||
|
@ -198,8 +198,8 @@ for auth in $authz; do
|
||||||
payload='{}'
|
payload='{}'
|
||||||
answer=$(query_le_v2 "$url" "$payload" "$nonce")
|
answer=$(query_le_v2 "$url" "$payload" "$nonce")
|
||||||
validation=$(echo "$answer"|grep -A1 $proto |tail -n1|cut -f4 -d \")
|
validation=$(echo "$answer"|grep -A1 $proto |tail -n1|cut -f4 -d \")
|
||||||
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
|
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
|
||||||
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
|
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
|
||||||
if [[ "$status" -ne 200 ]]; then
|
if [[ "$status" -ne 200 ]]; then
|
||||||
check_result $E_CONNECT "Let's Encrypt validation status $status"
|
check_result $E_CONNECT "Let's Encrypt validation status $status"
|
||||||
fi
|
fi
|
||||||
|
@ -224,8 +224,8 @@ ssl_dir=$($BIN/v-generate-ssl-cert "$domain" "info@$domain" "US" "California"\
|
||||||
csr=$(openssl req -in $ssl_dir/$domain.csr -outform DER |encode_base64)
|
csr=$(openssl req -in $ssl_dir/$domain.csr -outform DER |encode_base64)
|
||||||
payload='{"csr":"'$csr'"}'
|
payload='{"csr":"'$csr'"}'
|
||||||
answer=$(query_le_v2 "$finalize" "$payload" "$nonce")
|
answer=$(query_le_v2 "$finalize" "$payload" "$nonce")
|
||||||
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
|
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
|
||||||
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
|
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
|
||||||
certificate=$(echo "$answer"|grep 'certificate":' |cut -f4 -d '"')
|
certificate=$(echo "$answer"|grep 'certificate":' |cut -f4 -d '"')
|
||||||
if [[ "$status" -ne 200 ]]; then
|
if [[ "$status" -ne 200 ]]; then
|
||||||
check_result $E_CONNECT "Let's Encrypt finalize bad status $status"
|
check_result $E_CONNECT "Let's Encrypt finalize bad status $status"
|
||||||
|
|
|
@ -103,16 +103,16 @@ fi
|
||||||
|
|
||||||
|
|
||||||
# Requesting ACME nonce
|
# Requesting ACME nonce
|
||||||
nonce=$(curl -s -I "$API/directory" |grep Nonce |cut -f 2 -d \ |tr -d '\r\n')
|
nonce=$(curl -s -I "$API/directory" |grep -i nonce |cut -f2 -d\ |tr -d '\r\n')
|
||||||
|
|
||||||
# Creating ACME account
|
# Creating ACME account
|
||||||
url="$API/acme/new-acct"
|
url="$API/acme/new-acct"
|
||||||
payload='{"termsOfServiceAgreed": true}'
|
payload='{"termsOfServiceAgreed": true}'
|
||||||
answer=$(query_le_v2 "$url" "$payload" "$nonce")
|
answer=$(query_le_v2 "$url" "$payload" "$nonce")
|
||||||
kid=$(echo "$answer" |grep Location: |cut -f2 -d ' '|tr -d '\r')
|
kid=$(echo "$answer" |grep -i location: |cut -f2 -d ' '|tr -d '\r')
|
||||||
|
|
||||||
# Checking answer status
|
# Checking answer status
|
||||||
status=$(echo "$answer" |grep HTTP/1.1 |tail -n1 |cut -f2 -d ' ')
|
status=$(echo "$answer" |grep HTTP/ |tail -n1 |cut -f2 -d ' ')
|
||||||
if [[ "${status:0:2}" -ne "20" ]]; then
|
if [[ "${status:0:2}" -ne "20" ]]; then
|
||||||
check_result $E_CONNECT "Let's Encrypt acc registration failed $status"
|
check_result $E_CONNECT "Let's Encrypt acc registration failed $status"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue