Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1491

Kestrel on Linux config for https

$
0
0

I've been reading a lot about how to config Kestrel for https on Ubuntu Linux. I would think it would be pretty common as https is close to universal now. There seem to be a wide variety of docs and nothing seems to exactly match my version of .Net Core MVC.

I have Kestrel/.Net working on my Ubuntu Linux box serving old school http and it's just fine. I've got a cert from LetsEncrypt installed in the usual place on Linux:

CERT_PATH_PUBLIC = "/etc/letsencrypt/live/[domainname]/cert1.pem";CERT_PATH_PRIVATE = "/etc/letsencrypt/live/[domainname]/privkey1.pem";

Here's a very recent question asked on Microsoft learn:

https://learn.microsoft.com/en-us/answers/questions/613333/loading-certificate-pfx-with-password-in-linux-doe

When I try to use that X509Certificate2 class I get a "deprecated" message.

Here's a Microsoft page about a Kestrel https config option but I don't see exactly how to use it.

https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.kestrelserveroptionshttpsextensions.usehttps

My MVC Core app has both a launchsettings.json and an appsettings.json and then there's some Kestrel config in code in my launch app Program.cs.

What exactly do I need to do to enable https? If I give the path to the LetsEncrypt cert, do I use the public or the private? There seems to be a place for a password for the cert but the cert is readable (at least by root) with no password. What am I missing? And just to avoid confusion this is using Kestrel directly as the web server as opposed to reverse proxied through Apache.

Thanks,

Dennis

P.S. Here's the dump from dotnet --info:

.NET SDK: Version:           9.0.104 Commit:            7931ad4860 Workload version:  9.0.100-manifests.dc2cb94f MSBuild version:   17.12.27+7931ad486Runtime Environment: OS Name:     ubuntu OS Version:  22.04 OS Platform: Linux RID:         ubuntu.22.04-x64 Base Path:   /usr/lib/dotnet/sdk/9.0.104/.NET workloads installed:There are no installed workloads to display.Configured to use loose manifests when installing new manifests.Host:  Version:      9.0.3  Architecture: x64  Commit:       7931ad4860.NET SDKs installed:  7.0.119 [/usr/lib/dotnet/sdk]  9.0.104 [/usr/lib/dotnet/sdk].NET runtimes installed:  Microsoft.AspNetCore.App 7.0.19 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]  Microsoft.AspNetCore.App 9.0.3 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]  Microsoft.NETCore.App 7.0.19 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]  Microsoft.NETCore.App 9.0.3 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]Other architectures found:  NoneEnvironment variables:  Not setglobal.json file:  Not found

Viewing all articles
Browse latest Browse all 1491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>