Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

The remote certificate is invalid according to the validation procedure #367

Open
kfrancis opened this issue Apr 14, 2020 · 12 comments
Open
Labels
bug Something isn't working

Comments

@kfrancis
Copy link

Describe the bug

I'm just trying to follow the getting started procedure, but can't view the site once I get through the tutorial because of an SSL localhost issue.

To Reproduce

  1. Follow this tutorial: https://github.com/dotnet/tye/blob/master/docs/tutorials/hello-tye/00_run_locally.md
  2. On step 8, try and browse frontend

Got Exceptions? Include both the message and the stack trace

System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
   at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Security.SslStream.ThrowIfExceptional()
   at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__65_1(IAsyncResult iar)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)

Further technical details

Tye Version: 0.1.0-alpha.20209.5+e3fc0045bd1e5913da935241874761929f1e8465
Platform: Microsoft Windows [Version 10.0.18363.720]

@kfrancis kfrancis added the bug Something isn't working label Apr 14, 2020
@davidfowl
Copy link
Member

If you hit the backend manually in your browser on the HTTPS port, does it work or do you get a warning?

@kfrancis
Copy link
Author

@davidfowl Just a 404, but I think that's expected.

@brendandburns
Copy link
Contributor

@davidfowl I'm seeing this also on Ubuntu 18.04.

@brendandburns
Copy link
Contributor

fwiw, hitting the backend directly also shows an invalid certificate.

Chrome/Edgeium doesn't show a big obvious invalid cert warning on a 404 for whatever reason.

@jkotalik
Copy link
Contributor

The only thing I can think of is regenerating the dotnet dev certs. Can you try running

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

Besides that, I'm not sure; I'd need to investigate this via repro'ing it. Putting this on the 0.2 milestone.

@jkotalik jkotalik added this to the 0.2 milestone Apr 22, 2020
@brendandburns
Copy link
Contributor

dotnet dev-certs https --trust doesn't appear to be a valid command.

@davidfowl
Copy link
Member

fwiw, hitting the backend directly also shows an invalid certificate.

OK good this is what I expected. This is a gap with linux and .NET in general unfortunately...

dotnet dev-certs https --trust doesn't appear to be a valid command.

Yes @spboyer ran into this as well. Let me dig up the docs for this...

@jkotalik
Copy link
Contributor

TIL dotnet dev-certs https --trust isn't a command on linux.

@brendandburns
Copy link
Contributor

@davidfowl the docs here:

https://docs.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-3.1&tabs=visual-studio#troubleshoot-certificate-problems

Are busted as they indicate that dotnet dev-certs https --trust is available on all platforms.

@davidfowl
Copy link
Member

OK I looked into this a bit and the story is very complicated for linux. Even worse is that our docs don't give any hint that it is (that's being fixed). I found the same crazy stackoverflow link you did...

I'm going to make sure some of this gets documented for ubuntu on the ASP.NET Core docs...

@brendandburns
Copy link
Contributor

fwiw, credit to @jkotalik for sending me the stack overflow doc.

@brendandburns
Copy link
Contributor

Might want to hold off merging this, as adding the pfx file breaks the Kubernetes deployment since it doesn't package the cert as a secret for the backend pod.

@jkotalik jkotalik modified the milestones: 0.2, 0.3 May 11, 2020
@jkotalik jkotalik modified the milestones: 0.3, backlog Jun 8, 2020
@philliphoff philliphoff removed this from the backlog milestone Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants