joshuaavalon/SynologyCloudflareDDNS

Broken?

Closed this issue · 14 comments

Hi,

i followed your installation steps 2 times and i always get:

authentication failed

I checked zone DNS and token 3 Times they are working. Also my hostname exists.

Any help would be good.

Thank you

worked 2 days ago with same setup - stopped working yesterday

worked 2 days ago with same setup - stopped working yesterday

If it works 2 days ago, you should check the changes on your side. Nothing has changed in the script or Cloudflare API

me too. always authentication failed

You should try the following command and paste the result here.

curl -s -X GET "https://api.cloudflare.com/client/v4/zones/${username}/dns_records?type=${recordType}&name=${hostname}" -H "Authorization: Bearer ${password}" -H "Content-Type:application/json"

You should replace ${username}, ${password}, ${recordType} and ${hostname} with corresponding values.

i have tried this.my api is ok

@zuijiasy So, it may either fail

res=$(curl -s -X POST "$createDnsApi" -H "Authorization: Bearer $password" -H "Content-Type:application/json" --data "{\"type\":\"$recordType\",\"name\":\"$hostname\",\"content\":\"$ipAddr\",\"proxied\":$proxy}")

or

res=$(curl -s -X PUT "$updateDnsApi" -H "Authorization: Bearer $password" -H "Content-Type:application/json" --data "{\"type\":\"$recordType\",\"name\":\"$hostname\",\"content\":\"$ipAddr\",\"proxied\":$proxy}")

You can either try the curl commands in the script one by one or change

to

echo "$res";

This should output the JSON in Synology notification.

Kovah commented

I updated to DSM 6.2.3-25426 yesterday.
The script got deleted by the update, so I installed it again. When run from the command line with all required parameters, it works perfectly and updates the DNS entries. But when added trough the DSM, it stays in the "Loading..." state for like 1 minute and then aborts with the error "Operation failed".

Tried to debug this by adding an echo statement with the parameters to a log file. Nothing gets written to the log file. Might this be an issue with how the DSM handles the update scripts?

@Kovah Does it have the right permission?

Kovah commented

I applied the permissions mentioned in the readme, currently 755 which grants execution to everyone.

Do you have an idea how to properly debug those scripts?

Just checked it myself with running the script through putty and adding echos, you will get this error message if you use one of these TLDs.
"error": "You cannot use this API for domains with a .cf, .ga, .gq, .ml, or .tk TLD (top-level domain). To configure the DNS settings for this domain, use the Cloudflare Dashboard."

This is a recent change, look here: https://community.cloudflare.com/t/unable-to-update-ddns-using-api-for-some-tlds/167228

When running the script through putty and mannually adding the details in the script. The result is "good".
When running with the same details form the DSM: "operation failed" or "authentication error".
Details are all exactly the same. Am running DSM 6.2.3-25426.
Am using the latest script. Had to set proxy to false, before it worked in putty. But through the DSM no luck so far. (oh my domain ends with .org, so not the one blocked by cloudflare).

Sorry to say but there is really a bug in your script. Has anyone got this working? I found older script which allows multiple domains and that worked like charm. It seem your updated script, is not working with cloudflare.
Script that works: https://github.com/mrikirill/SynologyDDNSCloudflareMultidomain

Tried the curl command directly as you suggeste and this is the result:
{"result":[{"id":"xxxxxxxxxxxx","zone_id":"xxxxxxxxxx","zone_name":"xxxxxx","name":"xxxxxx","type":"A","content":"xxxxxxx","proxiable":true,"proxied":false,"ttl":1,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"created_on":"2020-06-07T20:46:59.718797Z","modified_on":"2020-06-07T20:46:59.718797Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":20,"count":1,"total_count":1,"total_pages":1}}

I blocked out the details. So the command works, it just doesn't work from the DSM.

Found the issue. Typed the insturctions for the DMS manually and made the mistake to refer to cloudflaredns.sh instead of cloudflareddns.sh. Missed a D there. Everything is working.

Is there a trick to update multiple DNS records at the same time or should I dublicate this little [cloudflare] block. About the script: It works like a charm. :D