Description
Is your feature request related to a problem? Please describe.
I'm having a TLS keypair (site.key
, site.crt
) issued by an internal intermediate CA which in turn is issued by an internal root CA. On Linux Kestrel is not sending the intermediate cert even the intermediate CA cert is in the site.crt
.
This was reported before (#10971) but the issue got closed without a conclusion, unfortunately. By reading the discussion, I understood this is a lower-layer issue.
But the issue is really annoying and I think this deserves another look. The workaround would be adding the intermediate CA cert into the machine CA store with root user privilege. For scenarios like inside a docker container, this means sudo
capability needs to be there and imposes a serious security issue.
Describe the solution you'd like
The Kestrel server should give the intermediate CA cert if it is baked in the TLS cert chain.
Additional context
I tried with both golang and python3 with the same TLS keypair. Both give out the intermedia CA cert
Following are snippets of my tests
// .net 5; DOES NOT WORK
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>()
.ConfigureKestrel(_ => _.ListenAnyIP(7443,
options =>
{
options.UseHttps(new HttpsConnectionAdapterOptions
{
ServerCertificate = X509Certificate2.CreateFromPemFile("site.crt", "site.key")
});
}));
});
// .net 6; DOES NOT WORK
var builder = WebApplication.CreateBuilder(args);
builder.WebHost
.ConfigureKestrel(_ => _.ListenAnyIP(7443,
options =>
{
options.UseHttps(new HttpsConnectionAdapterOptions
{
ServerCertificate = X509Certificate2.CreateFromPemFile("../site.crt", "../site.key")
});
}));
// go: WORKS
err := http.ListenAndServeTLS(":6443", "site.crt", "site.key", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
# python: WORKS
httpd = HTTPServer(('localhost', 4443), BaseHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,
keyfile="site.key",
certfile='site.crt', server_side=True)
httpd.serve_forever()