-
Notifications
You must be signed in to change notification settings - Fork 243
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
fix: integrate mutual TLS scenario with underlying http.sys server #2044
fix: integrate mutual TLS scenario with underlying http.sys server #2044
Conversation
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.
Nice, I am slightly worried if netsh fails to delete the configuration and leaves the machine in a setup state.
I am as well. I am thinking about 2 approaches:
i will try to do №2 a bit later today - it should be more robust |
decided to change the port to 8080 so that other tests are not impacted by http.sys configuration changes (if there would be) - just for safety. |
mTLS (mutual TLS) requires a separate setup from the server side. mTLS is valid, when clientCert is negotiated on the connection establishment, meaning when ASP.NET code calls
context.Connection.ClientCertificate
: it should be already available and there must not be any need to invokecontext.Connection.GetClientCertificateAsync()
in case of Kestrel setup is extremely easy - just set a specific enum value:
however in case of HTTP.SYS the only option is to execute a netsh command
netsh http add sslcert
.I have added a code in ASP.NET application, which on start binds the test certificate using netsh command, and then using an applicationLifetime
ApplicationStopping
callback it deletes the cert binding from the machine. It can be seem from the logs (below).Basically the order is the following:
clientcertnegotiation=enable
to enable client cert negotiationoptionally)
netsh http show sslcert
can show the ssl cert bindings on a machine. Important property is "Negotiate Client Certificate : Enabled"netsh http delete sslcert