Problems with Porkbun DDNS

1. The problem I’m having:

I’ve set up Porkbun DDNS as best I can, but caddy logs seem to indicate a 404 while caddy attempts to run DDNS.

2. Error messages and/or full log output:

{"level":"info","ts":1702090197.6680722,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
{"level":"info","ts":1702090197.6735327,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1702090197.6741238,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000494800"}
{"level":"info","ts":1702090197.6742337,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
{"level":"info","ts":1702090197.6742768,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"debug","ts":1702090197.6743395,"logger":"http.auto_https","msg":"adjusted config","tls":{"automation":{"policies":[{"subjects":["segfault.foo"]},{}]}},"http":{"servers":{"remaining_auto_https_redirects":{"listen":[":80"],"routes":[{},{}]},"srv0":{"listen":[":443"],"routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"static_response","headers":{"Location":["https://www.github.com"]},"status_code":302}]}]}],"terminal":true}],"tls_connection_policies":[{}],"automatic_https":{}}}}}
{"level":"debug","ts":1702090197.6747334,"logger":"dynamic_dns","msg":"beginning IP address check"}
{"level":"info","ts":1702090197.6748075,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1702090197.6750836,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details."}
{"level":"debug","ts":1702090197.6753607,"logger":"http","msg":"starting server loop","address":"[::]:443","tls":true,"http3":true}
{"level":"info","ts":1702090197.6754165,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"debug","ts":1702090197.6755,"logger":"http","msg":"starting server loop","address":"[::]:80","tls":false,"http3":false}
{"level":"info","ts":1702090197.6755354,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"info","ts":1702090197.6755576,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["segfault.foo"]}
{"level":"debug","ts":1702090197.6761706,"logger":"tls","msg":"loading managed certificate","domain":"segfault.foo","expiration":1709859590,"issuer_key":"acme-v02.api.letsencrypt.org-directory","storage":"FileStorage:/data/caddy"}
{"level":"debug","ts":1702090197.676688,"logger":"tls.cache","msg":"added certificate to cache","subjects":["segfault.foo"],"expiration":1709859590,"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"3dcb7fa5313839dc861a4beb7f67d4d788e281c051d2e1763034dfb870316d8b","cache_size":1,"cache_capacity":10000}
{"level":"debug","ts":1702090197.6767826,"logger":"events","msg":"event","name":"cached_managed_cert","id":"8b1d5524-9078-4cf2-97e0-339ad2f52a83","origin":"tls","data":{"sans":["segfault.foo"]}}
{"level":"info","ts":1702090197.677016,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1702090197.6770778,"msg":"serving initial configuration"}
{"level":"warn","ts":1702090197.6792114,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"c76ec936-26a4-49af-9f32-4138d14a852b","try_again":1702176597.6792073,"try_again_in":86399.999999375}
{"level":"info","ts":1702090197.6793919,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1702090198.3521965,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"segfault.foo"}
{"level":"info","ts":1702090198.352261,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"segfault.foo"}
{"level":"info","ts":1702090198.35227,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"www.segfault.foo"}
{"level":"info","ts":1702090198.352276,"logger":"dynamic_dns","msg":"domain not found in DNS","domain":"www.segfault.foo"}
{"level":"debug","ts":1702090198.3523736,"logger":"dynamic_dns","msg":"looked up current IPs from DNS","lastIPs":{"segfault.foo":{"A":[""],"AAAA":[""]},"www.segfault.foo":{"A":[""],"AAAA":[""]}}}
{"level":"debug","ts":1702090198.55374,"logger":"dynamic_dns.ip_sources.simple_http","msg":"lookup","type":"IPv4","endpoint":"https://ipconfig.io/ip","ip":"159.65.33.225"}
{"level":"info","ts":1702090198.5538085,"logger":"dynamic_dns","msg":"updating DNS record","zone":"segfault.foo","type":"A","name":"@","value":"159.65.33.225","ttl":3600}
{"level":"info","ts":1702090198.5538187,"logger":"dynamic_dns","msg":"updating DNS record","zone":"segfault.foo","type":"A","name":"www","value":"159.65.33.225","ttl":3600}
{"level":"error","ts":1702090198.6356988,"logger":"dynamic_dns","msg":"failed setting DNS record(s) with new IP address(es)","zone":"segfault.foo","error":"Invalid http response status, <!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<title>Error</title>\n<style type=\"text/css\">\n\n::selection{ background-color: #E13300; color: white; }\n::moz-selection{ background-color: #E13300; color: white; }\n::webkit-selection{ background-color: #E13300; color: white; }\n\nbody {\n\tbackground-color: #fff;\n\tmargin: 40px;\n\tfont: 13px/20px normal Helvetica, Arial, sans-serif;\n\tcolor: #4F5155;\n}\n\na {\n\tcolor: #003399;\n\tbackground-color: transparent;\n\tfont-weight: normal;\n}\n\nh1 {\n\tcolor: #444;\n\tbackground-color: transparent;\n\tborder-bottom: 1px solid #D0D0D0;\n\tfont-size: 19px;\n\tfont-weight: normal;\n\tmargin: 0 0 14px 0;\n\tpadding: 14px 15px 10px 15px;\n}\n\ncode {\n\tfont-family: Consolas, Monaco, Courier New, Courier, monospace;\n\tfont-size: 12px;\n\tbackground-color: #f9f9f9;\n\tborder: 1px solid #D0D0D0;\n\tcolor: #002166;\n\tdisplay: block;\n\tmargin: 14px 0 14px 0;\n\tpadding: 12px 10px 12px 10px;\n}\n\n#container {\n\tmargin: 10px;\n\tborder: 1px solid #D0D0D0;\n\t-webkit-box-shadow: 0 0 8px #D0D0D0;\n}\n\np {\n\tmargin: 12px 15px 12px 15px;\n}\n\n</style>\n</head>\n\n\n<body>\n\t<div id=\"container\">\n\t\t<h1>An Error Was Encountered</h1>\n\t\t<p>The URI you submitted has disallowed characters.</p>\t\t<p>You can probably find what you're looking for on our <a href=\"/\">homepage</a>.</p>\n\t</div>\n</body>\n</html>\n"}
{"level":"info","ts":1702090198.6357787,"logger":"dynamic_dns","msg":"finished updating DNS","current_ips":["159.65.33.225"]}

3. Caddy version:

v2.7.6 from Docker

4. How I installed and ran Caddy:

I’m using a Caddy custom-built Docker image. My Dockerfile looks like this:

FROM caddy:builder AS builder
RUN xcaddy build \
    --with github.com/mholt/caddy-dynamicdns \
    --with github.com/caddy-dns/porkbun

FROM caddy:latest
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
COPY Caddyfile /etc/caddy/Caddyfile
#COPY sites /srv

and my docker-compose.yaml looks like this:

services:
  # Using a custom caddy here to make sure we have Porkbun certificate support and DDNS
  caddy:
    container_name: caddy
    build:
      context: .
      dockerfile: ./Dockerfile
    restart: unless-stopped
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./caddy-data/certs:/certs
      - ./caddy-data/config:/config
      - ./caddy-data/data:/data
    network_mode: "host"

a. System environment:

Running in Docker (on Ubuntu if that makes a difference, although it shouldn’t)

b. Command:

# (if I need to destroy the previous caddy build)
docker stop caddy && docker rm caddy && docker rmi caddy-caddy:latest
# to build and run
docker compose up -d

c. Service/unit/compose file:

(see above)

d. My complete Caddy config:

{
        debug
        acme_dns porkbun {
                api_key <api key>
                api_secret_key <api secret key>
        }

        dynamic_dns {
                ip_source simple_http https://ipconfig.io/ip
                ip_source simple_http https://icanhazip.com
                ip_source interface eth0
                provider porkbun {
                        api_key <api key>
                        api_secret_key <api secret key>
                }
                domains {
                        segfault.foo @ www
                }
                versions ipv4
                check_interval 5m
                ttl 1h
        }
}

segfault.foo {
        redir https://www.github.com
}

(I actually have a larger Caddyfile but this is a minimum reproducible example for me)

5. Links to relevant resources:

None that I can think of.

Whoa, that’s a strange error.

There’s probably a bug with GitHub - libdns/porkbun, it might not properly support setting A records and might only handle TXT records correctly.

Best if you open an issue on github to track that.

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