[Email] Enable SSL for email and MQTT on all ESP32-xx builds

This commit is contained in:
TD-er
2024-10-06 21:46:58 +02:00
parent 52da6473ef
commit aa1f9bb49a
5 changed files with 92 additions and 7 deletions
@@ -653,7 +653,7 @@ int WiFiClientSecure_light::_run_until(unsigned target, bool blocking) {
This is unrecoverable here, so we report an error.
*/
if (state & BR_SSL_RECVAPP) {
DEBUG_BSSL("_run_until: Fatal protocol state\n");
DEBUG_BSSL("_run_until: Fatal protocol state\n");
return -1;
}
+69
View File
@@ -13,8 +13,59 @@
// Root Certificates taken from:
// https://github.com/arendst/Tasmota/blob/b2b839fa83b622c3d28324ac4d6db7ab133741c6/tasmota/tasmota_support/tasmota_ca.ino#L177
// https://openslab-osu.github.io/bearssl-certificate-utility/
#if ! defined(OMIT_GOOGLE_COM_CERT)
/*
* Label: GlobalSign Root CA
* Subject: CN=GlobalSign Root CA,OU=Root CA,O=GlobalSign nv-sa,C=BE
* Domain(s): www.google.com
*/
static const unsigned char PROGMEM GOOGLE_DN[] = {
0x30, 0x57, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x42, 0x45, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0a,
0x13, 0x10, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e,
0x20, 0x6e, 0x76, 0x2d, 0x73, 0x61, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
0x55, 0x04, 0x0b, 0x13, 0x07, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41,
0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x12, 0x47,
0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x52, 0x6f,
0x6f, 0x74, 0x20, 0x43, 0x41,
};
static const unsigned char PROGMEM GOOGLE_RSA_N[] = {
0xda, 0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 0x05, 0x8c, 0xb9, 0x77, 0x8b, 0xb1, 0xdb, 0x1f,
0x20, 0x91, 0xab, 0x09, 0x53, 0x6e, 0x90, 0xce, 0x7b, 0x37, 0x74, 0xb9,
0x70, 0x47, 0x91, 0x22, 0x51, 0x63, 0x16, 0x79, 0xae, 0xb1, 0xae, 0x41,
0x26, 0x08, 0xc8, 0x19, 0x2b, 0xd1, 0x46, 0xaa, 0x48, 0xd6, 0x64, 0x2a,
0xd7, 0x83, 0x34, 0xff, 0x2c, 0x2a, 0xc1, 0x6c, 0x19, 0x43, 0x4a, 0x07,
0x85, 0xe7, 0xd3, 0x7c, 0xf6, 0x21, 0x68, 0xef, 0xea, 0xf2, 0x52, 0x9f,
0x7f, 0x93, 0x90, 0xcf,
};
static const unsigned char PROGMEM GOOGLE_RSA_E[] = {
0x01, 0x00, 0x01,
};
#endif
#if ! defined(OMIT_LETS_ENCRYPT_CERT)
/*********************************************************************************************\
@@ -148,6 +199,24 @@ static const unsigned char PROGMEM AmazonRootCA1_RSA_E[] = {
// ========== cumulative CA =================
//
const br_x509_trust_anchor PROGMEM Tasmota_TA[] = {
#if ! defined(OMIT_GOOGLE_COM_CERT)
{
{ (unsigned char *)GOOGLE_DN, sizeof GOOGLE_DN },
BR_X509_TA_CA,
{
BR_KEYTYPE_RSA,
{ .rsa = {
(unsigned char *)GOOGLE_RSA_N, sizeof GOOGLE_RSA_N,
(unsigned char *)GOOGLE_RSA_E, sizeof GOOGLE_RSA_E,
} }
}
}
#if ! defined(OMIT_LETS_ENCRYPT_CERT) || defined(INCLUDE_LOCAL_CERT)
,
#endif
#endif
#if ! defined(OMIT_LETS_ENCRYPT_CERT)
{
{ (unsigned char *)LetsEncrypt_ISRG_Root_X1_DN, sizeof LetsEncrypt_ISRG_Root_X1_DN },
+10 -2
View File
@@ -2982,11 +2982,19 @@ To create/register a plugin, you have to :
#endif
#ifndef FEATURE_MQTT_TLS
#define FEATURE_MQTT_TLS 0
#if defined(ESP32) && ESP_IDF_VERSION_MAJOR >= 5
#define FEATURE_MQTT_TLS 1
#else
#define FEATURE_MQTT_TLS 0
#endif
#endif
#ifndef FEATURE_EMAIL_TLS
#define FEATURE_EMAIL_TLS 0
#if defined(ESP32) && ESP_IDF_VERSION_MAJOR >= 5
#define FEATURE_EMAIL_TLS 1
#else
#define FEATURE_EMAIL_TLS 0
#endif
#endif
+7 -2
View File
@@ -70,12 +70,12 @@ bool NPlugin_001_send(const NotificationSettingsStruct& notificationsettings, St
notificationsettings.Port,
client.getLastError()));
#else
# else // if FEATURE_EMAIL_TLS
addLog(LOG_LEVEL_ERROR, strformat(
F("Email: Error connecting to %s:%u"),
notificationsettings.Server,
notificationsettings.Port));
#endif
# endif // if FEATURE_EMAIL_TLS
}
myStatus = false;
failFlag = true;
@@ -175,6 +175,11 @@ bool NPlugin_001_send(const NotificationSettingsStruct& notificationsettings, St
getSystemBuildString().c_str());
}
# if FEATURE_EMAIL_TLS
client.setDomainName(notificationsettings.Domain);
# endif // if FEATURE_EMAIL_TLS
// Make sure to replace the char '\r' and not the string "\r"
// See: https://github.com/letscontrolit/ESPEasy/issues/4967
removeChar(body, '\r');
+5 -2
View File
@@ -351,8 +351,11 @@ void addFormPasswordBox(const String& label, const String& id, const String& pas
bool getFormPassword(const String& id, String& password)
{
password = webArg(id);
addLog(LOG_LEVEL_INFO, concat(F("getFormPassword: "), password));
/*
if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
addLog(LOG_LEVEL_DEBUG, concat(F("getFormPassword: "), password));
}
*/
return !equals(password, F("*****"));
}