os-ddclient with Cloudflare API token

Started by bunchofreeds, July 21, 2023, 01:55:18 AM

Previous topic - Next topic
Hi,
Looking forward to updating to the next release 23.7 and thought I'd try os-ddclient again in preparation.

Seems I'm struggling again getting it to work with a Cloudflare API token.

Is anyone able to to get this to work and perhaps provide a detailed config to get it running.
I'm trying to update two names using two separate API keys.
I'd prefer not to have to use the Global API key for this.


Got further...

https://github.com/opnsense/plugins/issues/2842

You have to leave the username field empty (not very intuitive at all)

Now I'm getting the - No 'A' record at Cloudflare - error even though I do have an existing A record.


July 21, 2023, 03:37:36 AM #2 Last Edit: July 21, 2023, 03:46:23 AM by bunchofreeds
Further again...

Hostname field needs to be FQDN

Verbose logging states SUCCESS for updating IP
Whereas the GUI for os-ddclient is blank for Current IP and when it Updated...

So possibly working, won't know until my IP changes.

Does anyone know if os-ddclient will get a Widget for the dashboard so we can see update info more easily?

Try setting the username to 'token' (without quotes) and the password to the API key. I use this setting with the OPNsense python backend and it works great under 23.1. I have not upgraded to 23.7 yet.

Thanks @julsssark

Does your Dynamic DNS>Settings>Accounts page show 'Current IP' and 'Updated' entries?
Mine are blank?

I'll give token a go for the username, although my logs currently say SUCCESS and that it has skipped because the IP is already set. That is with no username set.
That link I posted has a couple of people saying either blank or token work.

Thankfully my IP doesn't rotate very often, which is annoying for testing this :)

Yes, the columns update correctly using the OPNsense backend. I had the same problem you have with the ddclient backend.

July 24, 2023, 02:02:02 PM #6 Last Edit: July 24, 2023, 02:09:00 PM by jclendineng
Following this thread, I have switched 2 domains and it seems to work. Need an IP change to test, but looks like it updated A records.

Also, why aren't you using Argo Tunnels ;) removes the need for dynamic DNS updates.

Edit: Current IP and Updated do not populate, looking into potential causes

Are you using the OPNsense backend? Services->Dynamic DNS->General Settings? I could not get the columns to update without switching the backend.

Thanks again @julsssark

I changed to the OPNsense backend and restarted the plugin.
Columns now have updated.

I had two hostnames being updated using a single Account/API Token with the dd-client backend.
This breaks when using the OPNsense backend with a 'DNS name is invalid' error in the logs.
Only seems to work when using a single hostname.
Looks like I will need to split these into to separate requests.

Thanks again, seems to be working.

Now hopefully a Widget for the dashboard will be available :)

@jclendineng do you create an Argo Tunnel per server/hostname or do you have a way of terminating the tunnel at OPNsense.
I played around with those a while ago and got one working, just felt quite complicated then. maybe it's better/easier now?

Quote from: julsssark on July 24, 2023, 05:31:45 PM
Are you using the OPNsense backend? Services->Dynamic DNS->General Settings? I could not get the columns to update without switching the backend.

I am using backend, still no dice, I am going to uninstall and re-install and see if that fixes anything - RC2 here

February 26, 2024, 12:51:25 PM #11 Last Edit: February 29, 2024, 12:10:35 PM by Homeyer
It can be difficult to manage Cloudflare API tokens without using the Global API key.
Have you considered using third party api integration services? When it comes to personalizing the way you connect various platforms—in your case, Cloudflare—they're pretty cool. They may have the ideal solution for you, enabling you to more easily manage those domain names separately.
Finding the ideal configuration is always a bit of a treasure hunt, but these services might provide an easier way. In addition, it would be fantastic to find out if anyone else has figured out the code and can provide a step-by-step guide for setting everything up.