Multiple Dynamic DNS with Cloudflare

I’ve got two domains that I want to run Dynamic DNS for hosted with Cloudflare, but I’m having difficulty getting them both set up. Initially, I tried a configuration that looked like this based on recommendations for multiple domains with other providers:

service cloudflare {
	host-name 1.firstdomain.com
	host-name 2.seconddomain.com
	login <email>
	password <api key>
	protocol cloudflare
	zone firstdomain.com
}

That configuration worked for the first domain, but because Cloudflare specifically requires that zone property, the second domain was stuck on noconnect status. I tried a second solution others had recommended in the past allowing multiple configs for the same provider, with the configuration looking like this:

service cloudflare {
	host-name 1.firstdomain.com
	login <email>
	password <api key>
	protocol cloudflare
	zone 1.firstdomain.com
}
service custom {
    host-name 2.seconddomain.com
    login <email>
    password <api key>
    protocol cloudflare
    server cloudflare.com
    zone seconddomain.com
}

However, I was unable to commit those changes and received the following validation error "zone" option only supported with CloudFlare. It seems like the validation logic is basing the usage of that field off of the service name and not the protocol even though any configuration using that protocol needs the zone field.

Is there any workaround for this, is this a validation bug, or am I totally off base and just doing something wrong?

I did a little digging through the code handling this validation, and this seems like a bug to me.

https://github.com/vyos/vyos-1x/blob/current/src/conf_mode/dynamic_dns.py#L117

The validation is only allowing the zone field to be set if the service name is cloudflare, when it should be allowing any custom service name as long as the protocol is set to cloudflare. It seems like it’s a fairly trivial validation fix and I’d love to do it myself, but I have no idea how to actually build the OS with my changes and test.

@fortinj1354 Just edit that file on the router

sudo nano -c +116 /usr/libexec/vyos/conf_mode/dynamic_dns.py

And restart one service:

sudo systemctl restart vyos-configd

Ah ok, I tried modifying the file but had to reboot to get it to apply. The fix does work though, just waiting on user account approval on Phabricator so I can make a ticket and a pull request for it.

1 Like

Just in case anyone stumbles across this in the future: ⚓ T3422 Dynamic DNS doesn't allow zone field with cloudflare protocol

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.