caddyhttp: Refactor cert Managers (fix #5415)#5533
Conversation
|
I'm so sorry that I somehow missed this issue, apparently it is too late to reply to this issue since this patch had been verified. And of course it works well when I update caddy to v2.7.5 on my server. |
|
With further tests, It works great on single SNI, but on wildcard sites, It goes to: |
|
Can you please share your config? |
Sure, here is the demo: I put a self-signed certificate in 192.168.1.100:/etc/caddy/cert, and set my hosts to : single SNI works well with caddy: wildcard domain name goes to on-demand TLS: |
|
more tests: /etc/caddy/cert/wildcard.crt : certificate for *.mydemo.com get_certificate with wildcard goes to on-demand TLS: certificate file with wildcard works well: get_certificate with single SNI goes works well: certificate file with single SNI goes works well: certificate file for single SNI and wildcard: works well get_certificate for single SNI and certificate file for wildcard: goes to on-demand TLS get_certificate for wildcard and certificate file for single SNI: stays alive, and try to get certificate by acme for *.mydemo.com get_certificate for single SNI and certificate file for wildcard, but single site comes first: goes to on-demand TLS |
|
Thanks; will look at this soon -- will be a bit busy for a while though as our baby is coming home, so... yeah. Bear with me |
|
@BioEvo I finally had a chance to look at this. I am seeing that Caddy will serve the wildcard certificate if it already exists in memory (the "cache") even if the config says that there's a specific cert to use for a specific subdomain. But it serves the wildcard because technically it satisfies the request for the specific subdomain too. Is that the behavior you're saying is undesirable? |
Implicit Managers (Tailscale currently) are now configured in their own automation policy that enables on-demand TLS. Explicit managers now enable on-demand TLS, which defers cert issuance (which won't be needed or used if the cert manager returns the cert in the first place).
@BioEvo Do you think you could test this out to verify? I tried your config and it worked for me. I also tried a bunch of other configs and AFAIK they worked alright. But never hurts to have you verify! 😉 This was a complicated change for me (to keep as simple as possible).