-
Notifications
You must be signed in to change notification settings - Fork 874
Milestone
Description
Steps to reproduce
#r "nuget: Npgsql,9.0.1" // works with 8.0.6, fails with 9.0.1
let cnn = new Npgsql.NpgsqlConnection("Host=XXX.postgres.database.azure.com;Port=5432;Username=XXX;Password=XXX;Database=XXX;SSL Mode=VerifyFull;Timeout=10;Command Timeout=10;Minimum Pool Size=0;Maximum Pool Size=4")
cnn.Open()
The issue
In the above example, cnn.Open() works with Npgsql 8.0.6 but fails with Npgsql 9.0.1.
Exception message: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.
Stack trace:
Npgsql.NpgsqlException (0x80004005): Exception while performing SSL handshake
---> System.Security.Authentication.AuthenticationException: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.
at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at Npgsql.Internal.NpgsqlConnector.NegotiateEncryption(SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.Internal.NpgsqlConnector.NegotiateEncryption(SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.Internal.NpgsqlConnector.RawOpen(SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|214_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.PoolingDataSource.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.PoolingDataSource.<Get>g__RentAsync|33_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|42_0(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnection.Open()
Further technical details
Npgsql version: 9.0.1
PostgreSQL version: 14.13
Operating system: Azure Postgres Flexible Server
Workaround
SSL Mode=Require
Reactions are currently unavailable