diff --git a/CHANGELOG.md b/CHANGELOG.md index 52820a709f..5e16c8072c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Existing resources with legacy Porter parameter overrides must complete a resource upgrade before custom actions or uninstall. The current template version can be reused. See [upgrading resources](docs/tre-admins/upgrading-resources.md#upgrade-existing-resources-for-document-based-porter-parameters). (`resource_processor` 0.13.10) ([#4904](https://github.com/microsoft/AzureTRE/pull/4904)) * Set `enable_legacy_airlock` explicitly to `true` in your `config.yaml`. It currently defaults to `true` but will default to `false` in a future release; Setting to `false` will delete existing airlock storage accounts and must only be done once all workspaces use the v2 airlock. ([#5048](https://github.com/microsoft/AzureTRE/pull/5048)) +* The upgrade to Nexus bundle 4.0.0 is one-way. Nexus 3.97 must send telemetry to `nxrm.telemetry.sonatype.com`. If uploads fail for 10 days, Nexus becomes read-only. Allow this host in egress controls outside the TRE firewall. See [Upgrade to Nexus bundle 4.0.0](docs/tre-templates/shared-services/nexus.md#upgrade-to-nexus-bundle-400). (`tre-shared-service-sonatype-nexus` 4.0.0) ([#5271](https://github.com/microsoft/AzureTRE/issues/5271)) ENHANCEMENTS: * Select individual bundle tests and record lifecycle evidence for base workspaces, private Azure SQL, Airlock, Linux VMs and certificate reuse across reinstallation. ([#5255](https://github.com/microsoft/AzureTRE/pull/5255)) @@ -30,6 +31,7 @@ See [Legacy Airlock & migration](docs/azure-tre-overview/airlock.md#legacy-airlo BUG FIXES: * Update Nexus from 3.94.0 to 3.94.3. The Nexus 3.94.3 image stops trusting the eMudhra certificate chains that Sonatype reports as compromised. (`tre-shared-service-sonatype-nexus` 3.11.3) ([#5276](https://github.com/microsoft/AzureTRE/issues/5276)) +* Update Nexus from 3.94.3 to 3.97.2. Acknowledge the required base telemetry of Nexus 3.97 and allow Nexus to connect to `nxrm.telemetry.sonatype.com`. (`tre-shared-service-sonatype-nexus` 4.0.0) ([#5271](https://github.com/microsoft/AzureTRE/issues/5271)) * Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274)) * Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270)) * Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266)) diff --git a/devops/tests/test_nexus_repos.py b/devops/tests/test_nexus_repos.py index 83cd7cf70a..f698a9743b 100644 --- a/devops/tests/test_nexus_repos.py +++ b/devops/tests/test_nexus_repos.py @@ -53,6 +53,19 @@ def respond(code=200, body="", exit_code=0): respond() if url.endswith("/system/eula"): respond(body='{"accepted":true}') +if url.endswith("/system/mandatory-telemetry-acknowledgement"): + for option in ("--connect-timeout", "--max-time"): + if option not in args or not 0 < int(args[args.index(option) + 1]) <= 60: + respond(exit_code=99) + state["ack_attempts"] += 1 + if state["ack_failures"]: + failure = state["ack_failures"].pop(0) + if failure == "connection": + respond(exit_code=7) + respond(failure) + if method != "POST" or json.loads(args[args.index("-d") + 1]) != {"acknowledgement": True}: + respond(400) + respond(204) if url.endswith("/security/anonymous"): if method == "GET" and "-w" in args: if "-u" not in args or args[args.index("-u") + 1] != "admin:mock-password": @@ -151,6 +164,8 @@ def setUp(self): "list_attempts": 0, "auth_failures": [], "auth_attempts": 0, + "ack_failures": [], + "ack_attempts": 0, "calls": [], } @@ -212,6 +227,35 @@ def test_persistent_authentication_failures_stop_without_configuration(self): self.assertIn("Timeout while waiting for Nexus admin authentication", self.output) self.assertNotIn("mock-password", self.output) + def test_telemetry_is_acknowledged_before_repository_configuration(self): + result = self.run_script() + self.assertEqual(result.returncode, 0, self.output) + self.assertEqual(self.state["ack_attempts"], 1) + urls = [url for _, url in self.state["calls"]] + ack = next(i for i, url in enumerate(urls) if url.endswith("/mandatory-telemetry-acknowledgement")) + self.assertLess(next(i for i, url in enumerate(urls) if url.endswith("/system/eula")), ack) + self.assertLess(ack, next(i for i, url in enumerate(urls) if "/repositories" in url)) + + def test_transient_acknowledgement_failures_are_retried(self): + for failure in (503, 404, "connection"): + with self.subTest(failure=failure): + self.state.update(ack_failures=[failure, failure], ack_attempts=0, repos={}, calls=[]) + result = self.run_script() + self.assertEqual(result.returncode, 0, self.output) + self.assertEqual(self.state["ack_attempts"], 3) + self.assert_raw_repo() + + def test_persistent_acknowledgement_failures_stop_before_repository_configuration(self): + for failure in (503, 404, "connection"): + with self.subTest(failure=failure): + self.state.update(ack_failures=[failure] * 5, ack_attempts=0, repos={}, calls=[]) + result = self.run_script() + self.assertNotEqual(result.returncode, 0, self.output) + self.assertEqual(self.state["ack_attempts"], 5) + self.assertFalse(any("/repositories" in url for _, url in self.state["calls"])) + self.assertIn("Timeout while trying to acknowledge required base telemetry", self.output) + self.assertNotIn("mock-password", self.output) + def test_upgrade_migrates_all_four_apt_repositories(self): for config in ("ubuntu_security_proxy_conf.json", "docker_proxy_conf.json", "microsoft_apt_proxy_conf.json"): self.add_config(config) diff --git a/docs/tre-templates/shared-services/nexus.md b/docs/tre-templates/shared-services/nexus.md index 6b1a8570f1..d66afa03bf 100644 --- a/docs/tre-templates/shared-services/nexus.md +++ b/docs/tre-templates/shared-services/nexus.md @@ -44,6 +44,27 @@ After verifying the certificate has been generated, you can deploy Nexus: This will deploy the infrastructure required for Nexus, then start the service and configure it with the repository configurations located in the `./templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config` folder. It will also set up HTTPS using the certificate you generated in the previous section, so proxies can be served at `https://nexus-{TRE_ID}.{LOCATION}.cloudapp.azure.com`. +## Upgrade to Nexus bundle 4.0.0 + +!!! warning + The upgrade to Nexus bundle `4.0.0` is one-way. You cannot go back to Nexus bundle `3.11.3` or earlier after the upgrade. Nexus 3.94.3 does not start on a database that Nexus 3.97.2 upgraded. + +Nexus bundle `4.0.0` updates Nexus from 3.94.3 to 3.97.2. +Nexus 3.94.3 in bundle `3.11.3` and Nexus 3.97.2 both stop trusting the eMudhra certificate chains that Sonatype reports as [compromised](https://help.sonatype.com/en/compromised-emudhra-intermediate-ca-certificates.html). +Bundle versions before `3.11.3` continue to trust these certificate chains. + +Before you upgrade: + +1. Make a snapshot of the OS disk of the Nexus VM. The Nexus data is on this disk. + +1. Allow `nxrm.telemetry.sonatype.com` in all egress controls outside the TRE firewall. See [Required base telemetry](#required-base-telemetry). + +1. If your deployment cannot send telemetry, contact Sonatype Support before you upgrade. + +Bundle `4.0.0` is a major version, so the TRE UI does not offer this upgrade. +After you complete the steps above, upgrade Nexus through the API with `force_version_update=true`. +See [Force version update](../../tre-admins/upgrading-resources.md#force-version-update). + ## Upgrade apt repositories to raw proxies Nexus bundle `3.11.0` replaces the `ubuntu`, `ubuntu-security`, `docker` and `microsoft-apt` apt repositories with raw proxies. @@ -111,6 +132,33 @@ Nexus Shared Service requires access to resources outside of the Azure TRE VNET. | github.com, objects.githubusercontent.com, release-assets.githubusercontent.com | Enables Nexus to "proxy" Miniforge installers (hosted on GitHub Releases) for Windows VMs. | | cran.r-project.org | Enables Nexus to "proxy" CRAN R Windows installers for Windows VMs. | | download1.rstudio.org | Enables Nexus to "proxy" RStudio Windows installers for Windows VMs. | +| nxrm.telemetry.sonatype.com | Lets Nexus upload the required base telemetry. If uploads fail for 10 days, Nexus becomes read-only. See [Required base telemetry](#required-base-telemetry). | + +## Required base telemetry + +Nexus 3.97.0 and later send [required base telemetry](https://help.sonatype.com/en/nexus-repository-telemetry.html) to Sonatype. +The telemetry contains usage data, for example the number of requests each day and the total number of components. +Nexus bundle `4.0.0` and later versions acknowledge this requirement through the Nexus REST API during deployment and upgrade. + +Nexus uploads the telemetry to `https://nxrm.telemetry.sonatype.com`. The TRE firewall allows this host for the Nexus VM. +If Nexus traffic also goes through a proxy or a firewall that you manage, allow this host there. +An example is a [forced tunnelling](../../tre-admins/configure-firewall-force-tunneling.md) firewall. +If your firewall or proxy inspects TLS, exclude this host from TLS inspection. A TLS certificate error counts as a failed upload. + +If uploads continue to fail, Nexus shows a "Baseline Telemetry Upload Issue" warning to administrators. +Nexus does not show this warning after the first failed upload. +If uploads fail for 10 days, Nexus Community Edition becomes read-only until an upload succeeds. +In read-only mode, Nexus serves only the packages that are already in its cache. +Package installation in workspaces then fails for all other packages. + +To see the result of each upload, sign in to Nexus as an administrator from the admin jumpbox. +In the Nexus settings, open **Status**. Find the **Baseline Telemetry** check. +Nexus uploads the telemetry every 24 hours and when Nexus stops. +After a deployment or an upgrade, the check can show "Last successful upload: never" for up to 24 hours. This is normal. +After you restore access, create and run a **Telemetry upload retry** task. This task immediately sends the failed uploads again. + +Sonatype gives no option to turn off this telemetry. +Before you upgrade to Nexus bundle `4.0.0`, read [Upgrade to Nexus bundle 4.0.0](#upgrade-to-nexus-bundle-400). ## Current Repos diff --git a/templates/shared_services/sonatype-nexus-vm/porter.yaml b/templates/shared_services/sonatype-nexus-vm/porter.yaml index 8af9e45537..b2324d77e2 100644 --- a/templates/shared_services/sonatype-nexus-vm/porter.yaml +++ b/templates/shared_services/sonatype-nexus-vm/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-shared-service-sonatype-nexus -version: 3.11.3 +version: 4.0.0 description: "A Sonatype Nexus shared service" dockerfile: Dockerfile.tmpl registry: azuretre @@ -11,7 +11,7 @@ custom: name: sonatype/nexus3 import: source: docker.io/sonatype/nexus3 - tag: "3.94.3" + tag: "3.97.2" credentials: - name: azure_tenant_id diff --git a/templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh b/templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh index f51dd0803b..2d52a441b8 100755 --- a/templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh +++ b/templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh @@ -110,6 +110,28 @@ else echo "EULA endpoint not available (older Nexus version or Pro edition). Skipping." fi +# Acknowledge required base telemetry (required for Nexus 3.97+). +# Nexus uploads telemetry to nxrm.telemetry.sonatype.com. If uploads fail for the +# grace period, Nexus becomes read-only. Repeating the acknowledgement is safe. +acknowledge_telemetry() { + local status_code + status_code=$(curl --silent --show-error -u admin:"$NEXUS_ADMIN_PASSWORD" -X POST \ + 'http://localhost/service/rest/v1/system/mandatory-telemetry-acknowledgement' \ + --connect-timeout 10 --max-time 30 \ + -H 'Content-Type: application/json' \ + -d '{"acknowledgement":true}' \ + -w '%{http_code}' -o /dev/null) + echo "Response received from Nexus when acknowledging telemetry: $status_code" + [ "$status_code" = "204" ] +} + +echo "Acknowledging required base telemetry..." +if ! retry_with_backoff acknowledge_telemetry; then + echo 'ERROR - Timeout while trying to acknowledge required base telemetry' + exit 1 +fi +echo "Required base telemetry acknowledged." + echo "Getting current anonymous settings in Nexus..." current_anon_json=$(curl -iu admin:"$NEXUS_ADMIN_PASSWORD" -X GET \ 'http://localhost/service/rest/v1/security/anonymous' \ diff --git a/templates/shared_services/sonatype-nexus-vm/template_schema.json b/templates/shared_services/sonatype-nexus-vm/template_schema.json index 4da2699064..7502f620bc 100644 --- a/templates/shared_services/sonatype-nexus-vm/template_schema.json +++ b/templates/shared_services/sonatype-nexus-vm/template_schema.json @@ -66,7 +66,7 @@ "ui:order": ["accept_nexus_eula", "display_name", "description", "overview", "ssl_cert_name", "vm_size", "*"], "accept_nexus_eula": { "ui:widget": "checkbox", - "ui:help": "View the EULA at: https://links.sonatype.com/products/nxrm/ce-eula" + "ui:help": "View the EULA at: https://links.sonatype.com/products/nxrm/ce-eula. Nexus 3.97 and later send required base telemetry to Sonatype: https://help.sonatype.com/en/nexus-repository-telemetry.html" }, "is_exposed_externally": { "classNames": "tre-hidden" diff --git a/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf b/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf index 860e557d22..cd8b8f505a 100644 --- a/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf +++ b/templates/shared_services/sonatype-nexus-vm/terraform/locals.tf @@ -1,7 +1,7 @@ locals { core_vnet = "vnet-${var.tre_id}" core_resource_group_name = "rg-${var.tre_id}" - nexus_allowed_fqdns = "pypi.org,*.pypi.org,files.pythonhosted.org,security.ubuntu.com,archive.ubuntu.com,keyserver.ubuntu.com,repo.anaconda.com,*.docker.com,*.docker.io,conda.anaconda.org,azure.archive.ubuntu.com,packages.microsoft.com,repo.almalinux.org,download-ib01.fedoraproject.org,cran.r-project.org,cloud.r-project.org,download1.rstudio.org,*.snapcraftcontent.com,download.microsoft.com,marketplace.visualstudio.com,*.gallery.vsassets.io,*.gallerycdn.vsassets.io,azcliprod.blob.core.windows.net,update.code.visualstudio.com,vscode.download.prss.microsoft.com,github.com,objects.githubusercontent.com,release-assets.githubusercontent.com" + nexus_allowed_fqdns = "pypi.org,*.pypi.org,files.pythonhosted.org,security.ubuntu.com,archive.ubuntu.com,keyserver.ubuntu.com,repo.anaconda.com,*.docker.com,*.docker.io,conda.anaconda.org,azure.archive.ubuntu.com,packages.microsoft.com,repo.almalinux.org,download-ib01.fedoraproject.org,cran.r-project.org,cloud.r-project.org,download1.rstudio.org,*.snapcraftcontent.com,download.microsoft.com,marketplace.visualstudio.com,*.gallery.vsassets.io,*.gallerycdn.vsassets.io,azcliprod.blob.core.windows.net,update.code.visualstudio.com,vscode.download.prss.microsoft.com,github.com,objects.githubusercontent.com,release-assets.githubusercontent.com,nxrm.telemetry.sonatype.com" nexus_allowed_fqdns_list = distinct(compact(split(",", replace(local.nexus_allowed_fqdns, " ", "")))) workspace_vm_allowed_fqdns = "*.o.lencr.org,*.c.lencr.org,*.i.lencr.org" workspace_vm_allowed_fqdns_list = distinct(compact(split(",", replace(local.workspace_vm_allowed_fqdns, " ", ""))))