-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add support for SSL options #22
Conversation
Hello! I was under the impression that since OTP26 this is no longer required due to the default being to use system cacerts. This is why HTTPC et al can now be safely used without further configuration, while before you needed to manually provide this configuration for each connection. Have you been having issues with TLS? Thanks |
That's weird, because I effectively had no problem with HTTPC without further configuration. However, when trying to reach a Render (render.com) PG instance through HTTPS, I had to explicitly ask to disable peer verification. I can provide you an example if you need. And a non-working HTTPS endpoint too! Quoting the docs, that's what I did:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to explicitly ask to disable peer verification. I can provide you an example if you need.
And your application had access to appropriate cacerts via the host? Huh.
OK supporting this configuration sounds good, but we should have a properly design API rather than copying the Erlang API which permits many redundant and invalid configurations. It needs to only support configurations that make sense and are valid.
Can confirm it's not working anymore with OTP26. Maybe we can wait for pgo issue to handle it correctly. |
Maybe we can have an API like pub type Config {
/// Other fields omitted for brevity
Config(ssl: Ssl)
}
pub type Ssl {
Disabled
Enabled
VerifyPeers(Cacerts)
}
pub type Cacerts {
/// List of certificates to verify against.
Cacerts(certs: List(BitArray))
/// Filename of certificate to verify against.
Cacertfile(filename: String)
} That way, the SSL is always in a correct state:
The only required part would be to map that types to the proper pgo tuples used by pgo during initialization. |
Wouldn't we always want to verify peers? What does enabled do if it doesn't verify? |
In some environments, the certificate can be self-issued, and you'd have to add the CA certificate to the chain. In this case, verification will fail if using standard certificates. Skipping verification would solve this (in an unsound way). It seems fair enough if you're running in a secured environment that requires you to use SSL (like, I don't know, AWS). |
Which option is skipping verification? Wouldn't that be a 4th option? |
I tried another way, and it's working like a charm! I'm curious to have your thoughts on that flow. In the end, I took decision to do an opinionated checking, otherwise SSL is useless. I'm also trying to see if providing defaults on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful! This looks fantastic. Could you update the changelog also please? 🙏
I think it would be excellent if this was included in PGO too
It's done! Feel free to update the branch or merge whenever you want! For history, I'm trying to see what I can do for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hero!!!
That PR add support for SSL options.
This is required since OTP 26.
PR to merge after arrays has been merged. #22