Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Share an SSL context object between SSL connections #5417

Merged
merged 8 commits into from
Jun 10, 2019

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Jun 10, 2019

Hopefully fixes massive memory use with federation_verify_certificates: true,
by sharing a couple of openssl context objects between all connections.

This involves changing how the info callbacks work and is generally a bit of a
rewrite of the context_factory stuff.

Also fixes a bug where connections to IP literal homeservers would always fail.

richvdh added 4 commits June 9, 2019 14:01
This involves changing how the info callbacks work.
turns out we need a shiny version of service_identity to enforce this
correctly.
Add some tests for bad certificates for federation and .well-known connections
@richvdh richvdh requested a review from a team June 10, 2019 15:17
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

I think this looks sane?

# ... and we also gut-wrench a 'tls_verifier' attribute into the
# tls_protocol so that the SSL context's info callback has something to
# call to do the cert verification.
setattr(tls_protocol, "tls_verifier", self._verifier)
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the Twisted code it looks somewhat like nothing else actually uses the app data, so I wonder if we can avoid the gut wrenching here.

But since we are gut wrenching can we name space this so that we don't accidentally collide with a param in twisted, e.g. _synapse_tls_verifier?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at the Twisted code it looks somewhat like nothing else actually uses the app data, so I wonder if we can avoid the gut wrenching here.

that didn't seem like an assumption I particularly wanted to make.

But since we are gut wrenching can we name space this so that we don't accidentally collide with a param in twisted, e.g. _synapse_tls_verifier?

fair

@erikjohnston erikjohnston merged commit a6b1817 into release-v1.0.0 Jun 10, 2019
@richvdh richvdh deleted the rav/shared_ssl_context branch June 24, 2019 16:47
@erikjohnston
Copy link
Member

This has fixed: #5395

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants