We are running a Service Fabric application on our remote dev cluster. It consists of several stateful and stateless services and is fronted by several front-end APIs running on Kestrel.
Until now, since it was not used for production, Kestrel was configured to use a self-signed certificate, which was also used for the reverse proxy and the cluster itself and the service was running directly on the default domain provided by Azure, <app>.<region>.cloudapp.azure.com
.
We are now getting to the point in development where the self-signed certificate errors are becoming problematic, with third party callbacks rejecting the connection, so it was seen as the time to start using a proper domain and certificate for it.
So far, I have done the following:
- Added an A record for
devcluster.somexampledomain.com
-> our public IP for the service. - Created a Wildcard Azure Application certificate for
*.someexampledomain.com
. - Imported the certificate to Azure Key Vault.
- Bound the certificate to the Vault Secrets of the cluster, pulling the certificate to
Cert:/LocalMachine/My/
- Modified the application config to use this certificate when initialising Kestrel and verified that it is found when it is initialising.
- Have tried with and without
UseHsts()
andUseHttpsRedirection()
- Kestrel is configured with
Listen(IPAddress.IPv6Any, endpoint.Port, ...)
andUseHttps(X509Certificate2)
on the options object. UseUrls(string)
is used with the default Url, which ishttps://+:<port>
but tried manually addinghttps://*:<port>
and even the actual hostname itself.
- Have tried with and without
No matter what I have tried, no HTTPS connection can be established to the server. Trying the endpoints of the other staging servers that still use the old certificate, it works as expected.
Using openssl s_client -connect devcluster.someexampledomain.com:<port> -prexit
, I get:
---
no peer certificate available
---
No client certificate CA names sent
---
There are no errors or exceptions being logged on ETW, everything seems to be in order. I suspect that this might have something to do with the CN of the certificate but I have run out of ideas to try and find out what is going on and how to fix it.
Been trying to look into this using Fiddler and I am not getting much out of it, the session just ends with fiddler.network.https> HTTPS handshake to <myhost> (for #191) failed. System.IO.IOException Authentication failed because the remote party has closed the transport stream.
Does anybody know how to add some logging on the Kestrel side? I don't think installing Fiddler on the Azure VMs running my cluster is a viable solution.