diff --git a/bitwarden_license/src/Scim/Startup.cs b/bitwarden_license/src/Scim/Startup.cs index a28aa6dd23..3fac669eda 100644 --- a/bitwarden_license/src/Scim/Startup.cs +++ b/bitwarden_license/src/Scim/Startup.cs @@ -89,9 +89,6 @@ public class Startup services.AddScimGroupQueries(); services.AddScimUserQueries(); services.AddScimUserCommands(); - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/bitwarden_license/src/Sso/Startup.cs b/bitwarden_license/src/Sso/Startup.cs index a8f8109cb4..3aeb9c6beb 100644 --- a/bitwarden_license/src/Sso/Startup.cs +++ b/bitwarden_license/src/Sso/Startup.cs @@ -86,9 +86,6 @@ public class Startup // TODO: Remove when OrganizationUser methods are moved out of OrganizationService, this noop dependency should // TODO: no longer be required - see PM-1880 services.AddScoped(); - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs index b4ed9c5457..11f9e7ce68 100644 --- a/src/Admin/Startup.cs +++ b/src/Admin/Startup.cs @@ -129,9 +129,6 @@ public class Startup services.AddHostedService(); } } - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index 1a46eef015..1cc371ae1b 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -234,9 +234,6 @@ public class Startup { services.AddSingleton(); } - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/Billing/Startup.cs b/src/Billing/Startup.cs index e6b2ac03e9..63ed23c3d2 100644 --- a/src/Billing/Startup.cs +++ b/src/Billing/Startup.cs @@ -131,9 +131,6 @@ public class Startup // Swagger services.AddEndpointsApiExplorer(); services.AddSwaggerGen(); - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/Events/Startup.cs b/src/Events/Startup.cs index 7c93ffc987..366b562485 100644 --- a/src/Events/Startup.cs +++ b/src/Events/Startup.cs @@ -152,9 +152,6 @@ public class Startup globalSettings, globalSettings.EventLogging.RabbitMq.WebhookQueueName)); } - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/EventsProcessor/Startup.cs b/src/EventsProcessor/Startup.cs index a3b748a2ad..e397bd326b 100644 --- a/src/EventsProcessor/Startup.cs +++ b/src/EventsProcessor/Startup.cs @@ -82,9 +82,6 @@ public class Startup globalSettings.EventLogging.AzureServiceBus.WebhookSubscriptionName)); } services.AddHostedService(); - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/Icons/Startup.cs b/src/Icons/Startup.cs index a3ed0ddb67..4695c320e9 100644 --- a/src/Icons/Startup.cs +++ b/src/Icons/Startup.cs @@ -47,9 +47,6 @@ public class Startup // Mvc services.AddMvc(); - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/Identity/Startup.cs b/src/Identity/Startup.cs index 8b959deac0..320c91b248 100644 --- a/src/Identity/Startup.cs +++ b/src/Identity/Startup.cs @@ -163,9 +163,6 @@ public class Startup { client.BaseAddress = new Uri(globalSettings.BaseServiceUri.InternalSso); }); - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/src/Notifications/Startup.cs b/src/Notifications/Startup.cs index 01856b8ae9..440808b78b 100644 --- a/src/Notifications/Startup.cs +++ b/src/Notifications/Startup.cs @@ -76,9 +76,6 @@ public class Startup services.AddHostedService(); } } - - // This should be registered last because it customizes the primary http message handler and we want it to win. - services.AddX509ChainCustomization(); } public void Configure( diff --git a/util/Setup/Program.cs b/util/Setup/Program.cs index d3fca08a9e..68f5447c5f 100644 --- a/util/Setup/Program.cs +++ b/util/Setup/Program.cs @@ -1,11 +1,7 @@ using System.Globalization; using System.Net.Http.Json; -using Bit.Core.Settings; using Bit.Migrator; using Bit.Setup.Enums; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; namespace Bit.Setup; @@ -289,29 +285,8 @@ public class Program url = $"{installationUrl}/installations/"; } - var config = new ConfigurationBuilder() - .AddInMemoryCollection(new Dictionary - { - // Setup uses a different default location for the location of the CA certificates. - ["X509ChainOptions:AdditionalCustomTrustCertificatesDirectory"] = "/bitwarden/ca-certificates", - }) - // Still allow customization through environment variables though - .AddEnvironmentVariables() - .Build(); - // We need to get an HttpClient that has been configured with custom trust certificates. - var httpClient = new ServiceCollection() - .AddX509ChainCustomization() - .AddSingleton(config) - // Setup is always ran for self hosted, so it's fine to hard code this to true and allow chain customization - .AddSingleton(new GlobalSettings { SelfHosted = true }) - .AddLogging() - .AddSingleton(new SetupHostEnvironment()) - .BuildServiceProvider() - .GetRequiredService() - .CreateClient(); - - var response = httpClient.GetAsync(url + _context.Install.InstallationId).GetAwaiter().GetResult(); + var response = new HttpClient().GetAsync(url + _context.Install.InstallationId).GetAwaiter().GetResult(); if (!response.IsSuccessStatusCode) {