Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
I'm quite new to attempting to dynamically update DNS from my environemt to anything really out there and wanted to learn. Few questions and some errors I came across with some issues and I've googled/researched in general for trying to resolve it and come up with more and more issues. anyways, here is what it is:
Using - Ubuntu server 22.04
DNS Service - BIND9
Dynamic DNS handled - DDCLIENT (or I would like to just use
cron
with the CF API preferred from bash)
Start:
So i (heavan forbid) used openAI (and explored online forums/CF Forums/API docs and git repos) attempting to configure DDNS with the CF API to push up to my domain to update my IP Address dynamically along with any DNS Records when applicable on my system. It has failed thus far with:
{"success":false,"errors":[{"code":10000,"message":"PUT method not allowed for the api_token authentication scheme"}]}
Permissions configured in CF are:
Zone - Zone - READ
Zone - DNS - Edit
Registrar is from - Squarespace
Name servers are on - Cloudflare
and is also handling all DNS records
Am i missing anything? I can post script at the bottom excluding/blanking information
End goal:
Dynamically Update public IP address from UDM Pro to CF with API
Update DNS records from my on-prem DNS server upstream/downstream to CF and my on-prem DNS server
Thanks!8 Replies
The related script from the output displayed in post:
Related error output from above script:
{"success":false,"errors":[{"code":7001,"message":"Method PUT not available for that URI."}],"messages":[],"result":null}
also received prior to modifications from OG post:
{"success":false,"errors":[{"code":10000,"message":"PUT method not allowed for the api_token authentication scheme"}]}
(commented out section was the portion of where the permission error code 10000
was presented in the script. wanted to keep in the event i missed something)
Using CF Docs from custom SOA error, its from this script:
Error output is as stated:
{"result":null,"success":false,"errors":[{"code":1003,"message":"Custom SOA records are not available to this account or zone. Contact support for more information."}],"messages":[]}
(this was a copy/paste with mods ofc from the CF API docs i found)That script doesn't make any sense. You commented out the DNS Update, which if erroring before with "PUT method not allowed for the api_token authentication scheme" means it wasn't finding the record (ignore that it's a terrible error), and it's now trying to do a PUT with dns record contents to tokens/verify?
fwiw if you give it the right record name and uncomment the put to dns_records and remove the put to tokens/verify it does work fine
not sure how that relates to your other issues, but yea not going to be able to modify the soa, think would need secondary dns enterprise setup or some other enterprise setup, what are you trying to do?
Essentially update my public IP address from my local DNS server to CF
Also being able to automate and update/add records to CF from the DNS server using Ubuntu and DD client (BIND9 as DNS service)
Sorry still new and I tried to read docs of the API prior to asking (cron will be used to schedule automation)
ahhh ok, yea won't be able to touch the SOA records, managed automagically by CF, can do the rest though
Figures... This is why I don't like using AI lol
Got any actual useful docs by any chance?
(it's pretty damn obv I have no clue what I'm doing to be frank)
The new api docs are at https://developers.cloudflare.com/api-next/resources/dns/subresources/records/methods/batch/ which aren't perfect but better, some of the errors like invalid dns record are a bit eh
Cloudflare API | DNS › Records › Batch DNS Records
Interact with Cloudflare's products and services via the Cloudflare API
dns records aren't too confusing I don't think though, it's hacky but ultimately everything in Cloudflare's dashboard/UI goes through the API with the same endpoints and bodies, so if you pop open dev tools and network tab while you create/look at dns records, you can see what it does
Gotcha, much appreciated! I'll look tomorrow, I've dealt with ES, logstash and LLM databases enough today lol, I'll take a look tomorrow.
Fyi - as someone who tried configuring cuckoo sandbox for 9 months and failing, it's okay lol. I'm sure I'll figure it out with /var/logs if possible or my logs in elastic search
(Waiting for my domain to move from square space to CF at the moment)