Skip to content

Commit ecd700f

Browse files
committed
[FIX] base: smtp_auth=certificate with SSL/TLS
Start a SMTPS server with client certificate authentication. In Odoo configure an outgoing mail server with encryption="ssl/tls" and authentication="certicifate". Load a valid client certificate and key to use with the SMTPS server then test the connection. The connection fails because the client certificate wasn't sent during the TLS handshake. If you're having trouble running a SMTPS server, I made a script here: https://gist.github.com/Julien00859/5090d1cff6c02197e5854aabb67bf5ac It uses aiosmtpd, a light pure python smtp server, install it with pip. You'll need to copy your snakeoil ssl key + cert inside your /tmp directory and to expose them to your current user: # public cert cp /etc/ssl/certs/ssl-cert-snakeoil.pem /tmp # private key sudo cp /etc/ssl/private/ssl-cert-snakeoil.key /tmp sudo chmod 400 /tmp/ssl-cert-snakeoil.key sudo chown $USER /tmp/ssl-cert-snakeoil.key task-3703209 closes odoo#162327 X-original-commit: b3d7c1f Signed-off-by: Thibault Delavallee (tde) <[email protected]>
1 parent e35913e commit ecd700f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

odoo/addons/base/models/ir_mail_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def connect(self, host=None, port=None, user=None, password=None, encryption=Non
396396
"You could use STARTTLS instead. "
397397
"If SSL is needed, an upgrade to Python 2.6 on the server-side "
398398
"should do the trick."))
399-
connection = smtplib.SMTP_SSL(smtp_server, smtp_port, timeout=SMTP_TIMEOUT)
399+
connection = smtplib.SMTP_SSL(smtp_server, smtp_port, timeout=SMTP_TIMEOUT, context=ssl_context)
400400
else:
401401
connection = smtplib.SMTP(smtp_server, smtp_port, timeout=SMTP_TIMEOUT)
402402

0 commit comments

Comments
 (0)