Kilrah Posted July 26, 2022 Share Posted July 26, 2022 (edited) [Template only, I am not the container author/maintainer] Template: https://github.com/kilrah/unraid-docker-templates/blob/main/templates/cloudflare-ddns-config.xml Source container: https://github.com/timothymiller/cloudflare-ddns Registry: https://hub.docker.com/r/timothyjmiller/cloudflare-ddns I've moved my DNS to Cloudflare, and found out that ddclient which I was using before just does not work anymore with Cloudflare's current API. There are already a few Cloudflare-DDNS containers in CA but they all have you enter settings as template variables, which makes it either impossible or impractical to enter multiple zones and a large number of subdomains. Looked for something more suitable to my situation and found timothymiller's container that works off a JSON config file that is a lot more manageable in such cases. Important: As this container uses a file mount for the config file before installing/running it you need to preload a sample config, in Unraid's terminal: mkdir /mnt/user/appdata/cloudflare-ddns-config wget -qO /mnt/user/appdata/cloudflare-ddns-config/config.json https://github.com/timothymiller/cloudflare-ddns/raw/master/config-example.json And obviously edit it to your needs. If you started the container without doing that first Docker will create a folder, you have to stop the container, delete the folder and get the file before restarting. Edited February 10 by Kilrah Quote Link to comment
derriang Posted July 30, 2022 Share Posted July 30, 2022 how did you get the container to auto run to update ? Quote Link to comment
Kilrah Posted July 31, 2022 Author Share Posted July 31, 2022 (edited) It should be left running in the background and it will check IP/update if necessary every 5 minutes. EDIT: Looks like the container got an update a few hours ago to fix an issue with the root domains but got broken in the process. EDIT2: Was fixed a couple of days later. Edited October 26, 2022 by Kilrah Quote Link to comment
mjeshurun Posted November 1, 2022 Share Posted November 1, 2022 Hi Friends, Thank you for maintaining this container. I'm a noob so my question might seem obvious to programmers, but can someone, please, share an example of the config-example.json file that includes info for two different domains? I saw the sample example-config.json file listed in the OP, but from what I understand it only includes info for 1 domain, so I'm not sure how to add the info of a second domain. Hope someone can help 🙏 Quote Link to comment
Kilrah Posted November 1, 2022 Author Share Posted November 1, 2022 (edited) You basically duplicate the whole thing inside the "cloudflare" block, based on the author's sample: { "cloudflare": [ { "authentication": { "api_token": "api_token_here", "api_key": { "api_key": "api_key_here", "account_email": "your_email_here" } }, "zone_id": "your_zone_id_here", "subdomains": [ { "name": "", "proxied": false }, { "name": "remove_or_replace_with_your_subdomain", "proxied": false } ] }, { "authentication": { "api_token": "2nd_api_token_here", "api_key": { "api_key": "2nd_api_key_here", "account_email": "your_email_here" } }, "zone_id": "your_2nd_zone_id_here", "subdomains": [ { "name": "", "proxied": false }, { "name": "remove_or_replace_with_your_subdomain", "proxied": false }, { "name": "remove_or_replace_with_another_subdomain", "proxied": true } ] } ], "a": true, "aaaa": true, "purgeUnknownRecords": false } You'll typically only use one of the 2 authentication methods, remove the other one Edited November 1, 2022 by Kilrah 1 Quote Link to comment
mjeshurun Posted November 1, 2022 Share Posted November 1, 2022 Thank you very much! @Kilrah. I will try to setup the container based on your example. The app installation created two folders for the container. Main folder: cloudflare-ddns-config. Subfolder: config.json Should I save the config.json file inside the config.json folder? Quote Link to comment
Kilrah Posted November 1, 2022 Author Share Posted November 1, 2022 You didn't read the "important" note from the template/first post. Stop the container, delete the config.json folder and download the sample file. Quote Link to comment
mjeshurun Posted November 1, 2022 Share Posted November 1, 2022 10 minutes ago, Kilrah said: You didn't read the "important" note from the template/first post. Stop the container, delete the config.json folder and download the sample file. Thanks for the clarification 🙏 The "important" note in the OP actually doesn't say to delete the folder. That's why I asked Quote Link to comment
Kilrah Posted November 1, 2022 Author Share Posted November 1, 2022 Well no because it says "before running the container" precisely so that wrong folder doesn't get created. 1 Quote Link to comment
mjeshurun Posted November 1, 2022 Share Posted November 1, 2022 (edited) 5 minutes ago, Kilrah said: Well no because it says "before running the container" precisely so that wrong folder doesn't get created. If I'm not mistaken, UnRAID automatically tries to start new docker containers once their installation process is finished. I assume that's why the folder was already there, when I tried to follow the important note directions. Because I didn't ran the container. Edit: Ohhhhhhhh now I see you meant that we need to run the important note commands even *before installing* the container. I thought I needed to run the important note commands after installation but before running the container. My bad. Sorry for missing this 🙏🙏 Edited November 1, 2022 by mjeshurun Quote Link to comment
Kilrah Posted November 1, 2022 Author Share Posted November 1, 2022 6 minutes ago, mjeshurun said: If I'm not mistaken, UnRAID automatically tries to start new docker containers once their installation process is finished. Yes, hence On 7/26/2022 at 12:32 PM, Kilrah said: before installing/running it you need to preload a sample config 1 Quote Link to comment
mjeshurun Posted November 1, 2022 Share Posted November 1, 2022 1 minute ago, Kilrah said: Yes, hence My bad. Sorry for missing this 🙏🙏 Quote Link to comment
mjeshurun Posted November 1, 2022 Share Posted November 1, 2022 I'm seeing an error message in the container log: error reading config.json Did I make a mistake filling my info? { "cloudflare": [ { "authentication": { "api_token": "***************", }, "zone_id": "eatingheads.com", "subdomains": [ { "name": "", "proxied": true }, { "name": "www", "proxied": true } ], }, { "authentication": { "api_token": "******************", }, "zone_id": "vicktoriasmirnoff.com", "subdomains": [ { "name": "", "proxied": true }, { "name": "www", "proxied": true } ], }, ], "a": true, "aaaa": false, "purgeUnknownRecords": false } Quote Link to comment
Kilrah Posted November 1, 2022 Author Share Posted November 1, 2022 There are a few stray commas, basically the last element in a block must not have one. Try this... { "cloudflare": [ { "authentication": { "api_token": "***************", }, "zone_id": "eatingheads.com", "subdomains": [ { "name": "", "proxied": true }, { "name": "www", "proxied": true } ] }, { "authentication": { "api_token": "******************", }, "zone_id": "vicktoriasmirnoff.com", "subdomains": [ { "name": "", "proxied": true }, { "name": "www", "proxied": true } ] } ], "a": true, "aaaa": false, "purgeUnknownRecords": false } Quote Link to comment
mjeshurun Posted November 1, 2022 Share Posted November 1, 2022 (edited) Thank you. I tried to copy/paste the file info you just sent me and added my api tokens, but I'm still seeing the error message in the container log Edited November 1, 2022 by mjeshurun Quote Link to comment
NewDisplayName Posted February 8, 2023 Share Posted February 8, 2023 (edited) If i may suggest everyone will start it first and will have the same problem, you could have saved some ppl some time and just write to it, "if you startet it before creating, remove folder." Its very unusual that you need to do it before installing. Could also be automatic be done? and just btw, your provided config is (still) not working. you cant leave out the api key. but still twith that, it wont work. (i didnt found a working solu tion for multiple domains, and even the documentation doesnt show an example...) Edited February 8, 2023 by nuhll Quote Link to comment
NewDisplayName Posted February 8, 2023 Share Posted February 8, 2023 Ha i found it { "cloudflare": [ { "authentication": { "api_token": "XXXXXX", "api_key": { "api_key": "api_key_here", "account_email": "your_email_here" } }, "zone_id": "XXX", "subdomains": [ { "name": "", "proxied": true }, { "name": "www", "proxied": true }, { "name": "forum", "proxied": true } ], "zone_id": "XXXXXX", "subdomains": [ { "name": "", "proxied": true }, { "name": "www", "proxied": true } ] } ], "a": true, "aaaa": true, "purgeUnknownRecords": false, "ttl": 300 } Quote Link to comment
NewDisplayName Posted February 13, 2023 Share Posted February 13, 2023 just for the lolz, this config works that way that it wont complain about it, but it also will only update the first.... my head cant understand why you publish such a tool without proper guide and or... i opend a issue, for now i just create 22 different dockers Quote Link to comment
Kilrah Posted February 13, 2023 Author Share Posted February 13, 2023 (edited) I have one "authentication" section for each zone and it's fine. { "cloudflare": [ { "authentication": { "api_token": "auth1" }, "zone_id": "zone1", "subdomains": [ { "name": "", "proxied": false }, { "name": "sub1", "proxied": false } ] }, { "authentication": { "api_token": "auth2" }, "zone_id": "zone2", "subdomains": [ { "name": "", "proxied": false }, { "name": "sub1", "proxied": false }, { "name": "sub2", "proxied": false } ] }, { "authentication": { "api_token": "auth3" }, "zone_id": "zone3", "subdomains": [ { "name": "", "proxied": false }, { "name": "sub1", "proxied": false } ] } ], "a": true, "aaaa": false, "purgeUnknownRecords": false, "ttl": 300 } Edited February 13, 2023 by Kilrah 1 Quote Link to comment
mjeshurun Posted February 13, 2023 Share Posted February 13, 2023 1 minute ago, Kilrah said: I have one "authentication" section for each zone and it's fine. Can you please share an example of your config file? 🙏 Quote Link to comment
Kilrah Posted February 13, 2023 Author Share Posted February 13, 2023 Just edited the post above 1 Quote Link to comment
mjeshurun Posted February 15, 2023 Share Posted February 15, 2023 On 2/13/2023 at 2:39 PM, Kilrah said: I have one "authentication" section for each zone and it's fine. { "cloudflare": [ { "authentication": { "api_token": "auth1" }, "zone_id": "zone1", "subdomains": [ { "name": "", "proxied": false }, { "name": "sub1", "proxied": false } ] }, { "authentication": { "api_token": "auth2" }, "zone_id": "zone2", "subdomains": [ { "name": "", "proxied": false }, { "name": "sub1", "proxied": false }, { "name": "sub2", "proxied": false } ] }, { "authentication": { "api_token": "auth3" }, "zone_id": "zone3", "subdomains": [ { "name": "", "proxied": false }, { "name": "sub1", "proxied": false } ] } ], "a": true, "aaaa": false, "purgeUnknownRecords": false, "ttl": 300 } Hi @Kilrah, thank you for posting an example of your config file. I'm seeing the following error message repeatedly in the container's log, when I try to build my config file based on yours. Obviously, I used my own api-token and zone address. For the sake of privacy I change the actual zone address in the log error quote to "********.com". 😡 Error sending 'GET' request to 'https://api.cloudflare.com/client/v4/zones/********.com': {"result":null,"success":false,"errors":[{"code":7003,"message":"Could not route to /client/v4/zones/********.com, perhaps your object identifier is invalid?"}],"messages":[]} Do you have any idea why this error is happening? Quote Link to comment
Kilrah Posted February 15, 2023 Author Share Posted February 15, 2023 I do get some occaisional Service Unavailable and other 404 and errors in the logs, seems the CF service isn't extremely reliable... See if it gets better with time. Of courrse check your zone id/token and that the token has the correct permissions on the zone. Quote Link to comment
mjeshurun Posted February 15, 2023 Share Posted February 15, 2023 8 hours ago, Kilrah said: I do get some occaisional Service Unavailable and other 404 and errors in the logs, seems the CF service isn't extremely reliable... See if it gets better with time. Of courrse check your zone id/token and that the token has the correct permissions on the zone. I've double checked my zone_id and the api_token password and they are correct. Are these the correct token permissions I should set? Zone Settings:Read, Zone:Read, DNS:Edit Quote Link to comment
Kilrah Posted February 16, 2023 Author Share Posted February 16, 2023 I've made 3 tokens that only have the DNS Edit, one for each zone: 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.