DynamicDNS with Cloudflare

I need assistance configuring dynamic DNS to work with cloudflare. I’ve seen several examples of how to get it to work by manually configuring the ddclient config file, but nothing on how to make it work using the VyOS cli. It doesn’t seem like the connection to cloudflare is being established (see update-status below) and cloudflare shows the api token not being accessed yet.

vyos@vyos:~$ show dns dynamic status
ip address :
host-name : host.mydomain.com
last update : 1970-01-01 00:00:00
update-status: noconnect

vyos@vyos# show service dns dynamic 
 interface eth0 {
     service cloudflare {
         host-name lab.mikeassel.com
         login me@gmail.com
         password my-cloudflare-api-key
         protocol cloudflare
         server www.cloudflare.com
         zone mydomain.com
     }
     use-web {
         skip "Current IP Address: "
         url http://checkip.dyndns.com/
     }
 }

Hi @mikeassel,

which VyOS version do you use? Also setting server should not be required as you already selected the cloudflare protocol. There have been some issue with v4 cloudflare API and none of us was able to properly test it so this could also be indeed a bug.


CP

I was initially on 1.2.4 then upgraded to 1.3-rolling-202003231200 in order to see if it made a difference. If there is anything I can do to help test please let me know.

Can you remove the serverstatement and try again? also have a close log at $ monitor log and see ddclient messages

It seems that the wrong auth header is being used. Authorization: Bearer mykey should be used instead of X-Auth-Key: mykey
I tried to post more details but got a warning that new users can only post two URLs :stuck_out_tongue:

From where you got that information? monitor log Could it be that cloudflare changed its API again? Or ist it possible to get a login to CloudFlare to perfom some tests on our side?

monitor log actually showed nothing regarding ddclient. To see the api request and response I used ddclient -daemon=0 -debug -verbose -noquiet. I then used curl to replicate the same error using the same auth header that vyos uses, then used curl again to make a successful connection using Authorization: Bearer mykey

You can create a cloudflare account for free to test with, but I’m happy to create an api key on my account for you to test with if you’d like.

I was able to get this working. The first issue was that I was trying to use the api token as the password, not the api key. Once I put in the correct key they ddclient was able to connect and change the IP in cloudflare. However, ddclient was changing the IP to the actual IP of the interface, even though I had configured use web with a URL and web-skip in the vyos cli. For some reason the ddclient.conf file still showed use=if. I manually edit the file with use=web, web=checkip.dyndns.com, web-skip='IP Address' and then after that it picked up my public IP address.

Thanks for keeping us updated and good to hear it is now working for you. There was a bug in the use-web functionality which has been fixed some days ago.

So 1.3-rolling-202003231200 should not have the use-web bug?

It was fixed here, T2152 fix to allow external IP usage to work · vyos/vyos-1x@fce4ab0 · GitHub

so you should try any version after the 23rd of March.