-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
caddytls: set SNI server name in context #6324
Conversation
53fe5be
to
2059b4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty straightforward -- how about this for a name instead?
Then I think we can merge.
modules/caddytls/certmanagers.go
Outdated
@@ -22,6 +22,9 @@ func init() { | |||
caddy.RegisterModule(HTTPCertGetter{}) | |||
} | |||
|
|||
// For referencing the requested SNI server name. | |||
var SNIServerNameCtxKey caddy.CtxKey = "sni_server_name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var SNIServerNameCtxKey caddy.CtxKey = "sni_server_name" | |
const ClientHelloSNICtxKey caddy.CtxKey = "client_hello_sni" |
This is potentially bikeshedding but hear me out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree; SNIServerName
is basically "server name indication server name" 😅 https://en.m.wikipedia.org/wiki/Server_Name_Indication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, I didn't even think about what the expanded name would be. Indeed, that sounds pretty silly :) Updated name coming up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Set the requested server name in a context value for CertGetter implementations to use. Pass ctx to tscert.GetCertificateWithContext. Signed-off-by: Will Norris <will@tailscale.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now, thanks!
This reverts commit e66040a. The additional context value is unnecessary because certmagic already sets certmagic.ClientHelloInfoCtxKey on the same context.
Set the requested server name in a context value for certmagic.Manager implementations to use. Pass ctx to tscert.GetCertificateWithContext.
This relies on tailscale/tscert#9 to be merged first, which adds the new tscert.GetCertificateWithContext method. This will enable tailscale/caddy-tailscale#53, which enables the use of auto_https with tsnet servers running inside of caddy.
This PR only attaches the server name inside the Tailscale certmagic.Manager. I tried to find the right place to attach it for all managers, but couldn't seem to find it. I'd love some pointers for where to put this.
/cc @mholt