Skip to content
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 specifying server_hostname via SNI when connecting #325

Merged
merged 3 commits into from
Jul 27, 2022

Conversation

dspangen
Copy link
Contributor

This specifically allows connections to be made over SSH tunnels via separately setting the server_hostname when constructing the SSL wrapper. Without this, one would have to modify /etc/hosts to achieve the same effect which isn't always possible in all environments.

Copy link
Member

@xzkostyan xzkostyan left a comment

Choose a reason for hiding this comment

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

LGTM.

Please fix flake8 error as well.

@@ -122,7 +127,7 @@ class Connection(object):
"""

def __init__(
self, host, port=None,
self, host, port=None, server_hostname=None,
Copy link
Member

Choose a reason for hiding this comment

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

server_hostname parameter should be placed at the end or in the "Secure socket parameters" section right after keyfile=None, certfile=None which is preferrable.

This will keep backwards compatibility for those who constructs client like Client('localhost', 9000, 'user', 'pass', 'mydb')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, good feedback, done

@xzkostyan
Copy link
Member

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0009%) to 96.59% when pulling 5315bf5 on trust-kaz:master into 4bbdef9 on mymarilyn:master.

@xzkostyan xzkostyan merged commit 9903ca6 into mymarilyn:master Jul 27, 2022
@dspangen
Copy link
Contributor Author

Thanks!

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.

None yet

3 participants