OPNsense Forum

English Forums => 24.7, 24.10 Legacy Series => Topic started by: Eisai on August 18, 2024, 12:44:38 AM

Title: Multiple hostname in native-ddclient
Post by: Eisai on August 18, 2024, 12:44:38 AM
I am testing the ddclient plugin and found some unexpected behavior.

In my ddclient.json:
```
{
    "general": {
        "enabled": false,
        "verbose": false,
        "allowipv6": true,
        "daemon_delay": 300
    },
    "accounts": [
        {
            "id": "d9b8ec22-97b7-82e7-b133-971a4dcf3a7f",
            "service": "cloudflare",
            "protocol": "",
            "server": "",
            "resourceId": "",
            "username": '123@321.com",
            "password": "123456",
            "hostnames": "aaa.example.com,bbb.example.com,ccc.example.com",
            "wildcard": false,
            "zone": "example.com",
            "checkip": "web_ipify-ipv4",
            "interface": "hn0",
            "checkip_timeout": 10,
            "force_ssl": true,
            "ttl": "300",
            "description": "example.com cf"
        }
    ]
}
```

However, once the service runs, instead of updating the IP for 3 records, it will create a single recode like this:
aaa.example.com,bbb.example.com,ccc.example.com       1.2.3.4

If I switch the backend to the old ddclient, then it will process multiple hostnames properly but also makes ipv6 not work.
I assume the option "hostnames" means it can support multiple hostnames? so, how to properly set that?
Or, I have to set multiple configs for each hostname?

Thanks in advance!
Title: Re: Multiple hostname in native-ddclient
Post by: jjrushford on August 18, 2024, 06:32:37 AM
That hostnames looks like a JSON string.  Shouldn't it be an array of strings?
Title: Re: Multiple hostname in native-ddclient
Post by: jjrushford on August 18, 2024, 06:41:16 AM
Never mind the JSON strings, mine looks the same with multiple hostnames.  Yeah, I'm using ddclient also with cloudflare and mine are working fine.  I have multiple hostnames as well and it looks like yours.
Title: Re: Multiple hostname in native-ddclient
Post by: Eisai on August 18, 2024, 12:10:03 PM
Quote from: jjrushford on August 18, 2024, 06:41:16 AM
Never mind the JSON strings, mine looks the same with multiple hostnames.  Yeah, I'm using ddclient also with cloudflare and mine are working fine.  I have multiple hostnames as well and it looks like yours.
Thanks for reply!
are you also using old ddclient as backend or native?
Title: Re: Multiple hostname in native-ddclient
Post by: jjrushford on August 18, 2024, 02:37:00 PM
I'm on OPNsense 24.7.1 and I have os-ddclient 1.23 installed.  I only have two hostnames that I'm checking with dd-client.
Title: Re: Multiple hostname in native-ddclient
Post by: doktornotor on August 18, 2024, 03:11:09 PM
Quote from: Eisai on August 18, 2024, 12:44:38 AM
However, once the service runs, instead of updating the IP for 3 records, it will create a single recode like this:
aaa.example.com,bbb.example.com,ccc.example.com       1.2.3.4

Where? On Cloudflare? It's not even a valid hostname... Sounds like they are missing any validation whatsoever. Also, they cannot do CNAMEs so that you are updating one record instead of 3 -- or what's the grand idea here?
Title: Re: Multiple hostname in native-ddclient
Post by: jjrushford on August 18, 2024, 05:11:14 PM
Eisai, my hostnames are all DNS A records and no CNAME's.  Also, I had to manually create the A records beforehand as ddclient will not create them.
Title: Re: Multiple hostname in native-ddclient
Post by: Eisai on August 18, 2024, 07:11:32 PM
Quote from: doktornotor on August 18, 2024, 03:11:09 PM
Quote from: Eisai on August 18, 2024, 12:44:38 AM
However, once the service runs, instead of updating the IP for 3 records, it will create a single recode like this:
aaa.example.com,bbb.example.com,ccc.example.com       1.2.3.4

Where? On Cloudflare? It's not even a valid hostname... Sounds like they are missing any validation whatsoever. Also, they cannot do CNAMEs so that you are updating one record instead of 3 -- or what's the grand idea here?

Thanks for your reply!

Yes, on the Cloudflare DNS settings. For example, there are 3 of A records on cf, and none of them are CNAME:
aaa.example.com       1.2.3.4       A
bbb.example.com       1.2.3.4       A
ccc.example.com        1.2.3.4       A

once my configuration runs, the "aaa.example.com" will be replaced by "aaa.example.com,bbb.example.com,ccc.example.com", the other two remain untouched, resulting in this:
aaa.example.com,bbb.example.com,ccc.example.com       4.3.2.1       A
bbb.example.com       1.2.3.4       A
ccc.example.com        1.2.3.4       A

I lost access to the aaa.example.com so I found this issue :o
Title: Re: Multiple hostname in native-ddclient
Post by: doktornotor on August 18, 2024, 07:16:55 PM
Cloudflare should fix their sh*t. Other than that, if CNAME is impossible, create 3 separate entries in DynDNS, this apparently doesn't work properly with multiple hostnames.
Title: Re: Multiple hostname in native-ddclient
Post by: Eisai on August 18, 2024, 07:20:19 PM
Quote from: jjrushford on August 18, 2024, 02:37:00 PM
I'm on OPNsense 24.7.1 and I have os-ddclient 1.23 installed.  I only have two hostnames that I'm checking with dd-client.

according to the Opnsense docs, ddclient as "backend" means the old original ddclient, and "native" means new ddclient rewritten by the Opnsense team.
Just like you, I don't have this issue with the old ddclient, only with the new or "native" one :'(
Title: Re: Multiple hostname in native-ddclient
Post by: Eisai on August 18, 2024, 07:26:50 PM
Quote from: doktornotor on August 18, 2024, 07:16:55 PM
Cloudflare should fix their sh*t. Other than that, if CNAME is impossible, create 3 separate entries in DynDNS, this apparently doesn't work properly with multiple hostnames.

yep..I guess each config entry for each hostname is the only way to go for now, however, I have 10+ sub-domains, and I need to update both ipv4 and ipv6 :'(

although, if I choose "ddclient" as the backend instead of "native", then it can work as expected with the same configuration.
In the logs, it will process all hostnames one by one.
So, I think this also could be a bug with the "native" backend
Title: Re: Multiple hostname in native-ddclient
Post by: doktornotor on August 18, 2024, 07:37:26 PM
Ok, I guess I won't get any answer regarding the CNAMEs. So indeed seems like you will have 20+ entries in DynDNS. Or switch the backend to non-native.
Title: Re: Multiple hostname in native-ddclient
Post by: Eisai on August 18, 2024, 07:58:00 PM
Quote from: doktornotor on August 18, 2024, 07:37:26 PM
Ok, I guess I won't get any answer regarding the CNAMEs. So indeed seems like you will have 20+ entries in DynDNS. Or switch the backend to non-native.

Sorry.. I forgot about CNAME
but seems CNAME will cause more trouble for me, all those sub-domains are different sites, may cause problems with TLS and the ingress controller.
Title: Re: Multiple hostname in native-ddclient
Post by: doktornotor on August 18, 2024, 08:15:38 PM
Ok, I thought CNAMEs were there exactly for the purpose of not having to update zillion records when only one needs changing and it makes things easier, but perhaps it's not trendy any more...