Xabaril / AspNetCore.Diagnostics.HealthChecks

Enterprise HealthChecks for ASP.NET Core Diagnostics Package
Apache License 2.0
4.04k stars 791 forks source link

NpgSql SSL-issue #733

Open olav89 opened 3 years ago

olav89 commented 3 years ago

What happened: Added healthcheck for NpgSql. It works great on a local postgres, but if I target it to a remote postgres and use SSL the healthcheck fails when connecting.

What you expected to happen: The remote database is running and I can connect to it - expected that healthcheck was ok.

How to reproduce it (as minimally and precisely as possible): Add healthcheck to postgres running remotely, use connection string with "Ssl Mode=Require"

Source code sample:

Anything else we need to know?: Downgrading to 3.3.1 removes the error

Environment:

unaizorrilla commented 3 years ago

Hi @olav89

Can you use connection action to prepare your connection with the specified ssl configuration?

olav89 commented 3 years ago

Setting "Trust Server Certificate=true" in connection string works, but it seems that the health check cant validate certificates otherwise.

I have found mention of the errors I got in these issues: https://github.com/npgsql/npgsql/issues/3246, https://github.com/npgsql/efcore.pg/issues/1576

Seems like this project uses 5.0.0-preview1 - maybe that needs to be updated to fix ssl issues?

unaizorrilla commented 3 years ago

Upgraded version to 5.0.3 release, hope this solver your issue, but take in count you can configure your connection with the "connection action" available on the registration method!

If this is ok, can you close the issues?