mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 04:36:31 +00:00
TLS always set ALPN for AWS IoT
This commit is contained in:
parent
40087595ae
commit
e98d632e07
@ -192,6 +192,7 @@ void MqttInit(void) {
|
|||||||
Settings->mqtt_port = 8883;
|
Settings->mqtt_port = 8883;
|
||||||
#endif //USE_MQTT_AZURE_IOT
|
#endif //USE_MQTT_AZURE_IOT
|
||||||
#ifdef USE_MQTT_TLS
|
#ifdef USE_MQTT_TLS
|
||||||
|
bool aws_iot_host = false;
|
||||||
if ((8883 == Settings->mqtt_port) || (8884 == Settings->mqtt_port) || (443 == Settings->mqtt_port)) {
|
if ((8883 == Settings->mqtt_port) || (8884 == Settings->mqtt_port) || (443 == Settings->mqtt_port)) {
|
||||||
// Turn on TLS for port 8883 (TLS), 8884 (TLS, client certificate), 443 (TLS, user/password)
|
// Turn on TLS for port 8883 (TLS), 8884 (TLS, client certificate), 443 (TLS, user/password)
|
||||||
Settings->flag4.mqtt_tls = true;
|
Settings->flag4.mqtt_tls = true;
|
||||||
@ -202,6 +203,7 @@ void MqttInit(void) {
|
|||||||
String host = String(SettingsText(SET_MQTT_HOST));
|
String host = String(SettingsText(SET_MQTT_HOST));
|
||||||
if (host.indexOf(F(".iot.")) && host.endsWith(F(".amazonaws.com"))) { // look for ".iot." and ".amazonaws.com" in the domain name
|
if (host.indexOf(F(".iot.")) && host.endsWith(F(".amazonaws.com"))) { // look for ".iot." and ".amazonaws.com" in the domain name
|
||||||
Settings->flag4.mqtt_no_retain = true;
|
Settings->flag4.mqtt_no_retain = true;
|
||||||
|
aws_iot_host = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mqtt.mqtt_tls) {
|
if (Mqtt.mqtt_tls) {
|
||||||
@ -211,12 +213,10 @@ void MqttInit(void) {
|
|||||||
tlsClient = new BearSSL::WiFiClientSecure_light(1024,1024);
|
tlsClient = new BearSSL::WiFiClientSecure_light(1024,1024);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MQTT_AWS_IOT_LIGHT
|
if (443 == Settings->mqtt_port && aws_iot_host) {
|
||||||
if (443 == Settings->mqtt_port) {
|
|
||||||
static const char * alpn_mqtt = "mqtt"; // needs to be static
|
static const char * alpn_mqtt = "mqtt"; // needs to be static
|
||||||
tlsClient->setALPN(&alpn_mqtt, 1); // need to set alpn to 'mqtt' for AWS IoT
|
tlsClient->setALPN(&alpn_mqtt, 1); // need to set alpn to 'mqtt' for AWS IoT
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef USE_MQTT_AWS_IOT
|
#ifdef USE_MQTT_AWS_IOT
|
||||||
loadTlsDir(); // load key and certificate data from Flash
|
loadTlsDir(); // load key and certificate data from Flash
|
||||||
if ((nullptr != AWS_IoT_Private_Key) && (nullptr != AWS_IoT_Client_Certificate)) {
|
if ((nullptr != AWS_IoT_Private_Key) && (nullptr != AWS_IoT_Client_Certificate)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user