Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce & verify tls/ssl support #16

Open
affejunge opened this issue Dec 19, 2024 · 7 comments
Open

Introduce & verify tls/ssl support #16

affejunge opened this issue Dec 19, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@affejunge
Copy link

Hi all,

We observed that using the Client with connection parameters like this
Client.open(f"dbname='stac' user='{username}' password='{password}' host='{host}' port=5432 sslmode='require'")

on a database with ssl enabled, the connection is not established. The error message is

PgstacError: postgres: error performing TLS handshake: no TLS implementation configured

Using psycopg2 with the same connection parameters works fine. The connection is established and a query is executed successfully.
We tested with this 4976448
against db running pgstac:v0.9.1

@gadomski
Copy link
Member

Thanks for the report ... can you again after reinstalling? pip install --force git+https://github.com/stac-utils/pgstacrs. I've got a fix in #18 but haven't yet cooked up an easy way to test it.

@affejunge
Copy link
Author

Hi @gadomski thanks for the update.
I just reinstalled and tested with the same settings as mentioned above and still get the same error

PgstacError: postgres: error performing TLS handshake: no TLS implementation configured

using the sslmode 'require'.

@gadomski
Copy link
Member

gadomski commented Jan 8, 2025

Ok thanks for checking, I'll take another look this morning.

@gadomski
Copy link
Member

gadomski commented Jan 8, 2025

🤔 I'm wondering if you picked up the latest changes, as that error comes from NoTls: https://github.com/sfackler/rust-postgres/blob/d7ccc7e398755addf13096b55bdab49c2cc96156/tokio-postgres/src/tls.rs#L160. I've released v0.1.1, so can you do the following and try again?

pip install pgstacrs=0.1.1

@affejunge
Copy link
Author

thanks @gadomski just quickly tested and got the same error but I need to verify my env. Will get back to you.

@gadomski
Copy link
Member

Ok, if this doesn't work for you I'll put some time into standing up an SSL-enabled pgstac and trying to reproduce myself. Appreciate your patience 🙇🏼

@gadomski
Copy link
Member

You could also try setting https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT in your connection string? There's a chance that pyscopg2 sets some default that I'm not setting, so you could try to set the root cert yourself (maybe to system)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants