From ddcb106e62a1078f06e50b96f5c4a5c78b3a0a31 Mon Sep 17 00:00:00 2001 From: Joel Verhagen Date: Wed, 28 Feb 2018 17:59:49 -0800 Subject: [PATCH 1/4] Enable TLS 1.2 in build.ps1 (#58) Progress on https://github.com/NuGet/NuGetGallery/issues/5551 --- build.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.ps1 b/build.ps1 index 67d48e20..5dace8ec 100644 --- a/build.ps1 +++ b/build.ps1 @@ -24,6 +24,10 @@ trap { if (-not (Test-Path "$PSScriptRoot/build")) { New-Item -Path "$PSScriptRoot/build" -ItemType "directory" } + +# Enable TLS 1.2 since GitHub requires it. +[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 + wget -UseBasicParsing -Uri "https://raw.githubusercontent.com/NuGet/ServerCommon/$BuildBranch/build/init.ps1" -OutFile "$PSScriptRoot/build/init.ps1" . "$PSScriptRoot/build/init.ps1" -BuildBranch "$BuildBranch" From 94ee01b54ad50562a9dfc6d308d06e3fb7b25c00 Mon Sep 17 00:00:00 2001 From: ericcoleman Date: Tue, 4 Sep 2018 15:46:49 -0400 Subject: [PATCH 2/4] Add route to match older Nuget.Server uploads (#62) --- src/NuGet.Server.V2/NuGetV2WebApiEnabler.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NuGet.Server.V2/NuGetV2WebApiEnabler.cs b/src/NuGet.Server.V2/NuGetV2WebApiEnabler.cs index 98830c9f..9915b74f 100644 --- a/src/NuGet.Server.V2/NuGetV2WebApiEnabler.cs +++ b/src/NuGet.Server.V2/NuGetV2WebApiEnabler.cs @@ -53,6 +53,13 @@ public static HttpConfiguration UseNuGetV2WebApiFeed(this HttpConfiguration conf constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Delete) } ); + config.Routes.MapHttpRoute( + name: "apiv2package_upload", + routeTemplate: "api/v2/package", + defaults: new { controller = oDatacontrollerName, action = "UploadPackage" }, + constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Put) } + ); + config.Routes.MapODataServiceRoute(routeName, routeUrlRoot, oDataModel, new CountODataPathHandler(), conventions); return config; } From 09c28fdd807f9d7c3d58d185c4695b37f9b89bf3 Mon Sep 17 00:00:00 2001 From: Zverev Eugene Date: Wed, 5 Sep 2018 01:30:15 +0300 Subject: [PATCH 3/4] Appended allowRemoteCacheManagement key into web.config to allow remote cache management (clear cache). (#59) * Appended allowRemoteCacheManagement key into web.config to allow remote cache management. * Revert "Appended allowRemoteCacheManagement key into web.config to allow remote cache management." This reverts commit daf5b2de1a218829253278b4b506f23bf48743b0. * Appended allowRemoteCacheManagement key into web.config to allow remote cache management. * Store web server settings in user file. * Appended allowRemoteCacheManagement key into web.config to allow remote cache management. * Revert "Appended allowRemoteCacheManagement key into web.config to allow remote cache management." This reverts commit daf5b2de1a218829253278b4b506f23bf48743b0. * Appended allowRemoteCacheManagement key into web.config to allow remote cache management. * Store web server settings in user file. * Update Web.config --- .../Controllers/PackagesODataController.cs | 2 +- src/NuGet.Server/Core/DefaultServiceResolver.cs | 5 +++++ src/NuGet.Server/Default.aspx | 2 +- src/NuGet.Server/NuGet.Server.csproj | 11 +---------- src/NuGet.Server/Web.config | 4 +++- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/NuGet.Server/Controllers/PackagesODataController.cs b/src/NuGet.Server/Controllers/PackagesODataController.cs index f68cea59..0862d9f3 100644 --- a/src/NuGet.Server/Controllers/PackagesODataController.cs +++ b/src/NuGet.Server/Controllers/PackagesODataController.cs @@ -29,7 +29,7 @@ protected PackagesODataController(IServiceResolver serviceResolver) // Exposed through ordinary Web API route. Bypasses OData pipeline. public async Task ClearCache(CancellationToken token) { - if (RequestContext.IsLocal) + if (RequestContext.IsLocal || ServiceResolver.Current.Resolve().GetBoolSetting("allowRemoteCacheManagement", false)) { await _serverRepository.ClearCacheAsync(token); return CreateStringResponse(HttpStatusCode.OK, "Server cache has been cleared."); diff --git a/src/NuGet.Server/Core/DefaultServiceResolver.cs b/src/NuGet.Server/Core/DefaultServiceResolver.cs index dae8fabb..5a0bc947 100644 --- a/src/NuGet.Server/Core/DefaultServiceResolver.cs +++ b/src/NuGet.Server/Core/DefaultServiceResolver.cs @@ -53,6 +53,11 @@ public object Resolve(Type type) return _packageAuthenticationService; } + if (type == typeof(ISettingsProvider)) + { + return _settingsProvider; + } + return null; } diff --git a/src/NuGet.Server/Default.aspx b/src/NuGet.Server/Default.aspx index ff321801..feeff083 100644 --- a/src/NuGet.Server/Default.aspx +++ b/src/NuGet.Server/Default.aspx @@ -34,7 +34,7 @@ <% } %> - <% if (Request.IsLocal) { %> + <% if (Request.IsLocal || ServiceResolver.Current.Resolve().GetBoolSetting("allowRemoteCacheManagement", false)) { %>
Adding packages diff --git a/src/NuGet.Server/NuGet.Server.csproj b/src/NuGet.Server/NuGet.Server.csproj index d414adaf..5f1c2c11 100644 --- a/src/NuGet.Server/NuGet.Server.csproj +++ b/src/NuGet.Server/NuGet.Server.csproj @@ -174,16 +174,7 @@ - True - True - 1425 - / - http://localhost:40221/ - False - False - - - False + True diff --git a/src/NuGet.Server/Web.config b/src/NuGet.Server/Web.config index 6be09215..a039929d 100644 --- a/src/NuGet.Server/Web.config +++ b/src/NuGet.Server/Web.config @@ -69,6 +69,8 @@ on a fixed 1-hour interval. --> + +