Roundup Tracker - Issues

Message8046

Author rouilj
Recipients kragacles, rouilj
Date 2024-05-15.01:44:11
Message-id <1715737451.15.0.513632022667.issue2551350@roundup.psfhosted.org>
In-reply-to
Hi Andrew:

Your patch to mailer.py includes a call to load_cert_chain(). Should that be
sslctx.load_cert_chain()?

If so can you try this patch:

====
diff -r 6763813d9d34 roundup/mailer.py
--- a/roundup/mailer.py Tue May 14 21:27:28 2024 -0400
+++ b/roundup/mailer.py Tue May 14 21:42:08 2024 -0400
@@ -6,6 +6,7 @@
 import os
 import smtplib
 import socket
+import ssl
 import sys
 import time
 import traceback
@@ -312,8 +313,15 @@
         # start the TLS if requested
         if config["MAIL_TLS"]:
             self.ehlo()
-            self.starttls(config["MAIL_TLS_KEYFILE"],
-                          config["MAIL_TLS_CERTFILE"])
+            if sys.version_info[0:2] >= (3, 12):
+                sslctx = ssl.SSLContext()
+                if config["MAIL_TLS_CERTFILE"]:
+                    sslctx.load_cert_chain(config["MAIL_TLS_CERTFILE"],
+                                           keyfile=config["MAIL_TLS_KEYFILE"])
+                    self.starttls(context=sslctx)
+            else:
+                self.starttls(config["MAIL_TLS_KEYFILE"],
+                              config["MAIL_TLS_CERTFILE"])

         # ok, now do we also need to log in?
         mailuser = config["MAIL_USERNAME"]
====

if I have the origin for load_cert_chain wrong, can you supply an updated
patch with the definition.

Thanks.

-- rouilj
History
Date User Action Args
2024-05-15 01:44:11rouiljsetmessageid: <1715737451.15.0.513632022667.issue2551350@roundup.psfhosted.org>
2024-05-15 01:44:11rouiljsetrecipients: + rouilj, kragacles
2024-05-15 01:44:11rouiljlinkissue2551350 messages
2024-05-15 01:44:11rouiljcreate