-
Notifications
You must be signed in to change notification settings - Fork 2
Add canonical PostgreSQL client parameter sslmode
#202
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -228,8 +228,12 @@ | |||||
servers = to_list(server) | ||||||
if servers: | ||||||
use_ssl = asbool(kwargs.pop("ssl", False)) | ||||||
if use_ssl: | ||||||
# TODO: Switch to the canonical default `sslmode=prefer` later. | ||||||
sslmode = kwargs.pop("sslmode", "disable") | ||||||
if use_ssl or sslmode in ["allow", "prefer", "require", "verify-ca", "verify-full"]: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The patch is intended to set the stage to transition to PostgreSQL conventions, so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that is the intention, then we should deprecate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, documentation needs to be added. I will reflect that correspondingly, but did not intend to deprecate the If you think it is the right choice to officially deprecate it, but still keep it just for bwc reasons, sure I can do it timely. I am trying to find out about your opinion on this. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least this should be documented as it may not behave as expected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imho, it wouldn't make sense to keep 2 different mechanisms in the future, or do you see some value in that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. Let's just keep it for bwc purposes until we may remove the previous one, possibly paired with a 1.0.0 release? |
||||||
servers = ["https://" + server for server in servers] | ||||||
if sslmode == "require": | ||||||
kwargs["verify_ssl_cert"] = False | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks odd as it disables cert verification even that the user did not intend to do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, but this will disable cert verification for everyone who uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We think The PostgreSQL docs possibly uses uncommon jargon there, that's why it is sometimes difficult to understand, but of course we may also be wrong on this detail. 1 Please validate and clarify. Footnotes
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah ok, I understood it wrongly, thanks for the clarification. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would we want to disable hostname validation with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi. It's for the same reasons PostgreSQL and other network clients talking SSL offer the same option in one way or another. The specific need is originating from cloud operations when connecting to CrateDB/SSL from internal spots within an K8s cluster. @WalBeh can possibly explain it better. |
||||||
return self.dbapi.connect(servers=servers, **kwargs) | ||||||
return self.dbapi.connect(**kwargs) | ||||||
Comment on lines
237
to
238
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When evaluating the patch downstream using Currently, it bails out like this: TypeError: Connection.__init__() got an unexpected keyword argument 'sslmode' The reason is, as you can observe above, that two different code paths are used here. |
||||||
|
||||||
|
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.