Hi,
I recently switched to porkbun where I have a subdomain configured for my home network address. I tried to configur the OpenWrt DDNS Service using a custom profile, but I could not manage to get the update URL right.
There is a shell script which works. This is the correct call to the API:
One thing is that in the API call you use https, in the DDNS you have http.
Another thing is that in DDNS you have domain HOST.DOMAIN.COM while in the update_url it is broken into DOMAIN.COM/A/HOST
Also curl error 3 is malformed url, so verify that the url is correct.
Thanks for the very quick response!
You are right about https - but according to the documentation this is handled by use_https '1'. And according to the log https is used.
You are also right about the url which is broken up. That's why I hardcoded that part into the update_url.
According to your tip about the malformed url I tried to find out what is acutally sent to the server. The log shows the following:
Thank you for your assistance! So - as far as I understand the updater it is not possible to send the command which would be necessary to update porkbun dns. As a fallback I wrote a script which is called periodically:
#!/bin/sh
apikey=
apisec=
domain=
record=
olddns=$(curl -s -X POST "https://porkbun.com/api/json/v3/dns/retrieveByNameType /$domain/A/$record" \
-H "Content-Type: application/json" \
--data "{ \"apikey\": \"$apikey\", \"secretapikey\": \"$apisec\" }" | gr ep -oE 'content":"[0-9.]*' | grep -oE [0-9.]*)
ourip=$(ip -4 addr show eth1 | sed -Ene 's/^.*inet ([0-9.]+)\/.*$/\1/p')
# update dns record if necessary
if [[ $olddns != $ourip ]]; then
curl -X POST "https://porkbun.com/api/json/v3/dns/editByNameType/$domain/A/$re cord" \
-H "Content-Type: application/json" \
--data "{ \"apikey\": \"$apikey\", \"secretapikey\": \"$apisec\", \"content\ ": \"$ourip\", \"ttl\": \"300\" }"
fi