From 6165dd26dae4e7d23f18d490d8197a94fc73ee1f Mon Sep 17 00:00:00 2001 From: Steven Kuhn Date: Mon, 23 Oct 2023 11:24:38 -0500 Subject: [PATCH] Update MQTT settings to TLS by default --- source/Meadow.Core/Configuration/MeadowUpdateSettings.cs | 4 ++-- source/Meadow.Core/Update/UpdateService.cs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/Meadow.Core/Configuration/MeadowUpdateSettings.cs b/source/Meadow.Core/Configuration/MeadowUpdateSettings.cs index a22bd21e..188391a8 100644 --- a/source/Meadow.Core/Configuration/MeadowUpdateSettings.cs +++ b/source/Meadow.Core/Configuration/MeadowUpdateSettings.cs @@ -5,8 +5,8 @@ namespace Meadow; internal class MeadowUpdateSettings : IUpdateSettings { public bool Enabled { get; set; } = false; - public string UpdateServer { get; set; } = "mqtt-01.meadowcloud.co"; - public int UpdatePort { get; set; } = 1883; + public string UpdateServer { get; set; } = "mqtt.meadowcloud.co"; + public int UpdatePort { get; set; } = 8883; public string Organization { get; set; } = "Default organization"; public string RootTopic { get; set; } = "{OID}/ota/{ID};{OID}/commands/{ID}"; public int CloudConnectRetrySeconds { get; set; } = 15; diff --git a/source/Meadow.Core/Update/UpdateService.cs b/source/Meadow.Core/Update/UpdateService.cs index cf86d240..9e1efbf8 100644 --- a/source/Meadow.Core/Update/UpdateService.cs +++ b/source/Meadow.Core/Update/UpdateService.cs @@ -277,6 +277,10 @@ private async void UpdateStateMachine() Resolver.Log.Debug("Creating MQTT client options"); var builder = new MqttClientOptionsBuilder() .WithTcpServer(Config.UpdateServer, Config.UpdatePort) + .WithTls(tlsParameters => + { + tlsParameters.UseTls = Config.UpdatePort == 8883; + }) .WithProtocolVersion(MQTTnet.Formatter.MqttProtocolVersion.V500) .WithCommunicationTimeout(TimeSpan.FromSeconds(30));