case 4724 - SMTP certificate checked, password never returned
Mailer checks the SMTP server's certificate (trust and name; no revocation check). New config setting AYANOVA_SMTP_ACCEPT_ANY_CERTIFICATE accepts any certificate (boot warning, shown in server info, manual page). The notification settings GET returns ******** instead of the SMTP password; a PUT with ******** or empty keeps the stored password. F30 and F31 fixed. Changelog and manual updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -83,7 +83,12 @@ namespace AyaNova.Util
|
||||
|
||||
using (var client = new SmtpClient())
|
||||
{
|
||||
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
||||
//case 4724: the server's certificate must be trusted and match the server name, unless the
|
||||
//AYANOVA_SMTP_ACCEPT_ANY_CERTIFICATE setting says otherwise. No revocation check: it fails the
|
||||
//connection whenever the certificate authority's revocation server can't be reached
|
||||
client.CheckCertificateRevocation = false;
|
||||
if (ServerBootConfig.AYANOVA_SMTP_ACCEPT_ANY_CERTIFICATE)
|
||||
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
||||
|
||||
bool UseSSL = smtpSettings.ConnectionSecurity != Biz.NotifyMailSecurity.None;
|
||||
await client.ConnectAsync(smtpSettings.SmtpServerAddress, smtpSettings.SmtpServerPort, UseSSL);
|
||||
|
||||
@@ -108,6 +108,10 @@ namespace AyaNova.Util
|
||||
//SECURITY
|
||||
internal static string AYANOVA_SET_SUPERUSER_PW { get; set; }
|
||||
|
||||
//EMAIL
|
||||
//case 4724: the SMTP server's certificate is checked unless this is set (a mail server with a self-signed or internal certificate)
|
||||
internal static bool AYANOVA_SMTP_ACCEPT_ANY_CERTIFICATE { get; set; }
|
||||
|
||||
//HELPFUL INFORMATION FOR DIAGNOSTICS
|
||||
internal static Dictionary<string, string> BOOT_DIAGNOSTIC_INFO { get; set; } =
|
||||
new Dictionary<string, string>();
|
||||
@@ -218,6 +222,10 @@ namespace AyaNova.Util
|
||||
bTemp = config.GetValue<bool?>("AYANOVA_REMOVE_LICENSE_FROM_DB");
|
||||
AYANOVA_REMOVE_LICENSE_FROM_DB = (null == bTemp) ? false : (bool)bTemp;
|
||||
|
||||
//EMAIL
|
||||
bTemp = config.GetValue<bool?>("AYANOVA_SMTP_ACCEPT_ANY_CERTIFICATE");
|
||||
AYANOVA_SMTP_ACCEPT_ANY_CERTIFICATE = (null == bTemp) ? false : (bool)bTemp;
|
||||
|
||||
//FOLDERS
|
||||
string DataFolderPath = ActualFullPath(config.GetValue<string>("AYANOVA_DATA_PATH"));
|
||||
string LogPath = ActualFullPath(config.GetValue<string>("AYANOVA_LOG_PATH"));
|
||||
|
||||
Reference in New Issue
Block a user