Conversation
Both modes were accepted, but still allowed plaintext connections, making them less secure than sslmode=require. This patch adds a `#ssl_required?` method that solves that problem. For `sslmode=verify-full` it just uses the default context, which enforces both CA and host/ip agreement. For `sslmode=verify-ca` there is a callback defined that ignores host/ip disagreements but otherwise passes through any errors. Root certificate resolves from sslrootcert, PGSSLROOTCERT, and then ~/.postgresql/root.crt. I updated the test CA with the minimum necessary to chain from it, and added a server SAN. The tests of the combinations all pass.
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.
Changes
sslmode=verify-fullandsslmode=verify-cato no longer accept plaintext connections--onlysslmode-requiredid so before.Adds a method
#ssl_required?to answer whether SSL must be negotiated.Adds a method
#resolved_sslrootcertto get the path to the SSL root certificate; this is determined from$PGSSLROOTCERTand/or thesslrootcertparameter, and defaults to~/.postgres/root.crton Linux/Darwin, or%APPDATA%/postgresql/root.crton Windows.