Skip to content

Feat: Add support for SSL#9

Open
pinzon wants to merge 3 commits intomasterfrom
feat/ssl-support
Open

Feat: Add support for SSL#9
pinzon wants to merge 3 commits intomasterfrom
feat/ssl-support

Conversation

@pinzon
Copy link
Member

@pinzon pinzon commented Mar 23, 2026

Motivation

This PR adds SSL support to the PostgreSQL proxy. Following @cloutierMat's recommendation, the necessary changes have been migrated from the LocalStack-Ext patches to this repository.

Changes

  • ssl_context attribute in Proxy class
  • _handle_ssl_negotiation method in Proxy class to handle SSL connection negotiation
  • accept_wrapper now utilizes _handle_ssl_negotiation if ssl_context exists

@pinzon pinzon force-pushed the feat/ssl-support branch 2 times, most recently from ea49177 to 18f038f Compare March 23, 2026 21:51
@pinzon pinzon marked this pull request as ready for review March 23, 2026 21:55
@pinzon pinzon requested review from cloutierMat March 23, 2026 22:02
@pinzon pinzon force-pushed the feat/ssl-support branch from 18f038f to 62b8c26 Compare March 23, 2026 22:15
Copy link
Member

@cloutierMat cloutierMat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving your changes here. I know it is a bit weird to keep the patch but I would prefer to keep the LOGS and exception handling out of here for better control over log levels.

Also if you are to keep the catch all except Exception as e I would at least add exc_info for DEBUG so that we can gain some insight on the error instead of covering it entirely

try:
# Peek at the first 8 bytes to check for SSLRequest
# Using MSG_PEEK so we don't consume the data if it's not SSLRequest
client_socket.setblocking(True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need to set blocking to True here, since this happens before we set blocking to False anyway, right?

Copy link
Member Author

@pinzon pinzon Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it's not necessary at all but since the socket is a parameter, I prefer to confirm/assert the blocking mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants