This commit is contained in:
2023-12-28 11:31:45 -06:00
parent b62963b04f
commit 5f5bc4cb7f
2 changed files with 5 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
VERS='5.1.42-12282023'
VERS='5.1.43-12282023'
NM_BETA=false
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update log betacheck '

View File

@@ -56,14 +56,13 @@ NEWCERT(){
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 .
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}
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 .
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}
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