AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Instructions for trusting dev-cert in WSL still result in "certificate is not trusted" warning

Open glen-84 opened this issue 2 years ago • 8 comments
trafficstars

I have followed the instructions:

And I still get:

The ASP.NET Core developer certificate is not trusted. For information about trusting the ASP.NET Core developer certificate, see ...

... when I run the application in WSL.

What am I missing? This should work with the default paths used by Kestrel, right?

(Windows 11, WSL with Debian, dotnet 7, OpenSSL 1.1.1n, etc.)


Document details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

glen-84 avatar Dec 11 '22 16:12 glen-84

dotnet dev-certs https --clean dotnet dev-certs https --trust

Rick-Anderson avatar Dec 12 '22 01:12 Rick-Anderson

--trust doesn't work on Linux.

glen-84 avatar Dec 12 '22 08:12 glen-84

I have the same problem. I installed WSL with Ubuntu 20.04, .NET 7.0.100, also I use Rider IDE.

I tried these steps:

When I run project from Windows terminal, certificate is applied correctly. From WSL Ubuntu terminal it always looks like this:

dotnet run service --project Gymmer.Service Building... info: Gymmer.Service[0] Executing migrations. info: Gymmer.Service[0] Executing seeding. > warn: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer[8] > The ASP.NET Core developer certificate is not trusted. For information about trusting the ASP.NET Core developer certificate, see https://aka.ms/aspnet/https-trust-dev-cert.

@Rick-Anderson unfortunately, these commands won't help:

dotnet dev-certs https --clean dotnet dev-certs https --trust

Plusce avatar Dec 17 '22 22:12 Plusce

@glen-84 @Plusce Partial instructions here

Rick-Anderson avatar Feb 02 '23 21:02 Rick-Anderson

@Rick-Anderson

You seem to have linked to a random comment in that issue.

I tried:

  • dotnet dev-certs https -ep localhost.crt --format PEM
  • sudo cp localhost.crt /usr/lib/ssl/certs/aspnetcore-https-localhost.pem

... but I still get the warning.

I've posted a comment in the linked issue.

glen-84 avatar Feb 12 '23 12:02 glen-84

The same issue. Any solution found so far?

mrtabaa avatar Jun 04 '23 21:06 mrtabaa

I noticed this today. It appears that Microsoft.AspNetCore.Certificates.Generation.UnixCertificateManager has

public override bool IsTrusted(X509Certificate2 certificate) => false;

which causes this warning to be always logged by Kestrel, even when the root certificate is trusted.

StephenRobin avatar Jun 23 '23 12:06 StephenRobin

If you still face this issue : try some ideas from here.

Serge-N avatar May 07 '24 06:05 Serge-N