mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-26 06:52:37 +00:00
Some fixes
This commit is contained in:
parent
4bf1f579f5
commit
dfb4883c93
@ -7,7 +7,7 @@
|
|||||||
#OPNs_Port="443"
|
#OPNs_Port="443"
|
||||||
#OPNs_Key="qocfU9RSbt8vTIBcnW8bPqCrpfAHMDvj5OzadE7Str+rbjyCyk7u6yMrSCHtBXabgDDXx/dY0POUp7ZA"
|
#OPNs_Key="qocfU9RSbt8vTIBcnW8bPqCrpfAHMDvj5OzadE7Str+rbjyCyk7u6yMrSCHtBXabgDDXx/dY0POUp7ZA"
|
||||||
#OPNs_Token="pZEQ+3ce8dDlfBBdg3N8EpqpF5I1MhFqdxX06le6Gl8YzyQvYCfCzNaFX9O9+IOSyAs7X71fwdRiZ+Lv"
|
#OPNs_Token="pZEQ+3ce8dDlfBBdg3N8EpqpF5I1MhFqdxX06le6Gl8YzyQvYCfCzNaFX9O9+IOSyAs7X71fwdRiZ+Lv"
|
||||||
#OPNs_Api_Insecure=1 # Set 1 for insecure and 0 for secure -> difference is whether ssl cert is checked for validity (0) or whether it is just accepted (1)
|
#OPNs_Api_Insecure=0 # Set 1 for insecure and 0 for secure -> difference is whether ssl cert is checked for validity (0) or whether it is just accepted (1)
|
||||||
|
|
||||||
######## Public functions #####################
|
######## Public functions #####################
|
||||||
#Usage: add _acme-challenge.www.domain.com "123456789ABCDEF0000000000000000000000000000000000000"
|
#Usage: add _acme-challenge.www.domain.com "123456789ABCDEF0000000000000000000000000000000000000"
|
||||||
@ -74,8 +74,7 @@ set_record() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "$_return_str" | _egrep_o "\"result\":\"saved\"" >/dev/null
|
if echo "$_return_str" | _egrep_o "\"result\":\"saved\"" >/dev/null; then
|
||||||
then
|
|
||||||
_opns_rest "POST" "/service/reconfigure" "{}"
|
_opns_rest "POST" "/service/reconfigure" "{}"
|
||||||
_debug "Record created"
|
_debug "Record created"
|
||||||
else
|
else
|
||||||
@ -104,7 +103,7 @@ rm_record() {
|
|||||||
if _existingchallenge "$_domain" "$_host" "$new_challenge"; then
|
if _existingchallenge "$_domain" "$_host" "$new_challenge"; then
|
||||||
# Delete
|
# Delete
|
||||||
if _opns_rest "POST" "/record/delRecord/${_uuid}" "\{\}"; then
|
if _opns_rest "POST" "/record/delRecord/${_uuid}" "\{\}"; then
|
||||||
if echo "$_return_str" | _egrep_o "result":"deleted" >/dev/null; then
|
if echo "$_return_str" | _egrep_o "\"result\":\"deleted\"" >/dev/null; then
|
||||||
_opns_rest "POST" "/service/reconfigure" "{}"
|
_opns_rest "POST" "/service/reconfigure" "{}"
|
||||||
_debug "Record deleted"
|
_debug "Record deleted"
|
||||||
else
|
else
|
||||||
@ -144,7 +143,7 @@ _get_root() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_debug h "$h"
|
_debug h "$h"
|
||||||
id=$(echo $_domain_response| _egrep_o "\"[^\"]*\":{\"enabled\":\"1\",\"type\":{\"master\":{\"value\":\"master\",\"selected\":1},\"slave\":{\"value\":\"slave\",\"selected\":0}},\"masterip\":\"[^\"]*\",\"domainname\":\"${h}\"" | cut -d ':' -f 1 | cut -d '"' -f 2 )
|
id=$(echo "$_domain_response" | _egrep_o "\"[^\"]*\":{\"enabled\":\"1\",\"type\":{\"master\":{\"value\":\"master\",\"selected\":1},\"slave\":{\"value\":\"slave\",\"selected\":0}},\"masterip\":\"[^\"]*\",\"domainname\":\"${h}\"" | cut -d ':' -f 1 | cut -d '"' -f 2)
|
||||||
|
|
||||||
if [ -n "$id" ]; then
|
if [ -n "$id" ]; then
|
||||||
_debug id "$id"
|
_debug id "$id"
|
||||||
@ -166,8 +165,8 @@ _opns_rest() {
|
|||||||
ep=$2
|
ep=$2
|
||||||
data=$3
|
data=$3
|
||||||
#Percent encode user and token
|
#Percent encode user and token
|
||||||
key=$(echo $OPNs_Key | tr -d "\n\r" | _url_encode )
|
key=$(echo "$OPNs_Key" | tr -d "\n\r" | _url_encode)
|
||||||
token=$(echo $OPNs_Token| tr -d "\n\r" | _url_encode )
|
token=$(echo "$OPNs_Token" | tr -d "\n\r" | _url_encode)
|
||||||
|
|
||||||
opnsense_url="https://${key}:${token}@${OPNs_Host}:${OPNs_Port}/api/bind${ep}"
|
opnsense_url="https://${key}:${token}@${OPNs_Host}:${OPNs_Port}/api/bind${ep}"
|
||||||
export _H1="Content-Type: application/json"
|
export _H1="Content-Type: application/json"
|
||||||
@ -200,7 +199,7 @@ _existingchallenge() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_uuid=""
|
_uuid=""
|
||||||
_uuid=$( echo $_record_response| _egrep_o "\"uuid\":\"[^\"]*\",\"enabled\":\"[01]\",\"domain\":\"$1\",\"name\":\"$2\",\"type\":\"TXT\",\"value\":\"$3\"" | cut -d ':' -f 2 | cut -d '"' -f 2 )
|
_uuid=$( echo "$_record_response" | _egrep_o "\"uuid\":\"[^\"]*\",\"enabled\":\"[01]\",\"domain\":\"$1\",\"name\":\"$2\",\"type\":\"TXT\",\"value\":\"$3\"" | cut -d ':' -f 2 | cut -d '"' -f 2)
|
||||||
|
|
||||||
if [ -n "$_uuid" ]; then
|
if [ -n "$_uuid" ]; then
|
||||||
_debug uuid "$_uuid"
|
_debug uuid "$_uuid"
|
||||||
|
Loading…
Reference in New Issue
Block a user