Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of internal CA signed certificates for msmtp #1498

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

dagonix
Copy link
Contributor

@dagonix dagonix commented Nov 14, 2022

By default, msmtp checks the validity of the certificate chain of the mail server. The new option "CMS_SMTP_CHECK_TLS_CERTIFICATE" allows use of TLS certificates signed by internal Certificate Authority that do not pass the default check. If the user sets "CMS_SMTP_CHECK_TLS_CERTIFICATE" to "NO" then the line "tls_nocertcheck" will be added to /etc/msmtprc (see dagonix/ xibo-docker/config.env.template commit).

By default, msmtp checks the validity of the certificate chain of the mail server.
The new option "CMS_SMTP_CHECK_TLS_CERTIFICATE" allows use of TLS certificates signed by internal Certificate Authority that do not pass the default check.
If the user sets "CMS_SMTP_CHECK_TLS_CERTIFICATE" to "NO" then the line "tls_nocertcheck" will be added to /etc/msmtprc (see  dagonix/ xibo-docker/config.env.template  commit).
@dasgarner
Copy link
Member

For this to work, I think we also need to add the environment variable to Dockerfile here?

By default, msmtp checks the validity of the certificate chain of the mail server. The new option "CMS_SMTP_CHECK_TLS_CERTIFICATE" allows use of TLS certificates signed by internal Certificate Authority that do not pass the default check. If the user sets "CMS_SMTP_CHECK_TLS_CERTIFICATE" to "NO" then the line "tls_nocertcheck" will be added to /etc/msmtprc
@dagonix
Copy link
Contributor Author

dagonix commented Nov 15, 2022

Yes ! You're right, I added the line there. Thank you.

@@ -289,6 +289,11 @@ then
/bin/sed -i "s/tls_starttls .*$/tls_starttls off/" /etc/msmtprc
fi

if [ "$CMS_SMTP_CHECK_TLS_CERTIFICATE" == "NO" ]
then
/bin/sed -i "s/tls .*$/tls_nocertcheck/" /etc/msmtprc
Copy link
Member

@alexharrington alexharrington Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will match the line:

tls on

and replace it with tls_nocertcheck?

But I think the correct syntax would be to have both? ie

tls on
tls_nocertcheck

Perhaps it might be better to have in the template msmtprc file

# CMS_SMTP_USE_TLS
tls on
#CMS_SMTP_CHECK_TLS_CERTIFICATE
#tls_nocertcheck

and then update the sed command to remove the comment if necessary?

/bin/sed -i "s/#tls_nocertcheck.*$/tls_nocertcheck/" /etc/msmtprc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, absolutly. Both options are necessary :

tls on
tls_nocertcheck

You are right Alex.

@dasgarner
Copy link
Member

I've moved this to 3.3.2 to allow more time to ensure we get it right. Issue: xibosignage/xibo#2939

@dagonix
Copy link
Contributor Author

dagonix commented Jan 2, 2023

Thank you Dan, Alex is right, both options are necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants