Repository navigation
Use sslrootcert, sslcert and sslkey from a url instead of sending them to the server - #1308
Merged
Merged
Conversation
Owner
|
Thanks Efe, this matches libpq nicely: a CA with require/verify-ca checks the CA, verify-full also checks the host name, and a wrong CA is rejected. One thing: with : ssl === true || ssl === 'verify-full' ? files |
Contributor
Author
|
Done, with a test and a changelog entry. |
Merged
Owner
|
Thanks ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
?sslrootcert=systemis documented in the README, but on PostgreSQL it fails withunrecognized configuration parameter "sslrootcert", as every query parameter that isn't an option is sent as a startup parameter.?sslrootcert=/path/to/ca.pemfails the same way, while the same settings work in psql.The three parameters are no longer sent.
systemworks as documented, and files are read intoca,certandkey. As in libpq, a root certificate withrequireorverify-cachecks the CA but not the host name, andverify-fullorssl: truechecks both. With a file and nosslmodeI userequire, so a CA given in the url doesn't end in a plain connection, which is stricter than libpq'sprefer.sslmode=disablestill wins.Tested on PostgreSQL 15 and Node 22 for
system,verify-full,verify-ca,require, nosslmode,disableand a wrong CA, which is rejected. I testedsslcertandsslkeyonly as parsing, not against a server that asks for a client certificate. Unit tests pass, including four new ones. I did not run the integration suite.