From: Nizamudeen A Date: Thu, 30 Oct 2025 04:35:04 +0000 (+0530) Subject: mgr/alerts: enforce ssl context to SMTP_SSL X-Git-Tag: testing/wip-jcollin-testing-20260212.143545-tentacle~68^2~9^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1167b9de50c8e79e8f3d09014e4d78004abf7547;p=ceph-ci.git mgr/alerts: enforce ssl context to SMTP_SSL Fixes: https://github.com/ceph/ceph/security/advisories/GHSA-xj9f-7g59-m4jx Signed-off-by: Nizamudeen A (cherry picked from commit 5f7fc5267e55089eeb1cfc87e9c1215c32439102) --- diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index 50ec520d346..2374434aea7 100644 --- a/src/pybind/mgr/alerts/module.py +++ b/src/pybind/mgr/alerts/module.py @@ -9,6 +9,7 @@ from threading import Event from typing import Any, Optional, Dict, List, TYPE_CHECKING, Union import json import smtplib +import ssl class Alerts(MgrModule): @@ -236,9 +237,10 @@ class Alerts(MgrModule): # send try: + context = ssl.create_default_context() if self.smtp_ssl: server: Union[smtplib.SMTP_SSL, smtplib.SMTP] = \ - smtplib.SMTP_SSL(self.smtp_host, self.smtp_port) + smtplib.SMTP_SSL(self.smtp_host, self.smtp_port, context=context) else: server = smtplib.SMTP(self.smtp_host, self.smtp_port) if self.smtp_password: