Skip to content

dns/ddclient: Improve native Porkbun DDNS support - #5740

Open
jawereq wants to merge 1 commit into
opnsense:masterfrom
jawereq:jawereq/feat/ddclient-native-porkbun
Open

jawereq wants to merge 1 commit into
opnsense:masterfrom
jawereq:jawereq/feat/ddclient-native-porkbun

Conversation

@jawereq

@jawereq jawereq commented Sep 25, 2026

Copy link
Copy Markdown

Important notices

Before you submit a pull request, we ask you kindly to acknowledge the following:

If AI was used, please disclose:

  • Model used: Gemini 3.1 Pro (Extended thinking)
  • Extent of AI involvement: Used to help design exception handling and timeout
    logic. Used to review for correctness.

Describe the problem

Following the recent merge of the initial Porkbun native DDNS client module
(#5599), this pull request introduces several functional enhancements and
network hardening improvements.

While the baseline module works great for simple setups, it currently lacks
automatic record creation and explicit zone boundary handling, which are
critical for users utilizing multi-level subdomains.

I have been running this version on my router for several weeks to update IPv4
and IPv6 wildcard records.


Describe the proposed solution

This PR adds full lifecycle record management (automatic creation if a record
does not exist), explicit zone support in the Web UI, and robust network
exception handling.

Details

  • Dynamic Record Creation: The module now first tries to update an existing
    record using the editByNameType API endpoint (which simplifies the previous
    retrieveByNameType + edit flow). If the edit fails because the record does
    not exist, it automatically falls back to the create endpoint. Users no
    longer need to manually pre-create records on the Porkbun website.
  • Explicit Zone Support: Replaced inline domain parsing with dedicated
    _get_zone and _get_label helpers.
  • UI Integration: Added service_porkbun to the account.zone field styles
    in dialogAccount.xml so the Web UI exposes the "Zone" field. This allows
    users to explicitly declare zone boundaries for multi-level subdomains (e.g.,
    app.router.example.com), while retaining the fallback heuristic for simple
    domains.
  • Network Hardening:
    • Added a global 30-second POST timeout to prevent the backend script from
      hanging.
    • Implemented HTTP 429 rate limit backoff handling using urllib3.util.Retry.
    • Wrapped requests.post() and .json() calls in RequestException and
      JSONDecodeError blocks to prevent network drops from dumping tracebacks
      into syslog.
  • Added Python type annotations to all methods to improve code comprehension.

- porkbun.py: Implement Porkbun account handler using API v3 endpoints
  (editByNameType and fallback create). Features HTTP 429 retry backoff
  via urllib3 and 30s request timeouts.
- porkbun.py: Add _get_zone and _get_label helpers to isolate root zones
  from subdomain labels, including fallback heuristics for standard
  single-level subdomains.
- dialogAccount.xml: Expose the Zone field for Porkbun (service_porkbun)
  in the account configuration UI.
@jawereq jawereq changed the title ddclient: Improve native Porkbun DDNS support dns/ddclient: Improve native Porkbun DDNS support Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant