------------------------------------------------------------
revno: 1649
fixes bug: https://launchpad.net/bugs/558281
committer: Mark Sapiro <[email protected]>
branch nick: 2.1
timestamp: Fri 2016-05-06 14:44:28 -0700
message:
Implement SASL and STARTTLS in SMTPDirect.py.
modified:
Mailman/Defaults.py.in
Mailman/Handlers/SMTPDirect.py
NEWS
--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1
Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Defaults.py.in'
--- Mailman/Defaults.py.in 2016-04-21 15:01:01 +0000
+++ Mailman/Defaults.py.in 2016-05-06 21:44:28 +0000
@@ -562,6 +562,22 @@
# when DELIVERY_MODULE is 'Sendmail'.
SENDMAIL_CMD = '/usr/lib/sendmail'
+# SMTP authentication for DELIVERY_MODULE = 'SMTPDirect'. To enable SASL
+# authentication for SMTPDirect, set SMTP_AUTH = Yes and provide appropriate
+# settings for SMTP_USER and SMTP_PASSWD.
+SMTP_AUTH = No
+SMTP_USER = ''
+SMTP_PASSWD = ''
+
+# If using SASL authentication (SMTP_AUTH = Yes), set the following to Yes
+# to also use TLS. This has no effect if SMTP_AUTH = No.
+SMTP_USE_TLS = No
+
+# When using TLS the following should be set to the hostname that should be
+# used in order to identify Mailman to the SMTP server. By default, it
+# uses DEFAULT_URL_HOST. Normally, you should not change this.
+SMTP_HELO_HOST = DEFAULT_URL_HOST
+
# Set these variables if you need to authenticate to your NNTP server for
# Usenet posting or reading. If no authentication is necessary, specify None
# for both variables.
=== modified file 'Mailman/Handlers/SMTPDirect.py'
--- Mailman/Handlers/SMTPDirect.py 2016-04-21 15:01:01 +0000
+++ Mailman/Handlers/SMTPDirect.py 2016-05-06 21:44:28 +0000
@@ -63,6 +63,36 @@
self.__conn = smtplib.SMTP()
self.__conn.set_debuglevel(mm_cfg.SMTPLIB_DEBUG_LEVEL)
self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)
+ if mm_cfg.SMTP_AUTH:
+ if mm_cfg.SMTP_USE_TLS:
+ try:
+ self.__conn.starttls()
+ except SMTPException, e:
+ syslog('smtp-failure', 'SMTP TLS error: %s', e)
+ self.quit()
+ raise
+ try:
+ self.__conn.ehlo(mm_cfg.SMTP_HELO_HOST)
+ except SMTPException, e:
+ syslog('smtp-failure', 'SMTP EHLO error: %s', e)
+ self.quit()
+ raise
+ try:
+ self.__conn.login(mm_cfg.SMTP_USER, mm_cfg.SMTP_PASSWD)
+ except smtplib.SMTPHeloError, e:
+ syslog('smtp-failure', 'SMTP HELO error: %s', e)
+ self.quit()
+ raise
+ except smtplib.SMTPAuthenticationError, e:
+ syslog('smtp-failure', 'SMTP AUTH error: %s', e)
+ self.quit()
+ raise
+ except smtplib.SMTPException, e:
+ syslog('smtp-failure',
+ 'SMTP - no suitable authentication method found: %s', e)
+ self.quit()
+ raise
+
self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION
def sendmail(self, envsender, recips, msgtext):
=== modified file 'NEWS'
--- NEWS 2016-05-05 01:27:19 +0000
+++ NEWS 2016-05-06 21:44:28 +0000
@@ -9,6 +9,11 @@
New Features
+ - SMTPDirect.py can now do SASL authentication and STARTTLS security when
+ connecting to the outgoiung MTA. Associated with this are new
+ Defaults.py/mm_cfg.py settings SMTP_AUTH, SMTP_USER, SMTP_PASSWD and
+ SMTP_USE_TLS. (LP: #558281)
+
- There is a new Defaults.py/mm_cfg.py setting SMTPLIB_DEBUG_LEVEL which
can be set to 1 to enable verbose smtplib debugging to Mailman's error
log to help with debugging 'low level smtp failures'. (LP: # 1573074)
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org