Skip to content

feat: [NODE-1991] Proxy GuestOS upgrades through HostOS - #12021

Merged
Bownairo merged 16 commits into
masterfrom
eero/guestos-upgrade-proxy
Nov 18, 2026
Merged

Bownairo merged 16 commits into
masterfrom
eero/guestos-upgrade-proxy

Conversation

@Bownairo

@Bownairo Bownairo commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Use nginx to proxy upgrade downloads through HostOS. For type4 nodes, this will allow a single machine to download the image one time, for use in all of the GuestOS VMs.

If the proxy is not available, or the hash is incorrect, we fall back to pulling the image directly.

@github-actions github-actions Bot added the feat label Nov 5, 2026
@Bownairo
Bownairo force-pushed the eero/guestos-upgrade-proxy branch from e70da05 to 54a94a4 Compare November 9, 2026 19:19
@Bownairo
Bownairo force-pushed the eero/guestos-upgrade-proxy branch from 54a94a4 to 55717b1 Compare November 9, 2026 21:38
@Bownairo
Bownairo marked this pull request as ready for review November 11, 2026 17:30
@Bownairo
Bownairo requested review from a team as code owners November 11, 2026 17:30
Copilot AI balanced review requested due to automatic review settings November 11, 2026 17:30
@zeropath-ai

zeropath-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to 082b5e6.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► ic-os/components/hostos.bzl
    Add upgrade-proxy.service and related nginx config files
► ic-os/components/upgrade/upgrade-proxy.conf
    Add upgrade proxy nginx config
► ic-os/components/upgrade/upgrade-proxy.service
    Add systemd service for upgrade proxy
Enhancement ► ic-os/hostos/context/Dockerfile
    Install nginx and upgrade-proxy user; adjust services
Enhancement ► rs/http_utils/src/file_downloader.rs
    Configure HTTP client with no_hickory_dns
Enhancement ► rs/ic_os/config/tool/templates/ic.json5.template
    Open upgrade proxy port 19300 in host OS upgrade proxy rules for HostOS access
Enhancement ► rs/ic_os/networking/nss_icos/Cargo.toml
    Add dependencies: macaddr, serde, serde_json, config_types, deterministic_ips
Enhancement ► rs/ic_os/networking/nss_icos/BUILD.bazel
    Add dependencies for config/types, deterministic_ips, serde, serde_json, macaddr
Enhancement ► rs/ic_os/networking/nss_icos/src/lib.rs
    Refactor to compute HostOS/GuestOS addresses via deterministic MAC and configurables; replace hard-coded IP logic
► add new config reading and address computation helpers
Enhancement ► rs/orchestrator/image_upgrader/src/image_upgrader.rs
    Integrate upgrade proxy usage: constants for hostos proxy, timeouts; adjust download flow to use proxy when available; support for hashing and direct download fallback; rename get_release_package_urls_and_hash to return Vec and String
► add try_download_from_urls helper
Enhancement ► rs/orchestrator/src/upgrade.rs
    Update get_release_package_urls_and_hash return type to (Vec, String) and adapt usage
Enhancement ► rs/orchestrator/testdata/nftables_assigned_cloud_engine.conf.golden
    Update expected nftables rules to account for HostOS upgrade proxy access (19300)

@zeropath-ai

zeropath-ai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to 082b5e6.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► ic-os/components/hostos.bzl
    Add upgrade-proxy.service and related nginx config files
► ic-os/components/upgrade/upgrade-proxy.conf
    Add upgrade proxy nginx config
► ic-os/components/upgrade/upgrade-proxy.service
    Add systemd service for upgrade proxy
Enhancement ► ic-os/hostos/context/Dockerfile
    Install nginx and upgrade-proxy user; adjust services
Enhancement ► rs/http_utils/src/file_downloader.rs
    Configure HTTP client with no_hickory_dns
Enhancement ► rs/ic_os/config/tool/templates/ic.json5.template
    Open upgrade proxy port 19300 in host OS upgrade proxy rules for HostOS access
Enhancement ► rs/ic_os/networking/nss_icos/Cargo.toml
    Add dependencies: macaddr, serde, serde_json, config_types, deterministic_ips
Enhancement ► rs/ic_os/networking/nss_icos/BUILD.bazel
    Add dependencies for config/types, deterministic_ips, serde, serde_json, macaddr
Enhancement ► rs/ic_os/networking/nss_icos/src/lib.rs
    Refactor to compute HostOS/GuestOS addresses via deterministic MAC and configurables; replace hard-coded IP logic
► add new config reading and address computation helpers
Enhancement ► rs/orchestrator/image_upgrader/src/image_upgrader.rs
    Integrate upgrade proxy usage: constants for hostos proxy, timeouts; adjust download flow to use proxy when available; support for hashing and direct download fallback; rename get_release_package_urls_and_hash to return Vec and String
► add try_download_from_urls helper
Enhancement ► rs/orchestrator/src/upgrade.rs
    Update get_release_package_urls_and_hash return type to (Vec, String) and adapt usage
Enhancement ► rs/orchestrator/testdata/nftables_assigned_cloud_engine.conf.golden
    Update expected nftables rules to account for HostOS upgrade proxy access (19300)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The proxy accepts arbitrary upstream destinations, allowing callers to reach HostOS loopback services and bypass inbound firewall restrictions once it starts.

4 open issues
What changed in this PR

This PR adds a HostOS caching proxy for GuestOS upgrade images, aiming to reduce repeated downloads on multi-VM nodes while preserving direct-download fallback.

Changes:

  • Adds an nginx proxy, systemd service, and HostOS firewall access.
  • Tries proxied downloads first, with mandatory hash verification and direct fallback.
  • Updates hostname resolution and SELinux permissions to support HostOS discovery.
File Description
rs/​orchestrator/​src/​upgrade.rs Returns a required release-package hash.
rs/​orchestrator/​image_upgrader/​src/​image_upgrader.rs Adds proxy-first downloads and direct fallback.
rs/​ic_os/​networking/​nss_icos/​src/​lib.rs Derives HostOS and GuestOS addresses from node configuration.
rs/​ic_os/​networking/​nss_icos/​Cargo.toml Adds configuration and address-calculation dependencies.
rs/​ic_os/​networking/​nss_icos/​BUILD.bazel Adds corresponding Bazel dependencies.
rs/​http_utils/​src/​file_downloader.rs Uses system DNS resolution to support NSS hostnames.
ic-os/​hostos/​context/​packages.common Adds nginx-light.
ic-os/​hostos/​context/​docker-base.prod Updates the production base-image reference.
ic-os/​hostos/​context/​docker-base.dev Updates the development base-image reference.
ic-os/​components/​upgrade/​upgrade-proxy.service Defines the proxy service and state directories.
ic-os/​components/​upgrade/​upgrade-proxy.conf Configures artifact forwarding, caching, and download locking.
ic-os/​components/​networking/​nftables/​hostos/​nftables.template Allows local-prefix access to proxy port 19300.
ic-os/​components/​hostos.bzl Includes proxy configuration and service files in HostOS.
ic-os/​components/​guestos/​selinux/​ic-node/​ic-node.te Grants configuration access needed by hostname resolution.
ic-os/​components/​guestos/​selinux/​ic-node/​ic-node.fc Labels /run/config for SELinux.
Cargo.lock Records the added NSS dependencies.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 12, 2026 00:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical issues can prevent direct-download fallback within the upgrade deadline and allow unbounded proxy downloads to exhaust the shared HostOS filesystem.

2 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Nginx worker connection limit is too low for concurrent VM cache misses

ic-os/​components/​upgrade/​upgrade-proxy.conf:6

A type4.1 host starts 60 GuestOS VMs (ic-os/components/hostos/guestos/start-guestos.sh:11), but worker_connections counts upstream sockets as well as client sockets. Concurrent cache misses for different image hashes can therefore require 120 connections, exceeding this single worker's limit and forcing otherwise valid upgrade requests to bypass the proxy. Please increase the limit to cover client and upstream connections for all supported VM slots, with some headroom for listeners and DNS.

Medium severity Corrupt proxy partials can poison retries from the direct source

rs/​orchestrator/​image_upgrader/​src/​image_upgrader.rs:373

If the proxy sends corrupt bytes and then times out, FileDownloader leaves that prefix on disk, and the direct fallback resumes after it using Range. With one release URL, repeated proxy failures can therefore cause a hash mismatch on every check despite a healthy direct source. Retry the direct URL from offset zero after a hash mismatch, which already deletes the file.

4 resolved since last review

Review effort: Balanced

Comment thread rs/http_utils/src/file_downloader.rs Resolved
@Bownairo
Bownairo requested review from pierugo-dfinity and a balanced review from Copilot November 17, 2026 03:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The pinned HostOS base images were not updated to include nginx, so normal HostOS images lack the executable required to start the new proxy service.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Proxy partials corrupt direct-download fallback

rs/​orchestrator/​image_upgrader/​src/​image_upgrader.rs:198

If a proxy download writes an incorrect prefix and then disconnects or times out, the direct fallback resumes from those unverified bytes instead of replacing them. With a single release URL, this makes the final hash check fail even when the origin serves the correct image, and repeated proxy failures can prevent the upgrade from completing. Keep proxy partials separate from direct-download state so fallback starts clean without losing legitimate direct-download progress.

2 resolved since last review

Review effort: Balanced

Comment thread ic-os/hostos/context/packages.common Resolved
Copilot AI balanced review requested due to automatic review settings November 17, 2026 20:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Incorrect VM-slot classification breaks GuestOS address resolution, while partial proxy downloads can corrupt direct-download fallback and cause repeated upgrade failures.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread rs/ic_os/networking/nss_icos/src/lib.rs Resolved
Copilot AI balanced review requested due to automatic review settings November 17, 2026 22:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

When the proxy is unavailable, the fallback deletes partial direct-download data, forcing retries to restart from zero and potentially preventing interrupted downloads from ever completing.

1 open issue
2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 18, 2026 01:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The GuestOS-to-HostOS proxy spans caching, hostname resolution, firewall, and SELinux changes, requiring integration and security validation of cache sharing and fallback behavior beyond the source-only review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@Bownairo
Bownairo added this pull request to the merge queue Nov 18, 2026
@Bownairo
Bownairo removed this pull request from the merge queue due to a manual request Nov 18, 2026
@Bownairo
Bownairo added this pull request to the merge queue Nov 18, 2026
Merged via the queue into master with commit beed508 Nov 18, 2026
40 checks passed
@Bownairo
Bownairo deleted the eero/guestos-upgrade-proxy branch November 18, 2026 21:55
basvandijk added a commit that referenced this pull request Nov 18, 2026
…azel-lockfiles

Cargo.lock conflicted only in nss_icos's dependency list. Resolved by
taking this branch's Cargo.lock and running `cargo update --workspace`,
which applied master's manifest changes (#12021, #12094) and moved no
versions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants