Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
domotikad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
domotika
domotikad
Commits
b5328fca
Commit
b5328fca
authored
May 31, 2016
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable SSLv3 for mail client
parent
4197d276
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
dmmail.py
domotika/mail/dmmail.py
+15
-4
No files found.
domotika/mail/dmmail.py
View file @
b5328fca
...
@@ -23,8 +23,7 @@
...
@@ -23,8 +23,7 @@
import
sys
import
sys
from
OpenSSL.SSL
import
SSLv3_METHOD
from
OpenSSL.SSL
import
OP_NO_SSLv3
from
twisted.mail.smtp
import
ESMTPSenderFactory
from
twisted.mail.smtp
import
ESMTPSenderFactory
from
twisted.python.usage
import
Options
,
UsageError
from
twisted.python.usage
import
Options
,
UsageError
from
twisted.internet.ssl
import
ClientContextFactory
from
twisted.internet.ssl
import
ClientContextFactory
...
@@ -38,6 +37,18 @@ import logging
...
@@ -38,6 +37,18 @@ import logging
log
=
logging
.
getLogger
(
'Mail'
)
log
=
logging
.
getLogger
(
'Mail'
)
class
ContextFactory
(
ClientContextFactory
):
"""Context factory that disables SSLv3 (POODLE attack)."""
def
getContext
(
self
):
"""Get the parent context but disable SSLv3."""
ctx
=
ClientContextFactory
.
getContext
(
self
)
ctx
.
set_options
(
OP_NO_SSLv3
)
return
ctx
class
DMEmail
(
object
):
class
DMEmail
(
object
):
needauth
=
False
needauth
=
False
...
@@ -107,8 +118,8 @@ class DMEmail(object):
...
@@ -107,8 +118,8 @@ class DMEmail(object):
def
send
(
self
,
usemime
=
True
):
def
send
(
self
,
usemime
=
True
):
log
.
info
(
"Sending email from "
+
str
(
self
.
sender
)
+
" to "
+
str
(
self
.
to
)
+
" with subject "
+
str
(
self
.
subject
))
log
.
info
(
"Sending email from "
+
str
(
self
.
sender
)
+
" to "
+
str
(
self
.
to
)
+
" with subject "
+
str
(
self
.
subject
))
contextFactory
=
C
lientC
ontextFactory
()
contextFactory
=
ContextFactory
()
contextFactory
.
method
=
SSLv3_METHOD
#
contextFactory.method = SSLv3_METHOD
if
usemime
:
if
usemime
:
msg
=
MIMEText
(
self
.
message
)
msg
=
MIMEText
(
self
.
message
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment