This commit is contained in:
neil 2015-12-26 23:41:30 +08:00
parent 00e163506e
commit b5626079be

16
le.sh
View File

@ -321,7 +321,7 @@ issue() {
fi fi
# verify each domain # verify each domain
_info "verify each domain" _info "Verify each domain"
alldomains=$(echo "$Le_Domain,$Le_Alt" | sed "s/,/ /g") alldomains=$(echo "$Le_Domain,$Le_Alt" | sed "s/,/ /g")
for d in $alldomains for d in $alldomains
@ -371,34 +371,34 @@ issue() {
_debug "checking" _debug "checking"
if ! _get $uri ; then if ! _get $uri ; then
_info "verify error:$d" _info "Verify error:$d"
return 1 return 1
fi fi
status=$(echo $response | egrep -o '"status":"[^"]+"' | cut -d : -f 2 | sed 's/"//g') status=$(echo $response | egrep -o '"status":"[^"]+"' | cut -d : -f 2 | sed 's/"//g')
if [ "$status" == "valid" ] ; then if [ "$status" == "valid" ] ; then
_info "verify success:$d" _info "Verify success:$d"
break; break;
fi fi
if [ "$status" == "invalid" ] ; then if [ "$status" == "invalid" ] ; then
error=$(echo $response | egrep -o '"error":{[^}]*}' | grep -o '"detail":"[^"]*"' | cut -d '"' -f 4) error=$(echo $response | egrep -o '"error":{[^}]*}' | grep -o '"detail":"[^"]*"' | cut -d '"' -f 4)
_info "verify error:$d" _info "Verify error:$d"
_debug $error _debug $error
return 1; return 1;
fi fi
if [ "$status" == "pending" ] ; then if [ "$status" == "pending" ] ; then
_info "verify pending:$d" _info "Verify pending:$d"
else else
_info "verify error:$d" _info "Verify error:$d"
return 1 return 1
fi fi
done done
done done
_info "verify finished, start to sign." _info "Verify finished, start to sign."
der=$(openssl req -in $CSR_PATH -outform DER | base64 | _b64) der=$(openssl req -in $CSR_PATH -outform DER | base64 | _b64)
_send_signed_request "$API/acme/new-cert" "{\"resource\": \"new-cert\", \"csr\": \"$der\"}" "needbas64" _send_signed_request "$API/acme/new-cert" "{\"resource\": \"new-cert\", \"csr\": \"$der\"}" "needbas64"
@ -408,6 +408,8 @@ issue() {
_info "Cert success." _info "Cert success."
cat $CERT_PATH cat $CERT_PATH
_info "Your cert is in $CERT_PATH"
_setopt $DOMAIN_CONF "Le_Domain" "=" "$Le_Domain" _setopt $DOMAIN_CONF "Le_Domain" "=" "$Le_Domain"
_setopt $DOMAIN_CONF "Le_Alt" "=" "$Le_Alt" _setopt $DOMAIN_CONF "Le_Alt" "=" "$Le_Alt"
_setopt $DOMAIN_CONF "Le_Webroot" "=" "$Le_Webroot" _setopt $DOMAIN_CONF "Le_Webroot" "=" "$Le_Webroot"