Enable connection with encryption without certificate validation (#1386)

* Enable connection with encryption without certificate validation
* Add the cert validation for AWS env
This commit is contained in:
Florian authored and GitHub committed 2023-01-12 10:35:42 -06:00
1 parent 9d6f7a0764
commit 4678783db5
3 files changed
+12 -1

No files matched your search

+7 -1
View File
@@ -213,6 +213,7 @@ static unsigned long last_ota_activity_millis = 0;
# define isDiscovered(device) device->isDisc
static bool mqtt_secure = MQTT_SECURE_DEFAULT;
static bool mqtt_cert_validate = MQTT_CERT_VALIDATE_DEFAULT;
static uint8_t mqtt_ss_index = MQTT_SECURE_SELF_SIGNED_INDEX_DEFAULT;
static String mqtt_cert = "";
static String ota_server_cert = "";
@@ -729,7 +730,12 @@ void setup() {
#if defined(ESP8266) || defined(ESP32)
if (mqtt_secure) {
eClient = new WiFiClientSecure;
setupTLS(MQTT_SECURE_SELF_SIGNED, mqtt_ss_index);
if (mqtt_cert_validate) {
setupTLS(MQTT_SECURE_SELF_SIGNED, mqtt_ss_index);
} else {
WiFiClientSecure* sClient = (WiFiClientSecure*)eClient;
sClient->setInsecure();
}
} else {
eClient = new WiFiClient;
}