fixer-m / snowflake-db-net-client

Snowflake .NET Client
Apache License 2.0
51 stars 14 forks source link

Exception The remote certificate is invalid according to the validation procedure #2

Closed mzaatar closed 3 years ago

mzaatar commented 3 years ago

Hey, Thanks for providing another library for connecting to Snowflake.

There is an issue with GetHostName method in AuthInfo.cs, I failed to use it due to this exception: Unhandled exception. System.AggregateException: One or more errors occurred. (The SSL connection could not be established, see inner exception.) ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

Do you think we need to change this to be return $"{Account}.snowflakecomputing.com"; or at least make the Hostname parameter that we can set in the ctor same as account and user etc.

fixer-m commented 3 years ago

Hi, Thanks for your bug report!

How your URL looks like when you are logged-in into Snowflake web interface? (You can strip out your account name)

I suppose this issue is related to SSL certificate settings. Official client enforces TLS 1.2 but Snowflake.Client don't - and I think it might be required for some regions.

Can you please prepend your code with these lines (before using Snowflake.Client):

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.CheckCertificateRevocationList = true;

And check if it solves the issue?

fixer-m commented 3 years ago

@mzaatar, do you still have this issue?

fixer-m commented 3 years ago

@mzaatar, I'm closing this since there is no response for a long time. If you still have this issue, you can open new issue. Thanks!