From fd1e73dfd49300ba24b85f86ba55edfec1fb7d7b Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 24 Aug 2023 19:47:00 -0400 Subject: [PATCH] Add prompt for SQLServer connection encryption --- src/Tgstation.Server.Host/Setup/SetupWizard.cs | 8 +++++--- .../Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs index 92b3d53c42..35024c47bb 100644 --- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs +++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs @@ -501,16 +501,16 @@ namespace Tgstation.Server.Host.Setup } while (true); - bool useWinAuth; + var useWinAuth = false; + var encrypt = false; if (databaseConfiguration.DatabaseType == DatabaseType.SqlServer && platformIdentifier.IsWindows) { var defaultResponse = serverAddressEntry?.AddressList.Any(IPAddress.IsLoopback) ?? false ? (bool?)true : null; useWinAuth = await PromptYesNo("Use Windows Authentication?", defaultResponse, cancellationToken); + encrypt = await PromptYesNo("Use encrypted connection?", false, cancellationToken); } - else - useWinAuth = false; await console.WriteAsync(null, true, cancellationToken); @@ -566,6 +566,8 @@ namespace Tgstation.Server.Host.Setup csb.Password = password; } + csb.Encrypt = encrypt; + CreateTestConnection(csb.ConnectionString); csb.InitialCatalog = databaseName; databaseConfiguration.ConnectionString = csb.ConnectionString; diff --git a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs index 7ad15d9ad0..c60d7308c2 100644 --- a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs +++ b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs @@ -181,6 +181,8 @@ namespace Tgstation.Server.Host.Setup.Tests "no", //test winauth "yes", + // encrypt + "YES", //sql server will always fail so reconfigure with maria nameof(DatabaseType.MariaDB), "127.0.0.1",