-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TLS certificate selection breaks using caddy behind ingress controller #2656
Comments
It's because there's no SNI information from the client; without it, Caddy doesn't know which certificate should be served up. Before 1.0, we chose a random certificate, but this angered certain users. This isn't a bug in Caddy, then. To avoid information leakage, either the IP address used to connect must match that on the certificate, or the client must send the proper SNI value to get the certificate. More info: #2339 |
For further readers: Caddy's parameter |
Indeed, setting a default ServerName when none is provided is one way to resolve the issue. |
Just wanted to add that curl has a handy, relatively new curl --connect-to <virtualhost>:443:<realhost>:443 https://<virtualhost> -i -k Curl will set Host header and TLS SNI in the request to curl --connect-to localhost:443:ingress.com:443 https://localhost -i -k This can be extended to work with Caddys default auto_https redirects by repeating that option for http and https: curl --connect-to <virtualhost>:80:<realhost>:80 --connect-to <virtualhost>:443:<realhost>:443 http://<virtualhost> -i -k -L |
1. Which version of Caddy are you using (
caddy -version
)?1.0.0, built from source
2. What are you trying to do?
I'm trying to run caddy with TLS behind a traefik ingress controller.
The problem that I'm facing is that a TLS handshake cannot be performed because caddy can't find the certificate. Traefik is forwarding the request based on the IP address of caddy, so the host information isn't available for the handshake.
To my understanding this affects potentially every IP-based LoadBalancer/Proxy/IngressController that is in front of caddy. No problems whatsoever prior to version 1.0.0.
To reproduce:
minica localhost
./caddy -log /dev/stdout
)curl -ks https://localhost:9443
succeedscurl -ks https://127.0.0.1:9443
fails3. What is your Caddyfile?
4. How did you run Caddy (give the full command and describe the execution environment)?
./caddy -log /dev/stdout
5. Please paste any relevant HTTP request(s) here.
curl -v -ks https://localhost:9443/
curl -v -ks https://127.0.01:9443/
Caddy log:
6. What did you expect to see?
Successful connection on
localhost
as well as127.0.0.1
withcurl -k
option, SSL Verification error from curl when omitting-k
option for127.0.0.1
.7. What did you see instead (give full error messages and/or log)?
8. Why is this a bug, and how do you think this should be fixed?
9. What are you doing to work around the problem in the meantime?
No workaround known.
10. Please link to any related issues, pull requests, and/or discussion.
Bonus: What do you use Caddy for? Why did you choose Caddy?
The text was updated successfully, but these errors were encountered: