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

Check SSL-Context for IMAP4_SSL connections #69

Merged
merged 4 commits into from
Jun 7, 2016

Conversation

dmth
Copy link
Contributor

@dmth dmth commented Jun 7, 2016

As described in #68 imbox does currently not validate ssl certificates.

This PR introduces this validation.

Please note, that this fix might be incompatible with existing programs which rely on these missing checks.

Dustin Demuth and others added 4 commits June 2, 2016 11:00
software was altered, in order to use the systems SSL-Context as
default.

It allows to toggle the use of the SSL-Default Context. It does not
allow to use a custom context.

 Considerations:
 * If No SSL-Validation should be done, the ImboxClass should be adapted, in
   order to achieve configuration of the ssl-context. This commit does not
   contain this alteration.

 Other Changes:
 * Reformatted long lines
This reverts the approach to IMAP transport instantiation back to how it
was done prior to 2a0117b which introduced the usesslcontext parameter.
This reduces code duplication and importantly make instantiation work
again because self.IMAP4 and self.IMAP4_SSL do not exist.
The new ImapTransport parameter ssl_context replaces the usesslcontext
parameter and allows the user to supply their own ssl context object. If
ssl_context is not given, but ssl is true, python's default ssl context
is used. That default context is the one that actually does some
certificate checks, such as whether the hostname matches the names given
in the server's certificate and not the default context used by
IMAP4_SSL when instantiated with ssl_context=None which does not
certificate checks at all.

The Imbox class is extended with the same ssl_context parameter which is
simply passed through to ImapTransport.

This commit together with the previous commits from Dustin Demuth
changes Imbox in a slightly incompatible way: SSL-Certificates are now
checked by default whereas before they were not checked at all. This
improves security substantially but users need to be aware that working
programs might start raising exceptions due to failing certificate
checks.
@martinrusev martinrusev merged commit cb2cde3 into martinrusev:master Jun 7, 2016
@boussouira
Copy link

Related issue #70

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

4 participants