Skip to content

Commit a03bb24

Browse files
committed
Add support for HTTP/2 Let's Encrypt Server.
1 parent 50785f4 commit a03bb24

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

bin/v-add-letsencrypt-domain

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ fi
153153

154154
# Requesting nonce / STEP 1
155155
answer=$(curl -s -I "$LE_API/directory")
156-
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
157-
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
156+
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
157+
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
158158
if [[ "$status" -ne 200 ]]; then
159159
# Delete DNS CAA record
160160
if [ ! -z "$DNS_SYSTEM" ]; then
@@ -179,10 +179,10 @@ done
179179
payload=$(echo "$payload"|sed "s/,$//")
180180
payload=$payload']}'
181181
answer=$(query_le_v2 "$url" "$payload" "$nonce")
182-
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
182+
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
183183
authz=$(echo "$answer" |grep "acme/authz" |cut -f2 -d '"')
184184
finalize=$(echo "$answer" |grep 'finalize":' |cut -f4 -d '"')
185-
status=$(echo "$answer" |grep HTTP/1.1 |tail -n1 |cut -f2 -d ' ')
185+
status=$(echo "$answer" |grep HTTP/ |tail -n1 |cut -f2 -d ' ')
186186
if [[ "$status" -ne 201 ]]; then
187187
# Delete DNS CAA record
188188
if [ ! -z "$DNS_SYSTEM" ]; then
@@ -201,8 +201,8 @@ for auth in $authz; do
201201
answer=$(query_le_v2 "$auth" "$payload" "$nonce")
202202
url=$(echo "$answer" |grep -A3 $proto |grep url |cut -f 4 -d \")
203203
token=$(echo "$answer" |grep -A3 $proto |grep token |cut -f 4 -d \")
204-
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
205-
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
204+
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
205+
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
206206
if [[ "$status" -ne 200 ]]; then
207207
# Delete DNS CAA record
208208
if [ ! -z "$DNS_SYSTEM" ]; then
@@ -290,8 +290,8 @@ for auth in $authz; do
290290
payload='{}'
291291
answer=$(query_le_v2 "$url" "$payload" "$nonce")
292292
validation=$(echo "$answer"|grep -A1 $proto |tail -n1|cut -f4 -d \")
293-
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
294-
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
293+
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
294+
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
295295
details=$(echo "$answer"| grep detail | cut -f 2 -d ',' | cut -f 2-4 -d ':')
296296
if [[ "$status" -ne 200 ]]; then
297297
# Delete DNS CAA record
@@ -349,8 +349,8 @@ ssl_dir=$($BIN/v-generate-ssl-cert "$domain" "info@$domain" "US" "California"\
349349
csr=$(openssl req -in $ssl_dir/$domain.csr -outform DER |encode_base64)
350350
payload='{"csr":"'$csr'"}'
351351
answer=$(query_le_v2 "$finalize" "$payload" "$nonce")
352-
nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
353-
status=$(echo "$answer"|grep HTTP/1.1 |tail -n1 |cut -f 2 -d ' ')
352+
nonce=$(echo "$answer" |grep -i nonce |cut -f2 -d \ |tr -d '\r\n')
353+
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
354354
certificate=$(echo "$answer"|grep 'certificate":' |cut -f4 -d '"')
355355
if [[ "$status" -ne 200 ]]; then
356356
check_result $E_CONNECT "Let's Encrypt finalize bad status $status"

bin/v-add-letsencrypt-user

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@ fi
107107

108108

109109
# Requesting ACME nonce
110-
nonce=$(curl -s -I "$LE_API/directory" |grep Nonce |cut -f 2 -d \ |tr -d '\r\n')
110+
nonce=$(curl -s -I "$LE_API/directory" |grep -i nonce |cut -f2 -d\ |tr -d '\r\n')
111111

112112
# Creating ACME account
113113
url="$LE_API/acme/new-acct"
114114
payload='{"termsOfServiceAgreed": true}'
115115
answer=$(query_le_v2 "$url" "$payload" "$nonce")
116-
kid=$(echo "$answer" |grep Location: |cut -f2 -d ' '|tr -d '\r')
116+
kid=$(echo "$answer" |grep -i location: |cut -f2 -d ' '|tr -d '\r')
117117

118118
# Checking answer status
119-
status=$(echo "$answer" |grep HTTP/1.1 |tail -n1 |cut -f2 -d ' ')
119+
status=$(echo "$answer" |grep HTTP/ |tail -n1 |cut -f2 -d ' ')
120120
if [[ "${status:0:2}" -ne "20" ]]; then
121121
check_result $E_CONNECT "Let's Encrypt acc registration failed $status"
122122
fi

0 commit comments

Comments
 (0)