-
Notifications
You must be signed in to change notification settings - Fork 10.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
Support SNI via config #15144
Comments
Kestrel isn't capable of sharing ports across endpoints, instances, apps, etc.. For that you need to use HttpSys.
SNI config wouldn't be done by the aggregation of multiple endpoints, it would be adding additional certs to an existing one. This would be possible to build, but it'd be complicated. Estimated cost/complexity: Medium to Large. |
@Tratcher is your suggestion here that we support a more first-class way to do this instead of the existing callback we have? My reading is that the callback would be sufficient to do this. |
The callback is OK, but you have to code up the config bindings yourself. The customer ask is to wire up the callback automatically based on config. That config would have to be pretty complex/flexible. |
This looks like a dupe of #4749 which is also backlogged pending more customer demand. We should probably close one of these. |
I closed the other one since this one is from a customer. |
At the moment it is possible to configure SSL in kestrel via config.
The config I would like to use is:
which would allow both certs to be used on the same port. This is currently achieved by the following code added to the ConfigureKestrel method:
|
That doesn't look quite right, did you copy too many lines? |
The desired config should read as
|
Ah, I didn't notice the difference between the urls on those two examples. That url field is used to create the socket, not as part of certificate negotiation. I picture something more like this:
|
That looks easier to read and for me solves the same problem. |
@Tratcher this design seems good to me and is relatively clear. The only change I'd make is that we probably don't need the Certificates value to be a dictionary since the Subject is the "key" already. Perhaps just: "Kestrel": {
"Limits": {
"MaxConcurrentConnections": 100,
"MaxConcurrentUpgradedConnections": 100
},
"DisableStringReuse": true,
"Endpoints": {
"Http": {
"Url": "http://localhost:5000"
}
"Https": {
"Url": "https://*:5001",
"Certificates": [
{
"Subject": "localtest",
"Store": "My",
"Location": "LocalMachine",
"AllowInvalid": "true"
},
{
"Subject": "*.localtest.me",
"Store": "My",
"Location": "LocalMachine",
"AllowInvalid": "true"
}
}
}
} So the work here is basically to add a "Certificates" property to the [EndpointConfig]9https://github.com/aspnet/AspNetCore/blob/845e6d5512c3521a07d7fa93737b0da041a8a3c6/src/Servers/Kestrel/Core/src/Internal/ConfigurationReader.cs#L153) and then flow all that forward and (if set) use it to build a callback that selects a cert based on the subject name We'll have to process wildcards properly (i.e. match |
Bumping for re-triage. Proxy will want some form of this. |
As per some discussions in YARP, it might be a good idea to have an option to scan the Windows cert store for candidate certs an automatically select one. That's not suitable to completely solve this issue since it only applies on Windows, but it could be a convenient approach since it means the only thing you need to do to install/rotate/etc. a cert is make sure it's in the store and valid. This was discussed in microsoft/reverse-proxy#86 A key aspect is that the system would load all reasonable certificates from the Windows store and then select the best certificate. Where "reasonable" and "best" are defined by:
|
@anurse that seems like a pretty different feature from this one, we should track it separately. |
Fixed via #24286 |
I have configured SNI SSL by coding the certificate selector in the kestrel configuration. I would like to do this entirely through the config file.
It would be great if it was as simple as adding more endpoint configs each defining their url, host, port and scheme and the file or store cert definitions; so no changes would be required to the current config structure.
At the moment it appears that if two endpoints using the same port are defined in the config then only one is active.
The text was updated successfully, but these errors were encountered: