Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
24.1 Legacy Series
»
Dynamic DNS for Porkbun
« previous
next »
Print
Pages: [
1
]
Author
Topic: Dynamic DNS for Porkbun (Read 2143 times)
Ph0enix
Newbie
Posts: 6
Karma: 0
Dynamic DNS for Porkbun
«
on:
March 28, 2024, 08:12:20 pm »
I'm trying to configure DDNS for porkbun and some questions came up without a lot of answers on the Internet.
I have `os-ddclient` installed, configuration for `duckdns` and for `Hurricane Electric` works fine, to be fair for both of these I was able to find step-by-step guide how to set it up for OPNSense.
Porkbun has its own API:
https://porkbun.com/api/json/v3/documentation#DNS%20Edit%20Record%20by%20Domain,%20Subdomain%20and%20Type
They also have a script that is deprecated:
https://github.com/porkbundomains/porkbun-dynamic-dns-python/tree/main
I was able to verify that it works by executing a curl that looks like this:
`curl -H "Content-Type: application/json" --request POST -d '{"secretapikey": "sk1_XXX", "apikey": "pk1_XXX", "content": "192.168.0.200"}'
https://porkbun.com/api/json/v3/dns/editByNameType/root.domain/A/sub1.sub2
`
Notice that the domain I want to update looks like `sub1.sub2.root.domain`
Is there a way to make it work with `os-ddclient` somehow?
Eventually I had some success by using `porkbun` service with `ddclient` backend. However if I use more than 1 level of subdomain it considers the rest as root domain and returns an error, e.g. `sub2.root.domain` is not correct. Native `ddclient` has an option `root-domain` but I can't figure out how to set it via OPNSense WebGui. Adding it to `ddclient.conf` manually also did not help, perhaps it did not reload the config though.
Alternatively I thought using `custom` + `Custom POST` would allow me to what I wanted but then I can't figure out how to feed it the data part of the query. Help suggests that I should use the link `https://porkbun.com/api/json/v3/dns/editByNameType/root.domain/A/sub1.sub2` as the `server` but `data` part where I would provide the keys and the content is still a mystery. I tried looking at `/usr/local/etc/ddclient.json` but could not see anything resembling the data part of a `POST` request.
Am I missing something or is the built-in dynamic DNS not flexible enough to accomplish what I need?
Additionally what I'd like to know is if it's possible to use a different gateway to determine the IP address. I have a VPN tunnel, there is a corresponding GW. The GW has an internal wireguard IP. not an exit IP. So if setting the `interface to monitor` to the GW in question would send the quesry for a service like `freedns` through that gateway.
In the end it appears that to accomplish what I want it might be easier to set up docker containers that would sit on different subnets and run the services to update the domains behind my WAN and my WAN_VPN. However having all that running on OPNSense would mean a bit less clutter.
Logged
Monviech (Cedrik)
Global Moderator
Hero Member
Posts: 1601
Karma: 176
Re: Dynamic DNS for Porkbun
«
Reply #1 on:
March 28, 2024, 08:55:58 pm »
I dont know if it fits your usecase, but os-caddy has porkbun included with dynamic DNS feature. Don't know how well it works though.
Though keep in mind that its just a sub feature of the plugin. Its mostly a reverse proxy.
Logged
Hardware:
DEC740
Ph0enix
Newbie
Posts: 6
Karma: 0
Re: Dynamic DNS for Porkbun
«
Reply #2 on:
March 29, 2024, 12:05:28 am »
Thank you for the pointer. I have not used Caddy yet but that could a good reason to explore.
Logged
barometer
Newbie
Posts: 3
Karma: 0
Re: Dynamic DNS for Porkbun
«
Reply #3 on:
June 25, 2024, 12:22:42 pm »
This came up in my Google search results on this issue, so posting here for the benefit of others.
I had to do two things in the web interface to get the ddclient working with Porkbun.
1) On the 'general settings' tab, select ddclient as the backend. On my machine, it defaulted to 'native' as the backend.
2) When adding the Porkbun account, select 'Interface' as the 'check ip method'.
The web ui for ddclient has columns for 'current ip' and 'updated'. On my machine, these remain blank and are not updated in the web ui (bug?). However, ddclient does update the Porkbun A record. I'm not sure, but you might need to create an A record on Porkbun in the first place. I pointed it at 127.0.0.1 so I could tell when ddclient updated it. Check /var/log/ddclient/latest.log to confirm.
Logged
Lost_Ones
Newbie
Posts: 11
Karma: 1
Re: Dynamic DNS for Porkbun
«
Reply #4 on:
June 25, 2024, 01:59:42 pm »
Hello,
I too started to work on trying to get the DDNS to work with porkbun. I also came across this post yesterday but before your post. How did you get this to work? I have tried a variety of possibilities. I have tried User name as my login, blank etc.
Did you use the api key as the username and the secret as the password? This seemed to be the proper combo as the only error in the that I get is "invalid domain name". This is strange as I have the correct name, so maybe there is a setting that I need to change on the porkbun side.
Regards
Logged
morik_opnsense
Newbie
Posts: 20
Karma: 0
Re: Dynamic DNS for Porkbun
«
Reply #5 on:
June 28, 2024, 02:56:46 pm »
I may not be answering the question directly, but I wrote a shell script (essentially curl command) with a cron job as an alternative. Happy to share script if it helps anyone.
Logged
Monviech (Cedrik)
Global Moderator
Hero Member
Posts: 1601
Karma: 176
Re: Dynamic DNS for Porkbun
«
Reply #6 on:
June 28, 2024, 03:45:39 pm »
Or you could use the existing os-caddy plugin in Dynamic DNS Client Mode.
https://docs.opnsense.org/manual/how-tos/caddy.html#use-dynamic-dns-in-client-mode-only
Porkbun is compiled into it.
https://github.com/caddy-dns/porkbun
Logged
Hardware:
DEC740
Tixx7
Newbie
Posts: 1
Karma: 0
Re: Dynamic DNS for Porkbun
«
Reply #7 on:
October 20, 2024, 06:43:14 pm »
Faced this task today—surprisingly, ddclient hasn’t failed me despite doubts.
@barometer, thanks for the tip: "check ip" set to "interface" and backend to "ddclient." You might also be right about it only updating, not creating, A-records.
@lost_ones, your approach with API/secret keys is correct. Might wanna try creating an A-record beforehand (see below) but you probably figured it out anyway by now.
My working config (relevant parts):
OPNsense:
- Username: API key
- Password: Secret
- Check IP method: Interface
- Hostname: subdomain.domain.tld (haven't tried multiple subdomains)
Porkbun:
- A-record for subdomain. Had one there beforehand, so unsure if it also works without.
Applied settings, checked Porkbun—A-record updated with external IP instantly. Quick!
edit:
Confirmed that it doesnt work with multiple subdomain (i.e. example.domain.tld works but example.example.domain.tld doesn't) and also that an a-record with the same name/host has to be created beforehand
«
Last Edit: October 20, 2024, 07:14:39 pm by Tixx7
»
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
24.1 Legacy Series
»
Dynamic DNS for Porkbun