Search code examples
emailssljenkinstls1.2

How to Enable TLSv1.2 in Jenkins for SMTP


While working on enabling emails for jenkins, I met with an issue that blocked me for almost 4 days.

Issue : Emails sent out from jenkins using SMTP server were not working and error log showed issues with authenticating certificates.

After several tries with certificate rotation, updating private keys etc , this issue stumped me beyond my expectation.

Below is the resolution if it may help someone in future.


Solution

  • The Jenkins configuration was changed so that the JAVA_ARGS looked like below:

    JAVA_ARGS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true -Dmail.smtp.ssl.protocols=TLSv1.2"

    To resolve the issue, the following steps were performed:

    • Edit out the Jenkins configuration file (in Ubuntu, generally it is located at /etc/default/Jenkins) and add the arguments as highlighted above. (Ensure that you add both highlighted parameters!)

    • Restart the Jenkins service by typing in “service Jenkins restart”

    • Now open Jenkins Dashboard on your favorite browser and then navigate to – Manage Jenkins -> Configure System -> E-mail Notification.

    • Click on the Advanced button.

    • Ensure that “Use SSL” option is not selected – it needs to stay unchecked.

    • Hit the Save button. Email now works over TLSv1.2.