opnsense / plugins

OPNsense plugin collection
https://opnsense.org/
BSD 2-Clause "Simplified" License
832 stars 619 forks source link

dns/ddclient: Adding support for Porkbun (and others) added in ddclient v3.11.0 #3719

Closed briandur closed 8 months ago

briandur commented 9 months ago

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe. ddclient added multiple new providers in v3.11.0. Current os-ddclient plugin 1.18 ships with ddclient v3.11.2.

Describe the solution you'd like Requesting support in os-ddclient plugin for Porkbun and possibly others that were added to ddclient.

Describe alternatives you've considered

Adding <porkbun>Porkbun</porkbun> to usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/DynDNS.xml allows me to add a Porkbun entry in the GUI. The protocol used and API parsing is correct for the added entry.

I however cannot get the APIKEY and SECRETAPIKEY used by Porkbun's API to post correctly. API keys entered into user/pass fields returns the error: FAILED: {"status":"ERROR","message":"All API requests require an API key or API token."})

Manually editing the user/pass entry in usr/local/etc/ddclient.conf, to apikey/secretapikey as per ddclient.conf example works properly and checks/updates the DNS record.

os-ddclient GUI generates the following in usr/local/etc/ddclient.conf:

usev4=ifv4, ifv4=pppoe0, \
protocol=porkbun, \
username=<apikey>, \
password=<secretapikey> \
subdomain.domain.com

Below is the configuration that is working:

usev4=ifv4, ifv4=pppoe0, \
protocol=porkbun, \
apikey=<apikey>, \
secretapikey=<secretapikey> \
subdomain.domain.com

Additional context

briandur commented 8 months ago

Added PR #3738. This seems to be the least invasive way to add Porkbun support.

powerunlimited commented 7 months ago

On OPNsense 24.1_1 and os-ddclient 1.20_1, seems like this service has disappeared in the GUI services selection box when adding new domains. I have checked and see the entry are present in usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/DynDNS.xml. Are other changes required to update the GUI?

Note that this is not the only missing service entry from the DynDNS.xml file, 43 VS 21 I see currently in the UI.

fichtner commented 7 months ago

Switch to “ddclient” backend. 😉

mitchber commented 6 months ago

On OPNSense v24.1.2_1, ddclient v1.21

when using a root domain (not a subdomain), i needed to add the below line in the config for it to work properly. Is it possible to add a tickbox to the gui?

on-root-domain=yes

Saved ddclient.conf (not working):

usev4=ifv4, ifv4=igb0, \
protocol=porkbun, \
apikey=pk1_xxx, \
secretapikey=sk1_xxx>
login=pk1_xxx, \
password=sk1_xxx \
example.com

Manually edited config (working):

usev4=ifv4, ifv4=igb0, \
protocol=porkbun, \
apikey=pk1_xxx, \
secretapikey=sk1_xxx>
login=pk1_xxx, \
password=sk1_xxx \
on-root-domain=yes
example.com

Error message when on-root-domain is not added:
Notice | ddclient | FAILED: {"status":"ERROR","message":"Invalid domain."})

P.S. it also looks like the login/password lines are redundant, but probably aren't causing any issues.

briandur commented 6 months ago

Can you try changing on-root-domain=yes to root-domain=example.com. It seems this is the format ddclient is looking for and would be simpler to implement.

mitchber commented 6 months ago

Unfortunately no luck. Still ending with the same "Invalid domain" log entry.

I also see this in the logs Notice | ddclient | WARNING: file /usr/local/etc/ddclient.conf, line 11: unrecognized keyword 'root-domain' (ignored)

rahuljawale commented 2 months ago

I transferred one of my domains to porkbun and I can confirm @mitchber 's observations. os-ddns plugin works only after adding the line on-root-domain=yes.

briandur commented 2 months ago

I believe the simplest way to make this work would be to add an if statement to the porkbun section of dns/ddclient/src/opnsense/service/templates/OPNsense/ddclient/ddclient.conf that would add on-root-domain=yes when no subdomain is specified. Unfortunately that is outside of my skill set.