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

Controller does not allow opportunistic TLS #179

Closed
agronholm opened this issue Jan 4, 2020 · 3 comments · Fixed by #192
Closed

Controller does not allow opportunistic TLS #179

agronholm opened this issue Jan 4, 2020 · 3 comments · Fixed by #192
Milestone

Comments

@agronholm
Copy link

When a TLS context is passed to the controller and it is started, it starts a server which implicitly does the TLS handshake for all new clients. This behavior is not mentioned in the documentation. Not only that, but there seems to be no way to properly use STARTTLS without overriding the constructor and the factory() method of the Controller class to pass the context to the protocol, bypassing the server setup.

@waynew
Copy link
Collaborator

waynew commented Jan 5, 2020

Hi @agronholm, thanks for the report!

I believe that's what I had to do in my project. IIRC STARTTLS isn't quite yet supported.

@agronholm
Copy link
Author

This is what I did to make STARTTLS work:

class DummyController(Controller):
    def __init__(self, handler, factory=SMTP, hostname=None, port=0, *, ready_timeout=1.0,
                 enable_SMTPUTF8=True, ssl_context=None):
        super().__init__(handler, hostname=hostname, port=port, ready_timeout=ready_timeout,
                         enable_SMTPUTF8=enable_SMTPUTF8, ssl_context=None)
        self.__factory = factory
        self.__ssl_context = ssl_context

    def factory(self):
        return self.__factory(self.handler, enable_SMTPUTF8=self.enable_SMTPUTF8,
                              hostname=self.hostname, tls_context=self.__ssl_context)

@pepoluan
Copy link
Collaborator

Will the "pass-through" feature of 7289e6d suffice to solve this need?

@pepoluan pepoluan linked a pull request Oct 22, 2020 that will close this issue
4 tasks
@pepoluan pepoluan added this to the 1.3 milestone Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants