PencilShavings / docker-caddy

A powerful open source web server (with Linode & Cloudflare DNS support).
https://hub.docker.com/r/pencilshavings/caddy
0 stars 0 forks source link

Linode Token Not Working #1

Open pcondon10 opened 2 months ago

pcondon10 commented 2 months ago

Hi, I've been using Caddy with a manual install on Ubuntu for a bit now because I needed the Linode DNS integration for DNS validation for Let's Encrypt. I was super excited to see your docker image that has the Linode DNS integration included as I would much prefer to run Caddy in docker. My issue is that the config that was working gave me errors when I tried to load it with your image. I had to change the syntax slightly, and when I did I get an error that the token is invalid.

Original syntax: { acme_dns linode { api_token {"STRIPPED OUT ACTUAL TOKEN"} } }

And the original error I received: INF ts=1714770865.1046147 msg=using provided configuration config_file=/etc/caddy/Caddyfile config_adapter=caddyfile Error: adapting config using caddyfile: parsing caddyfile tokens for 'acme_dns': wrong argument count or unexpected line ending after '{"STRIPPED OUT ACTUAL TOKEN"}', at /etc/caddy/Caddyfile:5

After modifying it so that now it seems to load the Caddyfile (based on your example here) it looks like this now: { acme_dns linode {"STRIPPED OUT ACTUAL TOKEN"} }

But now I get this error, when the token works effectively if I use the Linux installed binary for Caddy instead of the Docker container. So I'm not sure what I'm doing wrong (I have replaced the URLs below as well just FYI).

ERR ts=1714771200.6351883 logger=tls.obtain msg=will retry error=[MYURL.com] Obtain: [MYURL.com] solving challenges: presenting for challenge: adding temporary record for zone "MYURL.com.": [401] Invalid Token (order=https://acme.zerossl.com/v2/DV90/order/WKeE5pBiEKONqLN_UV-5_g) (ca=https://acme.zerossl.com/v2/DV90) attempt=1 retrying_in=60 elapsed=1.385658282 max_duration=2592000

Thanks in advance for any guidance!

pcondon10 commented 2 months ago

It turns out after further digging if I look at the referenced order in my browser I see a different error, which is this:

{"type":"urn:ietf:params:acme:error:malformed","status":405,"detail":"The request message was malformed"}

Any suggestions?

PencilShavings commented 2 months ago

Hello! What version if Ubuntu and Caddy are you running? I was going to ask if you were using tosie's DNS module too but I see you opened an issue with them as well. Good call because I actually think the issue lies there.

That being said if you have a working set up with a version of Caddy thats not on my dockerhub, which honestly is most likely, I'll build and push the image if I can get it to work.

pcondon10 commented 2 months ago

Thanks for the response. And, no, I don’t have it working even with the non docker install. There has to be an issue with the base code somewhere. I’m about to revert to Traefik, this is too complicated. I moved to Caddy because the proxy config was so easy. But I’ve wasted more time on the DNS validation than I would have with Traefik configuration.

Thanks again for the help.

PencilShavings commented 2 months ago

Thanks for the update. Honestly, I ran into issues a while back (a year or so ago?) with Caddy & the Linode DNS plugin. My certs were not auto renewing and it was very frustrating. I switched to Cloudflare and never looked back, it just worked. I left the Linode plugin hoping that the problem was with Linode on their side and the problem would eventually fix itself. From your repose that doesn't seem to be the case. I should probably depreciate it or add a warning.

If you are willing/able to switch your DNS to Cloudflare, I highly recommend it. It's the exact same syntax as in my example, but with dns cloudflare {YOUR_CLOUDFLARE_API_TOKEN} uncomented. That's what I use to get my domains usable behind Tailscale.