Update certs.inc
This commit is contained in:
@@ -53,7 +53,17 @@ NEWCERT(){
|
||||
|
||||
if [ "${NM_PDNS_USER}" != "" ] && [ "${NM_PDNS_PASS}" != "" ] && [ "${SOMETHING}" == "SOMETHING" ]; then
|
||||
echo -en "${idsCL[LightCyan]}Verifying WAN DNS record ... "
|
||||
/usr/bin/curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${NM_PDNS_WANDNS}/nic/update?hostname=${MAIN_CERT}&myip=${NEWIP}" > /dev/null 2>&1
|
||||
CERTDOMAIN=$(echo ${MAIN_CERT} |awk -F. '{$1="";OFS="." ; print $0}' | sed 's/^.//' | sed 's/ /./g')
|
||||
if [ "$(curl -sH "Content-Type: application/json" -H "X-API-Key: ${NM_PDNS_APIKEY}" https://${NM_PDNS_WANDNS}/api/v1/servers/localhost/zones/${CERTDOMAIN} | jq | grep "${MAIN_CERT}")" != "" ]; then
|
||||
#UPDATE
|
||||
cDATA="'{\"rrsets\": [ {\"name\": \"${MAIN_CERT}.\", \"type\": \"CNAME\", \"ttl\": 3600, \"changetype\": \"REPLACE\", \"records\": [ {\"content\": \"${NM_PDNS_RP_HOSTNAME}\", \"disabled\": false, \"name\": \"${MAIN_CERT}.\", \"ttl\": 3600, \"type\": \"CNAME\"}]}]}'"
|
||||
curl -H 'Content-Type: application/json' -X PATCH --data ${cDATA} -H "X-API-Key: ${NM_PDNS_APIKEY}" https://${NM_PDNS_WANDNS}/api/v1/servers/localhost/zones/${CERTDOMAIN} | jq .
|
||||
else
|
||||
#ADD
|
||||
cDATA="'{\"rrsets\": [ {\"name\": \"${MAIN_CERT}.\", \"type\": \"CNAME\", \"ttl\": 3600, \"changetype\": \"REPLACE\", \"records\": [ {\"content\": \"${NM_PDNS_RP_HOSTNAME}\", \"disabled\": false } ] } ] }'"
|
||||
curl -H 'Content-Type: application/json' -X PATCH --data ${cDATA} -H 'X-API-Key: ${NM_PDNS_APIKEY}' https://${NM_PDNS_WANDNS}/api/v1/servers/localhost/zones/${CERTDOMAIN} | jq .
|
||||
fi
|
||||
# curl -s "https://${NM_PDNS_USER}:${NM_PDNS_PASS}@${NM_PDNS_WANDNS}/nic/update?hostname=${MAIN_CERT}&myip=${NEWIP}" > /dev/null 2>&1
|
||||
echo -e "${idsCL[LightGreen]}Done${idsCL[Default]}"
|
||||
echo
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user