OPNsense Forum

Archive => 23.7 Legacy Series => Topic started by: bunchofreeds on July 21, 2023, 01:55:18 AM

Title: os-ddclient with Cloudflare API token
Post by: bunchofreeds on July 21, 2023, 01:55:18 AM
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.

Title: Re: os-ddclient with Cloudflare API token
Post by: bunchofreeds on July 21, 2023, 03:21:01 AM
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.

Title: Re: os-ddclient with Cloudflare API token
Post by: bunchofreeds on July 21, 2023, 03:37:36 AM
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?
Title: Re: os-ddclient with Cloudflare API token
Post by: julsssark on July 21, 2023, 07:58:07 AM
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.
Title: Re: os-ddclient with Cloudflare API token
Post by: bunchofreeds on July 23, 2023, 10:48:31 PM
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 :)
Title: Re: os-ddclient with Cloudflare API token
Post by: julsssark on July 24, 2023, 06:39:09 AM
Yes, the columns update correctly using the OPNsense backend. I had the same problem you have with the ddclient backend.
Title: Re: os-ddclient with Cloudflare API token
Post by: jclendineng on July 24, 2023, 02:02:02 PM
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
Title: Re: os-ddclient with Cloudflare API token
Post by: 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.
Title: Re: os-ddclient with Cloudflare API token
Post by: bunchofreeds on July 24, 2023, 10:14:40 PM
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 :)
Title: Re: os-ddclient with Cloudflare API token
Post by: bunchofreeds on July 24, 2023, 10:21:32 PM
@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?
Title: Re: os-ddclient with Cloudflare API token
Post by: jclendineng on July 25, 2023, 02:50:43 PM
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
Title: Re: os-ddclient with Cloudflare API token
Post by: Homeyer on February 26, 2024, 12:51:25 PM
It can be difficult to manage Cloudflare API tokens without using the Global API key.
Have you considered using third party api integration services (https://seclgroup.com/third-party-api-integration/)? 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.