Skip to content

Instantly share code, notes, and snippets.

@haydenmc
Created July 30, 2023 23:57
Show Gist options
  • Save haydenmc/609c9401b11b9c915801534fc4bd3db5 to your computer and use it in GitHub Desktop.
Save haydenmc/609c9401b11b9c915801534fc4bd3db5 to your computer and use it in GitHub Desktop.
Porkbun DNS Record Update Script for my Synology Router
API_KEY=PORKBUNAPIKEYHERE
API_SECRET=PORKBUNAPISECRETHERE
IP4_ADDR=$(ip -4 addr show eth0 | grep -oE '([0-9]{1,3}\.){3}([0-9]{1,3})')
IP6_ADDR=$(ip -6 addr show eth0 | grep -oE '([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})')
curl --header "Content-Type: application/json" \
--request POST \
--data '{
"apikey" : "'"$API_KEY"'",
"secretapikey" : "'"$API_SECRET"'",
"content" : "'"$IP4_ADDR"'",
"ttl" : "600"
}' \
https://porkbun.com/api/json/v3/dns/editByNameType/your.domain/A
curl --header "Content-Type: application/json" \
--request POST \
--data '{
"apikey" : "'"$API_KEY"'",
"secretapikey" : "'"$API_SECRET"'",
"content" : "'"$IP6_ADDR"'",
"ttl" : "600"
}' \
https://porkbun.com/api/json/v3/dns/editByNameType/your.domain/AAAA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment