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

allow unverified certificate #1382

Merged
merged 6 commits into from
Oct 16, 2023
Merged

allow unverified certificate #1382

merged 6 commits into from
Oct 16, 2023

Conversation

amitu
Copy link
Contributor

@amitu amitu commented Oct 15, 2023

Doc PR: fastn-stack/fastn.com#470

When connecting to PostgreSQL we currently support 1. unencrypted connection, and 2. verified certificate.

Heroku does not allow unencrypted connection, and the certificate they issue is self signed (I think), so can not be verified.

To support Heroku PostgreSQL we have added FASTN_PG_DANGER_ALLOW_UNVERIFIED_CERTIFICATE. If this environment variable is present, set to true, unverified certificate would be be accepted.

Using this environment variable is a bad idea and right certificate should be used in production using FASTN_PG_CERTIFICATE environment variable.

@amitu
Copy link
Contributor Author

amitu commented Oct 15, 2023

Having said that, I have not been able to figure out how to use the root certificate Heroku published. As per their docs the certificates are available at /etc/ssl/certs/ca-certificates.crt. But if I download it and try to use it:

heroku ps:copy /etc/ssl/certs/ca-certificates.crt -a fastn-todo-app
export FASTN_PG_CERTIFICATE=ca-certificates.crt
fastn serve --edition=2023

I get the following error:

WARN: FASTN_PG_DANGER_ALLOW_UNVERIFIED_CERTIFICATE is set to true, this is not recommended for production use
thread 'actix-server worker 2' panicked at /Users/amitu/Projects/fastn/fastn-core/src/library2022/processor/pg.rs:62:61:
called `Result::unwrap()` on an `Err` value: Error { code: -50, message: "One or more parameters passed to a function were not valid." }

@amitu amitu merged commit 7a89aca into main Oct 16, 2023
@amitu amitu deleted the pg_allow_unverified_certificate branch October 16, 2023 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant