Skip to content
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: Fall back to certificate keyed by empty name (fixes #2035) #2037

Merged
merged 3 commits into from
Mar 17, 2018

Conversation

mholt
Copy link
Member

@mholt mholt commented Feb 20, 2018

1. What does this change do, exactly?

Serves a certificate keyed by an empty hostname for any SNI name if
there were no other matches.

This should only happen for sites defined with an empty hostname (like
":8080") and which are using self-signed certificates or some other
funky self-managed certificate. But that certificate should arguably
be used for all incoming SNI names.

2. Please link to the relevant issues.

Fixes #2035

3. Which documentation changes (if any) need to be made because of this PR?

Probably none

4. Checklist

  • I have written tests and verified that they fail without my change
  • I have squashed any insignificant commits
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I am willing to help maintain this change if there are issues with it later

@benjamin-demarteau Please take a look, let me know how this works for you!

This should only happen for sites defined with an empty hostname (like
":8080") and which are using self-signed certificates or some other
funky self-managed certificate. But that certificate should arguably
be used for all incoming SNI names.
@mholt mholt added this to the 0.10.12 milestone Feb 20, 2018
@mholt
Copy link
Member Author

mholt commented Feb 22, 2018

@benjamin-demarteau I'm gonna merge this soon, unless you find that it doesn't work for you. (But I'm sure it will, if I understood your situation correctly.)

@ghost
Copy link

ghost commented Feb 22, 2018 via email

@mholt
Copy link
Member Author

mholt commented Feb 22, 2018

Hmm, while I think this fixes the issue, I think my implementation is slightly wrong on other edge cases. Will be pushing a new commit later...

Also fix self-signed certs to include IP addresses in their name
if they are configured to serve an IP address
@mholt mholt removed the do not merge ⛔ Not ready yet! label Mar 14, 2018
It would be good to revisit this in the future.
@mholt
Copy link
Member Author

mholt commented Mar 14, 2018

I think this PR is in a better state now. I've reverted the behavior related to empty SNI, where we would only serve a "default" certificate if the client doesn't have SNI. Because sometimes (mostly self-signed situations) the site owner wants a certificate even if it's the wrong one. (But in the future I really want that to be opt-in rather than the default!)

Ready for a review. Or will assume a good state and merge in a couple days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant