Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion k8s/cloudflared/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
type: RuntimeDefault
containers:
- name: cloudflared
image: cloudflare/cloudflared:2026.9.3
image: cloudflare/cloudflared:2026.10.4
imagePullPolicy: IfNotPresent
args:
- tunnel
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-10-26
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Design

## Where the release lives

Two files pin cloudflared. `k8s/cloudflared/deployment.yaml` names the image tag. `src/devops_cli/tools_lock/tools.lock` names the version, the URL and the SHA-256 of each platform build. Both move to 2026.10.4 in this change.

## Why the tests check a floor and the URLs

The floor is 2026.10.2, the first release built with Go 1.27.3. A later bump only has to stay at or above it, so the tests do not force every future bump to edit them.

In `tools.lock`, `version` names the install directory and each `sha256` checks only the bytes of its own `url`. A bump of `version` that leaves a `url` at the old release would install the old build under the new version, and the checksum would pass. The second test closes that gap.

## Rejected alternatives

- **Pin 2026.10.3, the image that the notice names.** Rejected: 2026.10.4 is the newest release, it holds the 2026.10.2 and 2026.10.3 changes, and the only runtime change after 2026.10.3 limits the debug endpoints of the metrics server. The diff 2026.10.3...2026.10.4 leaves `/metrics` and `/ready` in place.
- **Restart the pods and keep the old tag.** Rejected: the notice says that a restart of a container that uses the old image does not apply the fix. The tag must change.
- **Pin the image by digest.** Rejected: this repository pins the image of every manifest by tag, and a change of that convention is not part of this issue.
- **Set `noTLSVerify` for an origin that the new build rejects.** Not needed: the tunnel has no HTTPS origin, and the notice forbids it.
- **Add a Renovate rule in this change.** Rejected: the rule changes how many pull requests the repository gets and needs a decision of its own. The follow-up issue holds it.

## Test

Both tests are invariant tests of committed files, and they read no network. They fail on the pins of 2026.9.3 and pass on those of 2026.10.4.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Proposal

## Why

Issue #2322: cloudflared 2026.9.3 trusts eight eMudhra (emSign) intermediate certificates whose private keys are weak. A person who guesses a key can make a certificate for any host. Cloudflare fixed this in cloudflared 2026.10.2, which it builds with Go 1.27.3, and it asks every account that runs a tunnel to upgrade.

This repository pins cloudflared 2026.9.3 in two places. Deployment `cloudflared` runs the image with `--no-autoupdate`, so it never updates itself. `tools.lock` pins the binary that `devops install-tools --tool cloudflared` installs for `cloudflared access tcp`. No check stops a pin from going below the fixed release.

## What Changes

- Set the image of Deployment `cloudflared` in `k8s/cloudflared/deployment.yaml` to `cloudflare/cloudflared:2026.10.4`.
- Set `version`, each `url` and each `sha256` of the `cloudflared` entry in `src/devops_cli/tools_lock/tools.lock` to 2026.10.4.
- Add two invariant tests in `tests/test_k8s_cloudflared.py`. They fail when the image tag or the locked version goes below 2026.10.2, and when a platform `url` names another release than the locked `version`.
- The change carries a spec delta, because a manifest and the version that `devops install-tools` installs are observable. It creates the capability `cloudflared-release-pin`.
- This change fits in one pull request.

## Capabilities

### New Capabilities

- `cloudflared-release-pin`: the cloudflared release of the tunnel Deployment and of `tools.lock` is 2026.10.2 or later.

### Modified Capabilities

None.

## Impact

- Manifest: `k8s/cloudflared/deployment.yaml`. Argo CD applies it after the merge.
- Tools lock: `src/devops_cli/tools_lock/tools.lock`.
- Tests: `tests/test_k8s_cloudflared.py`.
- Rollout: the Deployment has two replicas and the default rolling update, which allows no unavailable pod and one surge pod. A new pod must be ready before an old pod stops, so the tunnel stays connected. A connection that an old pod carries, such as a `cloudflared access tcp` session to the kube API, drops when that pod stops and reconnects.

## Feasibility

- Cloudflare's notice and its [blog post "8 eMudhra certificates are compromised"](https://blog.cloudflare.com/emudhra-certificate-compromise/) say that cloudflared before 2026.10.2 trusts the eight intermediates, and that 2026.10.2 fixes it.
- The GitHub releases of `cloudflare/cloudflared` list 2026.10.2 (2026-10-20), 2026.10.3 (2026-10-21) and 2026.10.4 (2026-10-26). The diff 2026.10.1...2026.10.4 shows Go 1.27.3 in `go.mod` and the Dockerfile and a new distroless base image. It holds no certificate code, so the rejection comes from Go 1.27.3, as the blog post says. No test here connects with a forged certificate.
- The only runtime change after 2026.10.3 is `VULN-176088` in `metrics/metrics.go`. It mounts an allowlist of debug endpoints and keeps `/metrics` and `/ready`, the paths that this Deployment's probes and Prometheus scrape use. The token reaches the container by the `TUNNEL_TOKEN` environment variable, not by an argument.
- Docker Hub holds `cloudflare/cloudflared:2026.10.4` for `amd64` and `arm64`.
- The `linux-amd64` build of 2026.10.4 runs and prints `cloudflared version 2026.10.4`.
- Each `sha256` in `tools.lock` equals the `digest` of its release asset. The `linux` values also equal the release notes. The release notes give each macOS value for the binary inside the `.tgz`: unpacking each archive and hashing `cloudflared` gives those values.
- The notice warns that the upgraded cloudflared rejects an HTTPS origin whose certificate chains to an affected intermediate. `devops cloudflare tunnel routes` shows that the tunnel has no HTTPS origin: one `tcp://` route to the kube API and `http://` routes to Traefik.

## Existing Tool Considered

The upstream cloudflared release and its official image cover the need. The change builds no code and deletes no internal code. The tests only check the pins.

Renovate is the open tool that keeps a pin current, and its `kubernetes` manager matches no file by default ([Renovate docs](https://docs.renovatebot.com/modules/manager/kubernetes/)). The follow-up in `tasks.md` covers it.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# cloudflared-release-pin Specification

## Purpose

The cloudflared release that the tunnel Deployment runs and that `devops install-tools` installs. Every pin holds a release that rejects the eight eMudhra intermediate certificates with weak private keys, so a forged certificate does not pass for a Cloudflare host or an origin.

## ADDED Requirements

### Requirement: The tunnel Deployment runs a cloudflared release that rejects the compromised eMudhra intermediates
The container image of Deployment `cloudflared` in `k8s/cloudflared/deployment.yaml` SHALL be the repository `cloudflare/cloudflared` at tag 2026.10.2 or later. The container runs with `--no-autoupdate`, so only a change of this tag changes the release.

#### Scenario: The Deployment names an image below the first safe release
- **WHEN** a test reads the image of the container of Deployment `cloudflared` in `k8s/cloudflared/deployment.yaml`
- **THEN** the image repository is `cloudflare/cloudflared`
- **AND** the image tag, read as a version, is 2026.10.2 or later

### Requirement: The tools lock installs a cloudflared release that rejects the compromised eMudhra intermediates
The `cloudflared` entry of `tools.lock` SHALL have a `version` of 2026.10.2 or later. The `url` of each platform build SHALL name the GitHub release of that `version`, so the checksum of a build and the version it installs under always belong to one release.

#### Scenario: The lock pins a version below the first safe release
- **WHEN** a test loads the tools lock that devops-cli ships
- **THEN** the `version` of the `cloudflared` binary tool, read as a version, is 2026.10.2 or later

#### Scenario: A platform build comes from another release than the locked version
- **WHEN** a test reads the `url` of every platform build of the `cloudflared` binary tool
- **THEN** the platforms are `linux-amd64`, `linux-arm64`, `darwin-amd64` and `darwin-arm64`
- **AND** every `url` starts with `https://github.com/cloudflare/cloudflared/releases/download/<version>/`, where `<version>` is the locked `version`
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Tasks

## 1. The pins reach the fixed release

- [x] 1.1 Write the failing tests `test_cloudflared_deployment_runs_a_release_that_rejects_the_compromised_emudhra_intermediates` and `test_cloudflared_tools_lock_installs_a_release_that_rejects_the_compromised_emudhra_intermediates` in `tests/test_k8s_cloudflared.py`, and see them fail before the bump with `uv run devops ci test tests/test_k8s_cloudflared.py`
- [x] 1.2 Set the image tag in `k8s/cloudflared/deployment.yaml` and the `version`, each `url` and each `sha256` of the `cloudflared` entry in `src/devops_cli/tools_lock/tools.lock` to 2026.10.4, with each `sha256` from the `digest` of its release asset and checked against the release notes (for a macOS build, the binary inside the archive); verify with `uv run devops ci test tests/test_k8s_cloudflared.py tests/test_tools_lock.py tests/test_install_tools.py tests/test_stack_dashboards.py`
- [x] 1.3 Regenerate the documentation; no command, option or message changes, so nothing changes; verify with `uv run devops docs generate --sync-readme` and `uv run devops docs check`

## Workflow follow-up

- #2323 makes Renovate update the image tags of the manifests under `k8s/`, which its `kubernetes` manager does not match by default. This change does not do it, because it changes how many pull requests the repository gets.
- Pending a person: after the merge, Argo CD rolls out Deployment `cloudflared/cloudflared`. Confirm that both pods are Ready and that the alert `CloudflareTunnelDegraded` does not fire.
- Pending a person: upgrade each cloudflared instance outside this repository to 2026.10.2 or later. Networking > Tunnels in the Cloudflare dashboard lists each connector and its version.
- Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).
26 changes: 26 additions & 0 deletions openspec/specs/cloudflared-release-pin/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# cloudflared-release-pin Specification

## Purpose
The cloudflared release that the tunnel Deployment runs and that `devops install-tools` installs. Every pin holds a release that rejects the eight eMudhra intermediate certificates with weak private keys, so a forged certificate does not pass for a Cloudflare host or an origin.

## Requirements

### Requirement: The tunnel Deployment runs a cloudflared release that rejects the compromised eMudhra intermediates
The container image of Deployment `cloudflared` in `k8s/cloudflared/deployment.yaml` SHALL be the repository `cloudflare/cloudflared` at tag 2026.10.2 or later. The container runs with `--no-autoupdate`, so only a change of this tag changes the release.

#### Scenario: The Deployment names an image below the first safe release
- **WHEN** a test reads the image of the container of Deployment `cloudflared` in `k8s/cloudflared/deployment.yaml`
- **THEN** the image repository is `cloudflare/cloudflared`
- **AND** the image tag, read as a version, is 2026.10.2 or later

### Requirement: The tools lock installs a cloudflared release that rejects the compromised eMudhra intermediates
The `cloudflared` entry of `tools.lock` SHALL have a `version` of 2026.10.2 or later. The `url` of each platform build SHALL name the GitHub release of that `version`, so the checksum of a build and the version it installs under always belong to one release.

#### Scenario: The lock pins a version below the first safe release
- **WHEN** a test loads the tools lock that devops-cli ships
- **THEN** the `version` of the `cloudflared` binary tool, read as a version, is 2026.10.2 or later

#### Scenario: A platform build comes from another release than the locked version
- **WHEN** a test reads the `url` of every platform build of the `cloudflared` binary tool
- **THEN** the platforms are `linux-amd64`, `linux-arm64`, `darwin-amd64` and `darwin-arm64`
- **AND** every `url` starts with `https://github.com/cloudflare/cloudflared/releases/download/<version>/`, where `<version>` is the locked `version`
18 changes: 9 additions & 9 deletions src/devops_cli/tools_lock/tools.lock
Original file line number Diff line number Diff line change
Expand Up @@ -171,29 +171,29 @@ url = "https://github.com/argoproj/argo-cd/releases/download/v3.5.4/argocd-darwi
sha256 = "aac1cd7606c5960513edfc2a3ee7226c3860f0982f63b93b2f7e8b5c4d880873"

[binary.cloudflared]
version = "2026.9.3"
version = "2026.10.4"
description = "Cloudflare Tunnel client, for kubectl over cloudflared access tcp"
source = "https://github.com/cloudflare/cloudflared"
bin = "cloudflared"
format = "binary"

[binary.cloudflared.platforms.linux-amd64]
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.9.3/cloudflared-linux-amd64"
sha256 = "77e26d8d900e0b8469f416239d14b5f296525fdf79fee6f511ef55609e3fbac2"
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.10.4/cloudflared-linux-amd64"
sha256 = "ae5e8add7884b0531d66bbca4570d1de491ff6da51e4ebe7eb160cdf241d9e42"

[binary.cloudflared.platforms.linux-arm64]
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.9.3/cloudflared-linux-arm64"
sha256 = "aaeb2d7d0da3614634c7e03ab13487a1522c2e79165ed2929cfe23d5e95b326d"
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.10.4/cloudflared-linux-arm64"
sha256 = "2b7203b4fb0ba28a0c1e12f8855ce2c25f76d266a8d5edafac5540b6812acff6"

[binary.cloudflared.platforms.darwin-amd64]
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.9.3/cloudflared-darwin-amd64.tgz"
sha256 = "d1155d0837487f261183b15c1eab6c4ebcad9dc49b94675f1524c3564cea3977"
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.10.4/cloudflared-darwin-amd64.tgz"
sha256 = "f11fbef4207d715892331917dafd437f032cf4b7137ed64dea3008338c1c613d"
format = "tar.gz"
member = "cloudflared"

[binary.cloudflared.platforms.darwin-arm64]
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.9.3/cloudflared-darwin-arm64.tgz"
sha256 = "587c2cfb1c230fe36c7fa7727da78be459dae028cabe8c001291999350f07095"
url = "https://github.com/cloudflare/cloudflared/releases/download/2026.10.4/cloudflared-darwin-arm64.tgz"
sha256 = "68b6bc4080ac1330234db2a9002d07f98b000537a1bd531a687b660d4160fa7f"
format = "tar.gz"
member = "cloudflared"

Expand Down
44 changes: 44 additions & 0 deletions tests/test_k8s_cloudflared.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
from __future__ import annotations

import yaml
from packaging.version import Version

from devops_cli.tools_lock import load_tools_lock
from tests.support.paths import REPO_ROOT

K8S_DIR = REPO_ROOT / "k8s"
CLOUDFLARED_DIR = K8S_DIR / "cloudflared"

# The first cloudflared release built with Go 1.27.3, which rejects the eight eMudhra
# intermediate certificates whose private keys are weak (#2322).
CLOUDFLARED_FIRST_SAFE_VERSION = Version("2026.10.2")


def test_cloudflared_manifest_files_exist() -> None:
"""Verify all expected cloudflared Kubernetes manifests exist."""
Expand Down Expand Up @@ -73,3 +79,41 @@ def test_cloudflared_traefik_egress_rule_has_no_port_restriction() -> None:
peer = traefik_rule["to"][0]
assert peer["namespaceSelector"]["matchLabels"]["kubernetes.io/metadata.name"] == "kube-system"
assert peer["podSelector"]["matchLabels"]["app.kubernetes.io/name"] == "traefik"


def test_cloudflared_deployment_runs_a_release_that_rejects_the_compromised_emudhra_intermediates() -> (
None
):
"""Verify the Deployment's image tag is at or above the first release built with Go 1.27.3.

Regression test (#2322): cloudflared 2026.9.3 and older trust eight eMudhra intermediate
certificates with weak private keys. The container runs with `--no-autoupdate`, so only a
change of this tag removes the trust.
"""
deployment = yaml.safe_load((CLOUDFLARED_DIR / "deployment.yaml").read_text(encoding="utf-8"))
containers = deployment["spec"]["template"]["spec"]["containers"]
assert [container["name"] for container in containers] == ["cloudflared"]

repository, _, tag = containers[0]["image"].partition(":")
assert repository == "cloudflare/cloudflared"
assert Version(tag) >= CLOUDFLARED_FIRST_SAFE_VERSION


def test_cloudflared_tools_lock_installs_a_release_that_rejects_the_compromised_emudhra_intermediates() -> (
None
):
"""Verify the lock pins cloudflared at or above the first safe release, and fetches that release.

Regression test (#2322): `version` names the install directory, and each `sha256` only checks
the bytes of its own `url`. A bump of `version` that leaves a `url` at the old release would
install the old build under the new version, and the checksum would pass.
"""
cloudflared = load_tools_lock().binary["cloudflared"]

assert Version(cloudflared.version) >= CLOUDFLARED_FIRST_SAFE_VERSION
assert {
platform: artifact.url.startswith(
f"https://github.com/cloudflare/cloudflared/releases/download/{cloudflared.version}/"
)
for platform, artifact in cloudflared.platforms.items()
} == dict.fromkeys(("linux-amd64", "linux-arm64", "darwin-amd64", "darwin-arm64"), True)
Loading