From 70755f416b23705eddf1f7aa70daf7257de7fce6 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Sat, 30 Sep 2023 20:39:42 +0200 Subject: [PATCH] Fix self-signed cert for SMTP servers (#2574) Signed-off-by: Daniel Hansson --- addons/smtp-mail.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/addons/smtp-mail.sh b/addons/smtp-mail.sh index 2dd24599..f73ed503 100644 --- a/addons/smtp-mail.sh +++ b/addons/smtp-mail.sh @@ -148,6 +148,17 @@ fi # Enter the recipient RECIPIENT=$(input_box_flow "Please enter the recipient email address that shall receive all mails.\nE.g. recipient@mail.com") +# Check if the server use self-signed certificates +if yesno_box_no "Does the SMTP-server use self-signed certificates?" +then + SELF_SIGNED_CERT=yes + nextcloud_occ config:system:set mail_smtpstreamoptions ssl allow_self_signed --value=true + nextcloud_occ config:system:set mail_smtpstreamoptions ssl verify_peer --value=false + nextcloud_occ config:system:set mail_smtpstreamoptions ssl verify_peer_name --value=false +else + SELF_SIGNED_CERT=no +fi + # Present what we gathered, if everything okay, write to files msg_box "These are the settings that will be used. Please check that everything seems correct. @@ -156,11 +167,13 @@ Encryption=$PROTOCOL SMTP Port=$SMTP_PORT SMTP Username=$MAIL_USERNAME SMTP Password=$MAIL_PASSWORD -Recipient=$RECIPIENT" +Recipient=$RECIPIENT +Self-signed TLS/SSL certificate=$SELF_SIGNED_CERT" # Ask if everything is okay if ! yesno_box_yes "Does everything look correct?" then + msg_box "OK, please start over by running this script again." exit fi