fire1ce / DDNS-Cloudflare-Bash

Cloudflare DDNS bash Script for most Linux distributions and MacOS. Choose any source IP address to update external or internal (WAN/LAN). Cloudflare's options proxy and TTL configurable via the parameters.
https://3os.org
261 stars 61 forks source link

API issue #5

Closed ptzit closed 2 years ago

ptzit commented 2 years ago

root@TESTSRV:~# update-cloudflare-dns ==> 2022-05-26 21:38:05 ==> External IP is: 99.88.77.66 ==> DNS record of sub.somedomain.tld is: 12.34.56.78. Trying to update... {"success":false,"errors":[{"code":7003,"message":"Could not route to \/zones\/somedomain.tld\/dns_records, perhaps your object identifier is invalid?"},{"code":7000,"message":"No route for that URI"}],"messages":[],"result":null} Error! Can't get sub.somedomain.tld record inforamiton from cloudflare API

fire1ce commented 2 years ago

Did you create the subdomain recored in cloudflare?

ptzit commented 2 years ago

Yes, of course. subdomain was created before I used this script (was experimenting with ddclient prior trying this script).

fire1ce commented 2 years ago

To be honest i didn’t seen this type of error from cloudflare. I suspect it maybe a Access token permission that not allow to get the cloudflare dns zone info.

ptzit commented 2 years ago

Tried even global api key but no luck. Rolled the DNS Zone API key and changed in config file - still the same issue happens.

fire1ce commented 2 years ago

would you mind posting your config with dedicated api key? i would like to test it with my domain.

fire1ce commented 2 years ago

Deducted Api key. sorry

ptzit commented 2 years ago


## Which IP should be used for the record: internal/external
## Internal interface will be chosen automaticly as a primary default interface
what_ip="external"
## DNS A record to be updated
dns_record="sub.somedomain.tld"
## Cloudflare's Zone ID
zoneid="somedomain.tld"
## Cloudflare Zone API Token
cloudflare_zone_api_token="xxxxxxxxxxxxxxxxxxxxxxxxxx"
## Use Cloudflare proxy on dns record true/false
proxied="false"
## 120-7200 in seconds or 1 for Auto
ttl=1

## Telegram Notifications yes/no (only sent if DNS is updated)
notify_me_telegram="no"
## Telegram Chat ID
telegram_chat_id="ChangeMe"
## Telegram Bot API Key
telegram_bot_API_Token="ChangeMe"`

also, I tested the cloudflare API token for DNS zone by pasting the curl code from cloudflare into console - it throws no errors.
fire1ce commented 2 years ago

thanks. ill test it in the next few days. Not sure about the cause of the error based on the configuration.

fire1ce commented 2 years ago

oh i think i spot the problem. your zone ID is not the domain. you have the id number in the dash of cloudflare. this should solve the problem

ptzit commented 2 years ago

I found it out by myself too - now script throws no errors but doesn't update DNS records.

It says success but when I check DNS record on cloudflare dash - nothing changed...

ptzit commented 2 years ago

I believe I found out the reason it didn't work for me - Cloudflare dropped API support for Freenom TLDs.

"You cannot use this API for domains with a .cf, .ga, .gq, .ml, or .tk"

But anyway, let me suggest an edit to the script; Now, it requires (and uses): -H "X-Auth-Email: some@mail.com" \ -H "X-Auth-Key: sometokenkey" \

perhaps it could be simpler to use: -H "Authorization: Bearer sometokenkey" \

Thank you for the replies and prompt assistance. Wish you the best.