mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
# OPNsense releases and update mirror for the Mono Gateway
|
|
|
|
|
|
|
|
|
|
The Mono Gateway (NXP LS1046A) runs an OPNsense build by its vendor. Mono
|
|
|
|
|
stopped maintaining it, and its update mirror `opnsense.mono.si` went dark in
|
|
|
|
|
October 2026: the server still answers, but holds no TLS certificate, so every
|
|
|
|
|
update check fails with "SSL alert number 80". Upstream OPNsense publishes no
|
|
|
|
|
aarch64 builds at all, so nothing can be mirrored. Every release is therefore
|
|
|
|
|
built from source here, signed with our own key, and served from
|
|
|
|
|
**https://opnsense.karsttech.com**.
|
|
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
code.karsttech.com/claude/{opnsense-src,opnsense-deps} github.com/opnsense/{tools,core,ports,plugins}
|
|
|
|
|
\ / (release tags)
|
2026-11-18 23:42:04 -05:00
|
|
|
release/build.sh in the build VM (FreeBSD arm64, emulated on the build host)
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
| unsigned sets -> sign (key in VM memory only) -> image
|
|
|
|
|
release/vm.sh pull-out -> /scratch/mono-opnsense/out/<series>/
|
|
|
|
|
|
|
|
|
|
|
mirror/gwmirror.py stage -> verify -> publish (rsync onto the SMB share)
|
|
|
|
|
|
|
|
|
|
|
nginx container (Portainer stack, share mounted read-only) <- Traefik/NPM (TLS) <- gateway
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
| Piece | Where |
|
|
|
|
|
|---|---|
|
|
|
|
|
| Kernel/base sources: upstream OPNsense src plus the vendor's 27 DPAA/LS1046A commits | `claude/opnsense-src`, branch `stable/<series>` |
|
|
|
|
|
| Board package, core patches, keys, all release tooling (this repository) | `claude/opnsense-deps` |
|
|
|
|
|
| NXP sources the board package builds from | `claude/mwifiex`, `claude/imx-firmware` (daily pull mirrors) |
|
|
|
|
|
| Build framework, core, ports, plugins | upstream GitHub, checked out at the release tag |
|
|
|
|
|
|
2026-11-18 02:06:57 -05:00
|
|
|
The build VM and Portainer clone every repository anonymously, so the four
|
|
|
|
|
`claude/` repositories must be public. That requires the `claude` account
|
|
|
|
|
itself to be public: Forgejo makes every repository of a limited or private
|
|
|
|
|
account "internal", readable by signed-in users only, whatever the
|
|
|
|
|
repository's own setting.
|
|
|
|
|
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
## What a gateway fetches
|
|
|
|
|
|
|
|
|
|
These are the paths opnsense-update and core's firmware scripts request,
|
|
|
|
|
under the URL in `/usr/local/etc/pkg/repos/OPNsense.conf`:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
/FreeBSD:14:aarch64/26.1/latest/ pkg repository (meta.conf, packagesite.*, data.*, All/, Latest/)
|
|
|
|
|
/FreeBSD:14:aarch64/26.1/aux/ build-only packages (repository disabled by default)
|
|
|
|
|
/FreeBSD:14:aarch64/26.1/MINT/<ver>/latest/ snapshot per release, for opnsense-revert -r
|
|
|
|
|
/FreeBSD:14:aarch64/26.1/sets/
|
|
|
|
|
base-<ver>-aarch64.txz(.sig) no device suffix: clients fetch it without
|
|
|
|
|
kernel-<ver>-aarch64-GATEWAY.txz(.sig) suffix from kern.ident "MONO-GATEWAY"
|
|
|
|
|
changelog.txz(.sig), bogons.txz(.sig) proxied by nginx from pkg.opnsense.org (see below)
|
|
|
|
|
{packages,base,kernel}-<next>-aarch64* major upgrade sets for the next series
|
|
|
|
|
/FreeBSD:15:aarch64/26.7/... the same for 26.7 (FreeBSD 15)
|
|
|
|
|
/releases/<series>/OPNsense-<ver>-arm-aarch64-GATEWAY.img.gz(.sig,.sha256) eMMC image
|
|
|
|
|
/healthz
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- The base/kernel release a gateway wants is the version of the
|
|
|
|
|
`opnsense-update` package in the repository, so the sets are built with
|
|
|
|
|
`VERSION=<release>` and named exactly after it.
|
|
|
|
|
- Core reads the changelog and bogons URL from `OPNsense.conf.sample` (the
|
|
|
|
|
build-time package site), not from the live file.
|
|
|
|
|
- changelog.txz and bogons.txz don't depend on the architecture. Upstream
|
|
|
|
|
signs them with the key core already trusts (pkg.opnsense.org.20260120
|
|
|
|
|
for 26.1, .20260608 for 26.7). The container therefore proxies them live
|
|
|
|
|
from upstream's amd64 tree of the same FreeBSD major and series, which
|
|
|
|
|
keeps the bogons current with no scheduled job.
|
|
|
|
|
- The board package `mono-gateway` lives in the main OPNsense repository
|
|
|
|
|
(the vendor had a separate `MonoGateway` one). During a major upgrade,
|
|
|
|
|
`opnsense-update -P` upgrades only the OPNsense repository. The board's
|
|
|
|
|
kernel modules must cross the ABI change with it.
|
|
|
|
|
|
mirror: store the tree under names an SMB share can hold
The mirror share refuses ":" in names, ignores case, and lists device
names such as "aux" under a mangled 8.3 name, which rsync would delete as
an unknown file (the real directory). So FreeBSD:<N>:aarch64 is stored
as FreeBSD_<N>_aarch64 and a series' aux repository as aux-repo, in the
staged tree and on the share alike; nginx rewrites the client URLs onto
them, and gwmirror reads and writes through the same mapping.
verify --root, and therefore publish, now fails on any other name the
share cannot store (reserved characters, device names, trailing dot or
space, names differing only in case).
Checked with the real nginx image in podman: a deep verify --url of a
staged fixture passes, aux included, with the live changelog/bogons proxy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:49:20 -05:00
|
|
|
### Names on disk
|
|
|
|
|
|
|
|
|
|
The mirror is stored on an SMB share, which keeps names the Windows way. On
|
|
|
|
|
ours (checked 2026-11-18):
|
|
|
|
|
- `:` is refused (`NT_STATUS_OBJECT_NAME_INVALID`);
|
|
|
|
|
- names are case-insensitive (`case.txt` replaces `Case.txt`);
|
|
|
|
|
- device names such as `aux` and `con` are stored but listed under a mangled
|
|
|
|
|
8.3 name (`AHY9U3~9`), so rsync would copy them again and then delete the
|
|
|
|
|
"unknown" mangled entry, which is the real directory. A file stored that way
|
|
|
|
|
cannot even be deleted over SMB.
|
|
|
|
|
|
|
|
|
|
So two components of the paths above have other names on disk, in the staged
|
|
|
|
|
tree and on the share alike:
|
|
|
|
|
|
|
|
|
|
| URL path | On disk |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `/FreeBSD:<N>:aarch64/` | `FreeBSD_<N>_aarch64/` |
|
|
|
|
|
| `/FreeBSD:<N>:aarch64/<series>/aux/` | `FreeBSD_<N>_aarch64/<series>/aux-repo/` |
|
|
|
|
|
|
|
|
|
|
The nginx container rewrites the URLs onto them; `gwmirror.py` reads and
|
|
|
|
|
writes through the same mapping (`disk_rel`). Every other name is stored as
|
|
|
|
|
it is, and `verify --root` (so also `publish`) fails on any name the share
|
|
|
|
|
cannot hold: reserved characters, device names, a trailing dot or space, or
|
|
|
|
|
two names in a directory that differ only in case.
|
|
|
|
|
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
## Signing keys and trust
|
|
|
|
|
|
|
|
|
|
- **Private key:** `~/.config/gwmirror/repo.key` on the workstation (RSA
|
|
|
|
|
4096, mode 0600). It is never stored in git, in `/scratch`, on the share or
|
2026-11-18 23:42:04 -05:00
|
|
|
on a VM disk. `vm.sh sign` copies it over ssh, through the build host, into
|
|
|
|
|
a memory file system in the build VM and removes it when signing ends.
|
|
|
|
|
**Keep an offline backup:** anyone holding it can install code as root on
|
|
|
|
|
the gateway.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
- **Public key:** `keys/opnsense.karsttech.com.20261117.pub`.
|
|
|
|
|
- **Fingerprint:** `sha256(repo.pub)` =
|
|
|
|
|
`5fc1e2bf74e0386a2ea1ee60d085d683735a9d7cd8090647be0f476c779c0dc3`, shipped
|
|
|
|
|
by our core package as
|
|
|
|
|
`/usr/local/etc/pkg/fingerprints/OPNsense/trusted/opnsense.karsttech.com.20261117`.
|
|
|
|
|
- **Vendor keys:** `opnsense.mono.si.20260305` and `.20260716` are revoked
|
|
|
|
|
by our core.
|
|
|
|
|
- **What gets signed:** every `.sig` holds the RSA-SHA256 signature over the
|
|
|
|
|
hex sha256 of its file, plus the public key (`SIGNATURE`/`CERT`/`END`). This
|
|
|
|
|
covers sets, `Latest/*.pkg` and the image. The repository catalogues carry
|
|
|
|
|
the same signature inside `packagesite.pkg` and `data.pkg`.
|
|
|
|
|
- **Where trust is configured:** `keys/fingerprints/` (ours: trusted and
|
|
|
|
|
revoked) and `keys/upstream/` (for changelog/bogons). `gwmirror.py` and
|
|
|
|
|
`build.sh finish` both use them. finish refuses any key that is not trusted
|
|
|
|
|
there.
|
|
|
|
|
- **Rotating the key:**
|
|
|
|
|
1. Add the new fingerprint to `trusted/` in the core patch and in
|
|
|
|
|
`keys/fingerprints/`.
|
|
|
|
|
2. Publish one release signed with the old key that ships the new
|
|
|
|
|
fingerprint.
|
|
|
|
|
3. Then switch keys and move the old fingerprint to `revoked/`.
|
|
|
|
|
|
|
|
|
|
## Building a release
|
|
|
|
|
|
|
|
|
|
### Build host
|
|
|
|
|
|
2026-11-18 23:42:04 -05:00
|
|
|
Builds run natively in a FreeBSD arm64 VM that QEMU emulates (TCG) inside a
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
rootless podman container on a build host, named by `GW_VMHOST` (ours: a
|
|
|
|
|
16-core Ryzen AI Max+ 395 running Bazzite). The build host needs podman, curl,
|
2026-11-18 23:42:04 -05:00
|
|
|
sha256sum and xz, and no root. `release/vm.sh` runs `release/vmhost.sh`
|
|
|
|
|
there over ssh; that script builds the container image (QEMU and the arm64
|
|
|
|
|
UEFI firmware, from Debian) on first use and keeps the VM's files in
|
|
|
|
|
`~/gwbuild-vm/<osrel>`. The VM's ssh port listens on the build host's
|
|
|
|
|
loopback only, and vm.sh reaches it through the build host (ProxyJump).
|
|
|
|
|
|
|
|
|
|
Why emulated, not cross-built: on 2026-11-18 an amd64 VM cross-built base,
|
|
|
|
|
kernel and xtools in 64 minutes, but tools builds ports in an aarch64 chroot
|
|
|
|
|
under qemu's user-mode emulation, and no qemu-user-static available for
|
|
|
|
|
FreeBSD 14 can run cargo there (3.1.0 jumps into unmapped memory; 6.2.50
|
|
|
|
|
cannot start FreeBSD 14 programs at all). Every Rust port, py-cryptography
|
|
|
|
|
included, failed. Full-system emulation runs a real FreeBSD kernel: slow
|
|
|
|
|
(roughly a tenth of native speed), but faithful.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
2026-11-23 19:26:41 -05:00
|
|
|
The VM's FreeBSD release must match the series: 15.1 for 26.7 (`OS` in
|
|
|
|
|
tools' `config/<series>/build.conf`). A native aarch64 FreeBSD
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
machine works with the same `build.sh` and no changes.
|
|
|
|
|
|
|
|
|
|
```sh
|
2026-11-18 23:42:04 -05:00
|
|
|
# ~/.config/gwmirror/vm.conf, sourced by vm.sh
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
GW_VMHOST=buildhost # ~/.ssh/config alias of the build host
|
2026-11-18 23:42:04 -05:00
|
|
|
GW_VM_CPUS=24
|
build VM: swap disk, small ZFS cache; salvage interrupted ports steps
A 16 GB VM (18 GB in qemu, 7 GB of it ZFS cache) and the HTPC's other
work ran the HTPC out of memory, and its reboot lost 12 hours of the
ports step. The VM now gets a swap disk of its own (swap.qcow2, serial
gwswap, cache=none: off ZFS, where swap can deadlock, and past the
host's page cache), and setup caps the VM's ZFS cache at 2 GB
(vm_memory). The VM itself goes down to 12 GB in vm.conf.
Tools writes the packages set only when a ports step ends. build now
first adds what an interrupted step had finished (salvage_ports): the
runtime packages in the stage's packages directory, when the stage
belongs to the same series, version and ports commit, each checked to
be a whole archive. Build-only dependencies are rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:50:02 -05:00
|
|
|
GW_VM_MEM=12G # the HTPC's other work needs most of its memory; see Memory below
|
2026-11-18 23:42:04 -05:00
|
|
|
|
2026-11-23 19:26:41 -05:00
|
|
|
release/vm.sh create 15.1 # on the build host: official image, checksum verified, grown to 100G
|
|
|
|
|
release/vm.sh start 15.1 # first boot applies freebsd-update patches: an hour or more emulated
|
|
|
|
|
release/vm.sh setup 15.1 # build.sh setup: host packages, ZFS settings, swap
|
|
|
|
|
release/vm.sh sync 15.1 # this repository (with .git) -> /usr/deps
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
```
|
|
|
|
|
|
2026-11-18 23:42:04 -05:00
|
|
|
- **Image:** the checksums come from download.freebsd.org or, for an old
|
|
|
|
|
release, archive.freebsd.org; the image itself from the first of those or
|
|
|
|
|
a mirror that has it (archive.freebsd.org at times stops sending).
|
|
|
|
|
Stalled transfers are resumed.
|
|
|
|
|
- **Disk:** ZFS with zstd compression and autotrim, in a qcow2 file with
|
|
|
|
|
copy-on-write disabled (the HTPC's home is btrfs).
|
|
|
|
|
- **Setup:** `setup` installs git, python3 and rsync from the frozen package
|
|
|
|
|
set of exactly that FreeBSD release.
|
build VM: swap disk, small ZFS cache; salvage interrupted ports steps
A 16 GB VM (18 GB in qemu, 7 GB of it ZFS cache) and the HTPC's other
work ran the HTPC out of memory, and its reboot lost 12 hours of the
ports step. The VM now gets a swap disk of its own (swap.qcow2, serial
gwswap, cache=none: off ZFS, where swap can deadlock, and past the
host's page cache), and setup caps the VM's ZFS cache at 2 GB
(vm_memory). The VM itself goes down to 12 GB in vm.conf.
Tools writes the packages set only when a ports step ends. build now
first adds what an interrupted step had finished (salvage_ports): the
runtime packages in the stage's packages directory, when the stage
belongs to the same series, version and ports commit, each checked to
be a whole archive. Build-only dependencies are rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:50:02 -05:00
|
|
|
- **Memory:** the build host backs every page of the VM's memory. On
|
|
|
|
|
2026-11-20 a 16 GB VM (18 GB in qemu, 7 GB of it ZFS cache) and the
|
|
|
|
|
HTPC's other work ran it out of memory, and it had to be rebooted. So
|
|
|
|
|
`setup` caps the VM's ZFS cache at 2 GB, and the VM swaps to a disk of
|
|
|
|
|
its own (`swap.qcow2`, `GW_VM_SWAP`, default 16G, serial `gwswap`):
|
|
|
|
|
not on ZFS, where swap can deadlock when memory runs out, and past the
|
|
|
|
|
host's page cache (`cache=none`). Builds that need more than the VM has
|
|
|
|
|
(Rust, LLVM) swap inside the VM instead of pressing on the host.
|
2026-11-20 17:46:16 -05:00
|
|
|
FreeBSD kills a process that has waited 30 seconds for a free page, and
|
|
|
|
|
the emulated VM's pageout can take that long: later that day the Rust
|
|
|
|
|
build lost two `llvm-tblgen` that way, 2.8 hours in, with the swap
|
|
|
|
|
unused. `setup` turns those kills off (`vm.pfault_oom_attempts=-1`).
|
|
|
|
|
On every build host, `build` caps `lang/rust`, which builds its own LLVM
|
|
|
|
|
with a job per CPU, at one job per 768 MB of memory (15 in the 12 GB VM,
|
|
|
|
|
where 24 did not fit), through tools' `make.conf`.
|
2026-11-18 23:42:04 -05:00
|
|
|
- **Restarts:** the VM does not start with the build host. After a reboot,
|
2026-11-19 23:35:12 -05:00
|
|
|
`vm.sh start` it and run `build` again: finished sets are reused. The
|
build VM: swap disk, small ZFS cache; salvage interrupted ports steps
A 16 GB VM (18 GB in qemu, 7 GB of it ZFS cache) and the HTPC's other
work ran the HTPC out of memory, and its reboot lost 12 hours of the
ports step. The VM now gets a swap disk of its own (swap.qcow2, serial
gwswap, cache=none: off ZFS, where swap can deadlock, and past the
host's page cache), and setup caps the VM's ZFS cache at 2 GB
(vm_memory). The VM itself goes down to 12 GB in vm.conf.
Tools writes the packages set only when a ports step ends. build now
first adds what an interrupted step had finished (salvage_ports): the
runtime packages in the stage's packages directory, when the stage
belongs to the same series, version and ports commit, each checked to
be a whole archive. Build-only dependencies are rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:50:02 -05:00
|
|
|
ports step writes its set only when it ends (below); `build` first adds
|
|
|
|
|
the packages an interrupted step had finished.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
|
|
|
|
### Build, sign, collect
|
|
|
|
|
|
|
|
|
|
Commit your changes first: `build` refuses a dirty `/usr/deps` unless
|
|
|
|
|
`ALLOW_DIRTY=1`.
|
|
|
|
|
|
|
|
|
|
```sh
|
2026-11-23 19:26:41 -05:00
|
|
|
release/vm.sh sync 15.1
|
|
|
|
|
release/vm.sh run 15.1 build 26.7 26.7.9 # detached; vm.sh log 15.1 to follow
|
|
|
|
|
release/vm.sh sign 15.1 26.7 26.7.9 # key into a tmpfs in the VM, finish, key unmounted
|
|
|
|
|
release/vm.sh pull-out 15.1 26.7 # -> /scratch/mono-opnsense/out/26.7/{sets,images}
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**`build`:**
|
|
|
|
|
1. Checks out each repository at the release tag, on the branch names tools
|
|
|
|
|
insists on. Override per repository with `TOOLS_REF`, `CORE_REF`,
|
|
|
|
|
`PORTS_REF`, `PLUGINS_REF` or `SRC_REF` when upstream skipped a tag.
|
2026-11-18 01:01:28 -05:00
|
|
|
Src is fetched shallow (its single commit, no tags): the build never needs
|
2026-11-18 01:33:10 -05:00
|
|
|
its history, which is most of its 2 GB. Git never prompts for credentials,
|
|
|
|
|
and a transfer that moves nothing for 10 minutes fails the build instead
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
of hanging. Each checkout must then be at the commit
|
|
|
|
|
`config/lock-<version>` gives it (`tools`, `src`, `ports`, `plugins`,
|
|
|
|
|
`core`, before our patches): a tag that moved upstream, or a src branch
|
|
|
|
|
that moved on, stops the build. Tags are fetched without `--force`, so a
|
|
|
|
|
moved tag already fails the fetch. `build.sh lock SERIES VERSION`
|
|
|
|
|
resolves the refs and writes the commits to `/root/gwlock-<version>` in
|
|
|
|
|
the VM; check them against the upstream tags (`git ls-remote`), then
|
|
|
|
|
commit them as `config/lock-<version>`.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
2. Applies `patches/<series>/*.patch` to core with `git am`. Core's version
|
2026-11-19 16:15:18 -05:00
|
|
|
becomes `<release>_<patches>`.
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
3. Builds base and kernel, then this repository's kernel modules, as an
|
2026-11-27 15:20:05 -05:00
|
|
|
early check against the new kernel. The kernel set must contain
|
|
|
|
|
`boot/kernel/kernel.bin`, the image U-Boot boots: the eMMC image needs
|
|
|
|
|
it, and on the gateway `20-kernel-update` skips a kernel set without
|
|
|
|
|
one, so the old kernel would go on booting.
|
2026-11-19 23:35:12 -05:00
|
|
|
4. Builds the ports in one tools ports step over the whole list, tools'
|
|
|
|
|
`ports.conf`. Tools caches the build-only dependencies it builds (cmake,
|
|
|
|
|
autoconf, the Rust and Go compilers) for the rest of a step only, and the
|
|
|
|
|
packages set keeps just the listed ports and their runtime dependencies.
|
|
|
|
|
Splitting the list into several steps would rebuild those dependencies in
|
|
|
|
|
each one. That cost was measured: a second chunk of 20 started by
|
|
|
|
|
rebuilding the autotools the first chunk had already built. The set is
|
build VM: swap disk, small ZFS cache; salvage interrupted ports steps
A 16 GB VM (18 GB in qemu, 7 GB of it ZFS cache) and the HTPC's other
work ran the HTPC out of memory, and its reboot lost 12 hours of the
ports step. The VM now gets a swap disk of its own (swap.qcow2, serial
gwswap, cache=none: off ZFS, where swap can deadlock, and past the
host's page cache), and setup caps the VM's ZFS cache at 2 GB
(vm_memory). The VM itself goes down to 12 GB in vm.conf.
Tools writes the packages set only when a ports step ends. build now
first adds what an interrupted step had finished (salvage_ports): the
runtime packages in the stage's packages directory, when the stage
belongs to the same series, version and ports commit, each checked to
be a whole archive. Build-only dependencies are rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:50:02 -05:00
|
|
|
written when the step ends. A reboot of the build host during it leaves
|
|
|
|
|
the finished packages only in tools' stage, which the next step clears,
|
|
|
|
|
so `build` first adds them to the set: the runtime packages tools had
|
|
|
|
|
copied to the stage's packages directory, if the stage belongs to the
|
|
|
|
|
same build (series, version and ports commit, kept in
|
2026-11-20 13:52:43 -05:00
|
|
|
`/var/tmp/gwbuild-ports.run`) and each is a whole package archive. The
|
build VM: swap disk, small ZFS cache; salvage interrupted ports steps
A 16 GB VM (18 GB in qemu, 7 GB of it ZFS cache) and the HTPC's other
work ran the HTPC out of memory, and its reboot lost 12 hours of the
ports step. The VM now gets a swap disk of its own (swap.qcow2, serial
gwswap, cache=none: off ZFS, where swap can deadlock, and past the
host's page cache), and setup caps the VM's ZFS cache at 2 GB
(vm_memory). The VM itself goes down to 12 GB in vm.conf.
Tools writes the packages set only when a ports step ends. build now
first adds what an interrupted step had finished (salvage_ports): the
runtime packages in the stage's packages directory, when the stage
belongs to the same series, version and ports commit, each checked to
be a whole archive. Build-only dependencies are rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:50:02 -05:00
|
|
|
build-only dependencies are not kept and get rebuilt. A port that
|
2026-11-19 23:35:12 -05:00
|
|
|
fails is recorded and the step goes on with the others, then fails at the
|
|
|
|
|
end. Tools stops at the first failure only when its step is given an
|
2026-11-22 16:40:09 -05:00
|
|
|
argument, and `build` gives none. Once the failures are fixed, run `build`
|
|
|
|
|
again. Finished sets are reused, and the ports step skips every package
|
|
|
|
|
it has built. It does rebuild the build-only dependencies of the ports it
|
|
|
|
|
still has to build.
|
2026-11-20 18:11:57 -05:00
|
|
|
- After each port, tools ran `make clean` to remove its work directories
|
|
|
|
|
and its dependencies'. That clean runs each dependency's clean with the
|
|
|
|
|
port's own flavor, so a dependency with another flavor, or with none,
|
|
|
|
|
looks for the wrong `work-<flavor>` and keeps its work directory.
|
|
|
|
|
After a failure, tools removes the dependencies it built. A stale
|
|
|
|
|
directory then claims they are installed, so every later port that
|
|
|
|
|
needs them fails at once. On 2026-11-20 that happened to Rust ("Couldn't
|
|
|
|
|
find required command: cmake") and to libxslt ("libxslt.so - not
|
|
|
|
|
found").
|
|
|
|
|
- So `build` changes tools' `ports.sh` at checkout: after each port it
|
|
|
|
|
removes every work directory (`rm -rf /usr/obj/usr/ports`) instead of
|
|
|
|
|
cleaning. The build stops if tools' `ports.sh` no longer has the two
|
|
|
|
|
cleans it replaces.
|
2026-11-22 09:29:09 -05:00
|
|
|
- `config/make-<series>.conf` is added to tools' `make.conf`. Some ports
|
|
|
|
|
still download code while they build, at its newest version, and
|
2026-11-23 19:26:41 -05:00
|
|
|
upstream built them when the release was tagged. It pins
|
2026-11-22 09:29:09 -05:00
|
|
|
`www/caddy-custom`'s plugins, which xcaddy fetches, at their versions
|
2026-11-23 19:26:41 -05:00
|
|
|
of the release's tag date: on 2026-11-22 the newest `caddy-l4` needed
|
|
|
|
|
a newer Caddy than 26.1's ports tree had, and the port failed. For a
|
|
|
|
|
new series or release, pin them
|
2026-11-22 09:29:09 -05:00
|
|
|
at the release's tag date (`proxy.golang.org/<module>/@v/list` and
|
|
|
|
|
`.info`; a module without tags takes the pseudo-version of its last
|
|
|
|
|
commit before then).
|
2026-11-19 16:15:18 -05:00
|
|
|
5. The ports fetch their distfiles as they build. Some no longer download as
|
|
|
|
|
recorded in the ports tree's distinfo, chiefly patches GitHub generates
|
|
|
|
|
on the fly (`github.com/<owner>/<repo>/commit/<hash>.patch`): GitHub
|
|
|
|
|
abbreviates the object names on their `index` lines with more digits as
|
2026-11-22 08:45:46 -05:00
|
|
|
a repository grows, so an old patch now differs by a few bytes. Codeberg
|
|
|
|
|
tag archives (`codeberg.org/<owner>/<repo>/archive/<tag>.tar.gz`) changed
|
|
|
|
|
too: Codeberg now compresses them with GNU gzip instead of git's own, and
|
|
|
|
|
the same tar comes out smaller. FreeBSD's distfile cache does not help
|
|
|
|
|
here. It keeps the originals only of FreeBSD's own ports, so it has
|
2026-11-23 19:38:52 -05:00
|
|
|
nothing for OPNsense's (e.g. the patches of `opnsense/pkg`). For
|
2026-11-22 08:45:46 -05:00
|
|
|
`sysutils/sysinfo` it served the new archive as well (2026-11-22).
|
|
|
|
|
- Such ports are fetched on the build host with
|
|
|
|
|
`release/fetch-distfile.sh`. For a GitHub patch, it shortens the
|
|
|
|
|
abbreviations until the size matches distinfo. GitHub turns automated
|
|
|
|
|
requests away now and then ("Service Unavailable"), so the current
|
|
|
|
|
patch is tried three times, a minute apart. For a Codeberg archive, it
|
|
|
|
|
clones the tag and makes the archive with `git archive --format=tar.gz
|
|
|
|
|
-6`. Either way, the port's `checksum` target then verifies the
|
|
|
|
|
SHA256, so only the original bytes are accepted. The results are
|
|
|
|
|
appended to the distfiles set, which
|
2026-11-19 23:41:58 -05:00
|
|
|
tools extracts into every ports step's chroot. A port whose distfiles
|
|
|
|
|
the set has already is skipped, so a rerun downloads nothing for it.
|
2026-11-23 19:38:52 -05:00
|
|
|
- `opnsense/pkg` (tools' `PKG_ORIGIN`, not `ports-mgmt/pkg`) is fetched
|
|
|
|
|
this way first: the ports step's chroot builds pkg before anything
|
|
|
|
|
else, and tools needs the same pkg version on the build host
|
|
|
|
|
(`pkg -v`), so `build` builds it there too when the version differs
|
|
|
|
|
(`vm.sh setup` installs FreeBSD's). Both take its
|
2026-11-20 13:59:34 -05:00
|
|
|
distfiles from the set, not from GitHub, which turned its patches
|
|
|
|
|
away for minutes at a time on 2026-11-20.
|
2026-11-19 16:15:18 -05:00
|
|
|
- Any other port whose distfiles fail to fetch ("Couldn't fetch it" in
|
|
|
|
|
the step's output, `/var/tmp/gwbuild-ports.log`) is fetched this way
|
2026-11-19 23:35:12 -05:00
|
|
|
and the ports step runs once more. It skips the packages it has
|
|
|
|
|
already built, but rebuilds the build-only dependencies of the ports
|
|
|
|
|
it still has to build. A distfile that still cannot be fetched
|
2026-11-19 16:15:18 -05:00
|
|
|
stops the build with the port's name.
|
|
|
|
|
- Tools' own `distfiles` step, which would fetch every distfile up front
|
|
|
|
|
for offline rebuilds, is not run. It walks the whole dependency tree of
|
|
|
|
|
every port again, one `make` at a time: 70 of 266 ports in 9 hours
|
|
|
|
|
under emulation. For flavored ports it walks the default flavor's tree
|
|
|
|
|
(QEMU's desktop dependencies for `qemu@guestagent`) and fails on a port
|
|
|
|
|
the build never needs. Also, its fetch loop records failures at a path
|
|
|
|
|
outside its chroot, so the first failure ends the loop.
|
2026-11-18 23:42:04 -05:00
|
|
|
6. Builds plugins, core and the packages set.
|
|
|
|
|
7. Builds the board package against the base set's headers and our libxml2,
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
and puts it into the packages set.
|
|
|
|
|
|
|
|
|
|
**`finish`:**
|
|
|
|
|
1. Checks the key against `keys/fingerprints/trusted`.
|
|
|
|
|
2. Signs base, kernel, packages and aux. Signing the packages set regenerates
|
2026-11-22 17:34:56 -05:00
|
|
|
the catalogue, so it includes `mono-gateway`. Tools does not do the same
|
|
|
|
|
for the aux set: it signs the aux catalogue only in a packages step run
|
|
|
|
|
with the key. So `finish` first unpacks the aux set, signs its catalogue
|
|
|
|
|
with `pkg repo` and repacks it. `gwmirror verify` found the aux catalogue
|
|
|
|
|
unsigned on 2026-11-22.
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
3. Builds the 5 GB ZFS eMMC image (`mk-image.sh`).
|
2026-11-22 16:40:09 -05:00
|
|
|
4. Imports the image's pool read-only, without mounting it, and mounts each
|
|
|
|
|
dataset read-only by itself. Mounting them all at import does not work:
|
|
|
|
|
the pool's own dataset needs a mountpoint inside the read-only root, and
|
|
|
|
|
the import then leaves nothing mounted (2026-11-22). Fails if any
|
|
|
|
|
non-aarch64 ELF file is found (firmware blobs aside), if a dataset cannot
|
|
|
|
|
be mounted, or if the root dataset has no `/bin/sh`, so an empty scan
|
|
|
|
|
cannot pass.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
5. Compresses and signs the image.
|
|
|
|
|
|
|
|
|
|
### Board package version
|
|
|
|
|
|
|
|
|
|
`mono-gateway` is versioned `<release>_<commit count of this repository>`,
|
|
|
|
|
e.g. `26.1.11_74`. That always upgrades the previous build, and also the
|
|
|
|
|
vendor's `26.1.5_N` packages.
|
|
|
|
|
|
2026-11-28 04:16:25 -05:00
|
|
|
### Hardware flow offload (off by default)
|
2026-11-22 21:12:19 -05:00
|
|
|
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
With cmm running, FMan forwards established flows in hardware: pf decides a
|
|
|
|
|
flow's first packets, then the hardware forwards the rest with pf's
|
2026-11-28 04:16:25 -05:00
|
|
|
translation, and pf's states and counters follow it. It is only needed for
|
|
|
|
|
multi-gigabit throughput on the 10 GbE ports, so images set
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
`cmm_enable="NO"` (`rc.d/rc.conf.local`): the board modules load, but
|
2026-11-28 04:16:25 -05:00
|
|
|
nothing is offloaded until cmm is turned on. Turning it on and off, and its
|
|
|
|
|
caveats for users, are in README.md ("Hardware flow offload").
|
2026-11-22 21:12:19 -05:00
|
|
|
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
A flow goes into hardware only where that does what pf would have done
|
|
|
|
|
(`fastpath/pf_notify/`, `fastpath/cmm/cmm_conn.c`, ARCHITECTURE.md):
|
|
|
|
|
|
|
|
|
|
- pf passed it in and out, and none of its rules asks for something only pf
|
|
|
|
|
does per packet: dup-to, another FIB, a shaper pipe or queue, ALTQ,
|
2026-11-28 04:22:57 -05:00
|
|
|
`log (all)` or pflow, scrub options, set-tos, max-mss, min-ttl, af-to
|
|
|
|
|
(NAT64);
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
- the routing table sends each direction out of the interface pf's state for
|
|
|
|
|
it is on. A route-to or reply-to counts only while it names the same
|
|
|
|
|
interface and next hop as the routing table, as OPNsense's automatic
|
|
|
|
|
force-gateway and WAN reply-to rules do on a single WAN. Policy routing to
|
|
|
|
|
another gateway (a VPN, a second WAN) stays in pf, and a route change
|
|
|
|
|
tears down the flows that use the route;
|
|
|
|
|
- bridged traffic is offloaded only while pf filters neither the members nor
|
|
|
|
|
the bridge (`net.link.bridge.pfil_member` and `pfil_bridge` both 0);
|
|
|
|
|
- only offloaded states are made sloppy (no TCP window tracking). A state pf
|
|
|
|
|
deletes (close, timeout, `pfctl -k`) takes its hardware flow with it, and
|
|
|
|
|
if deletion events are ever lost, cmm drops every hardware flow
|
|
|
|
|
(`net.pfnotify.resyncs`).
|
|
|
|
|
|
2026-11-28 04:16:25 -05:00
|
|
|
Offloaded packets never reach the host, so software that watches
|
|
|
|
|
interfaces (Suricata, Zenarmor, Insight/NetFlow, tcpdump) misses them, and
|
|
|
|
|
so do counters kept in software (VLAN interfaces, pf rules); physical ports
|
|
|
|
|
count in hardware, and cmm copies the hardware's counts into pf's states.
|
|
|
|
|
IPsec is not offloaded (the vendor's IPsec offload was removed); it runs in
|
|
|
|
|
FreeBSD's stack, with CAAM through crypto(9).
|
|
|
|
|
|
2026-11-28 04:22:57 -05:00
|
|
|
A next hop's MAC address goes into CDX when its route is programmed. Every
|
|
|
|
|
30 seconds, and after route-socket changes, cmm re-reads the ARP and NDP
|
|
|
|
|
tables and tears down routes whose next hop moved to another MAC or left
|
|
|
|
|
the table (`cmm_neigh_check()`, `cmm_route_check_neighbors()`): its IP may
|
|
|
|
|
belong to another host by then. Neighbors no route uses are not cached.
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
|
|
|
|
|
After updating `mono-gateway` with cmm on, reboot: until then the new cmm
|
|
|
|
|
and the loaded `pf_notify.ko` differ, and cmm offloads nothing (it logs
|
|
|
|
|
"short pfnotify read").
|
|
|
|
|
|
|
|
|
|
The vendor's offload, which the security audit of 2026-11-22 found unsafe,
|
|
|
|
|
ignored route-to and reply-to, made every pf state sloppy, offloaded bridged
|
|
|
|
|
traffic past pf, could keep a hardware flow after its pf state was gone, and
|
|
|
|
|
panicked on decrypted IPsec packets. The rework was tested on a gateway on
|
|
|
|
|
2026-11-28; the results are in the merge commit (`git log --merges`).
|
2026-11-22 21:12:19 -05:00
|
|
|
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
## Stage, verify, publish
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
M=/scratch/mono-opnsense/mirror
|
2026-11-23 19:26:41 -05:00
|
|
|
python3 mirror/gwmirror.py stage --sets /scratch/mono-opnsense/out/26.7 --mirror $M --series 26.7 --version 26.7.9 --upgrade-from 26.1
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
python3 mirror/gwmirror.py verify --root $M # deep: hashes, signatures, ELF architecture
|
|
|
|
|
python3 mirror/gwmirror.py publish --mirror $M --dest /mnt/opnsense-mirror # re-verifies first
|
2026-11-23 19:26:41 -05:00
|
|
|
python3 mirror/gwmirror.py verify --url https://opnsense.karsttech.com --series FreeBSD:14:aarch64/26.1 --series FreeBSD:15:aarch64/26.7
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**`stage`** lays one build into the tree above:
|
|
|
|
|
- renames the base set;
|
|
|
|
|
- extracts the packages and aux sets, skipping tools' dotfile build markers;
|
|
|
|
|
- hard-links a MINT snapshot;
|
|
|
|
|
- copies the image;
|
|
|
|
|
- with `--upgrade-from <series>`, also places this build's sets in that
|
|
|
|
|
series' `sets/` as its major upgrade.
|
|
|
|
|
|
|
|
|
|
**`verify --root`** checks, for each `<ABI>/<series>`:
|
|
|
|
|
- the catalogue signatures, and that both catalogues agree;
|
gwmirror: verify pkg 2.8 catalogues and the major upgrade's set
- pkg 2.8 (26.7) writes a package's catalogue checksum as "2$" and its
BLAKE2b-512 in pkg's base32; accept it next to pkg 2.3's SHA-256 hex
and check each against its own digest, read once for both. Latest/
signatures stay over the SHA-256: a BLAKE2b catalogue checks them when
deep, and only their key when shallow, as for the sets.
- TarSource members share the set's file object, which every read
seeks, and verify_repo reads them from eight threads: the 26.7.9
upgrade set failed at random packages. Reads now take turns.
- Report the upgrade set's results under its path, not ".".
- Clean up the trust objects' temporary directories.
Tests: the root and URL verify tests run again with BLAKE2b catalogues,
a pkg 2.8.4 checksum pins the encoding, and the upgrade set gets its
own tests (parallel reads of large packages, a tampered package in a
signed set, a bad .abi_hint).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:33:59 -05:00
|
|
|
- every package's path, ABI, size and checksum, and in the main repository
|
2026-11-22 18:30:09 -05:00
|
|
|
its `Latest/` signature (tools makes `Latest/` for the main repository
|
gwmirror: verify pkg 2.8 catalogues and the major upgrade's set
- pkg 2.8 (26.7) writes a package's catalogue checksum as "2$" and its
BLAKE2b-512 in pkg's base32; accept it next to pkg 2.3's SHA-256 hex
and check each against its own digest, read once for both. Latest/
signatures stay over the SHA-256: a BLAKE2b catalogue checks them when
deep, and only their key when shallow, as for the sets.
- TarSource members share the set's file object, which every read
seeks, and verify_repo reads them from eight threads: the 26.7.9
upgrade set failed at random packages. Reads now take turns.
- Report the upgrade set's results under its path, not ".".
- Clean up the trust objects' temporary directories.
Tests: the root and URL verify tests run again with BLAKE2b catalogues,
a pkg 2.8.4 checksum pins the encoding, and the upgrade set gets its
own tests (parallel reads of large packages, a tampered package in a
signed set, a bad .abi_hint).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:33:59 -05:00
|
|
|
only; upstream's aux repository has none either). The catalogue's
|
|
|
|
|
checksum is the file's SHA-256 in hex up to pkg 2.3 (26.1), and from
|
|
|
|
|
pkg 2.8 (26.7) `2$` and its BLAKE2b-512 in pkg's own base32.
|
|
|
|
|
`Latest/` signatures are over the SHA-256 either way, so with a BLAKE2b
|
|
|
|
|
catalogue a shallow verify (`--url` without `--deep`) checks only that
|
|
|
|
|
they come from a trusted key, as it does for the sets;
|
|
|
|
|
- the major upgrade's packages set in the previous series' `sets/`, read
|
|
|
|
|
in place as the repository `opnsense-update -P` installs from;
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
- the set and image signatures against `keys/fingerprints`;
|
2026-11-22 18:30:09 -05:00
|
|
|
- that every ELF inside every package and set is aarch64. Firmware
|
|
|
|
|
directories are excepted, and so is the Go toolchain's source tree
|
|
|
|
|
(`/usr/local/go<N>/src/`, in the aux repository), which ships test data
|
|
|
|
|
and race-detector objects for every platform.
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
- that every name can be stored on the SMB share (see "Names on disk");
|
|
|
|
|
- that no symlink leads outside the tree or nowhere: `publish` copies with
|
|
|
|
|
`rsync -L`, which would publish a link's target.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
|
|
|
|
Nothing is extracted to disk while verifying.
|
|
|
|
|
|
|
|
|
|
**`verify --url`** also checks:
|
|
|
|
|
- the TLS certificate (it must have 21+ days left);
|
|
|
|
|
- `/healthz`;
|
|
|
|
|
- Content-Length on the sets;
|
|
|
|
|
- that no redirect leads elsewhere;
|
|
|
|
|
- the proxied changelog/bogons signatures against `keys/upstream`.
|
|
|
|
|
|
|
|
|
|
`--url` is shallow by default (sizes and signatures, no downloads beyond the
|
|
|
|
|
catalogues). `--deep` downloads and hashes everything.
|
|
|
|
|
|
2026-11-28 01:32:15 -05:00
|
|
|
**`publish`** first refuses to delete a series. If the destination has a
|
|
|
|
|
directory in its top two levels (`FreeBSD_14_aarch64`,
|
|
|
|
|
`FreeBSD_14_aarch64/26.1`, `releases/26.1`) that the staged tree lacks, it
|
|
|
|
|
stops before verifying. A series is retired by deleting it from the share by
|
|
|
|
|
hand. `publish` then refuses to copy a tree that fails verification, and runs
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
`rsync -rtL --delay-updates --delete-after`: symlinks become plain files
|
|
|
|
|
(SMB keeps none), and clients never see a half-written repository.
|
|
|
|
|
|
mirror: store the tree under names an SMB share can hold
The mirror share refuses ":" in names, ignores case, and lists device
names such as "aux" under a mangled 8.3 name, which rsync would delete as
an unknown file (the real directory). So FreeBSD:<N>:aarch64 is stored
as FreeBSD_<N>_aarch64 and a series' aux repository as aux-repo, in the
staged tree and on the share alike; nginx rewrites the client URLs onto
them, and gwmirror reads and writes through the same mapping.
verify --root, and therefore publish, now fails on any other name the
share cannot store (reserved characters, device names, trailing dot or
space, names differing only in case).
Checked with the real nginx image in podman: a deep verify --url of a
staged fixture passes, aux included, with the live changelog/bogons proxy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:49:20 -05:00
|
|
|
The share is mounted on the workstation with the kernel CIFS client (as
|
|
|
|
|
root, once; `cifs-utils` installed), owned by the workstation user so rsync
|
|
|
|
|
needs no privileges:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# /etc/fstab
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
//<server>/<share>/<folder> /mnt/opnsense-mirror cifs credentials=/home/<user>/.config/gwmirror/smb-credentials,uid=<user>,gid=<user>,vers=3.0,nofail,_netdev 0 0
|
mirror: store the tree under names an SMB share can hold
The mirror share refuses ":" in names, ignores case, and lists device
names such as "aux" under a mangled 8.3 name, which rsync would delete as
an unknown file (the real directory). So FreeBSD:<N>:aarch64 is stored
as FreeBSD_<N>_aarch64 and a series' aux repository as aux-repo, in the
staged tree and on the share alike; nginx rewrites the client URLs onto
them, and gwmirror reads and writes through the same mapping.
verify --root, and therefore publish, now fails on any other name the
share cannot store (reserved characters, device names, trailing dot or
space, names differing only in case).
Checked with the real nginx image in podman: a deep verify --url of a
staged fixture passes, aux included, with the live changelog/bogons proxy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:49:20 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
`~/.config/gwmirror/smb-credentials` (mode 0600) holds `username=` and
|
2026-11-18 15:44:58 -05:00
|
|
|
`password=` lines. The tree goes into a folder of the share (ours: `mirror/`),
|
|
|
|
|
and nothing else may live in that folder: `--delete-after` removes it. The
|
|
|
|
|
container's `SMB_SHARE` names the same folder (`<share>/mirror`).
|
mirror: store the tree under names an SMB share can hold
The mirror share refuses ":" in names, ignores case, and lists device
names such as "aux" under a mangled 8.3 name, which rsync would delete as
an unknown file (the real directory). So FreeBSD:<N>:aarch64 is stored
as FreeBSD_<N>_aarch64 and a series' aux repository as aux-repo, in the
staged tree and on the share alike; nginx rewrites the client URLs onto
them, and gwmirror reads and writes through the same mapping.
verify --root, and therefore publish, now fails on any other name the
share cannot store (reserved characters, device names, trailing dot or
space, names differing only in case).
Checked with the real nginx image in podman: a deep verify --url of a
staged fixture passes, aux included, with the live changelog/bogons proxy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:49:20 -05:00
|
|
|
|
2026-11-28 01:32:15 -05:00
|
|
|
### Restoring the staged mirror
|
|
|
|
|
|
|
|
|
|
The staged tree in `/scratch` is a working copy, and the share holds the
|
|
|
|
|
only copy of series that are no longer built (26.1 since 2026-11-28). If
|
|
|
|
|
`/scratch` is lost, copy the share back, then re-stage the current build so
|
|
|
|
|
its symlinks and hard links return (the rest stays as plain copies, which
|
|
|
|
|
verify the same way):
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
M=/scratch/mono-opnsense/mirror
|
|
|
|
|
mkdir -p $M && rsync -rt /mnt/opnsense-mirror/ $M/
|
|
|
|
|
release/vm.sh pull-out 15.1 26.7
|
|
|
|
|
python3 mirror/gwmirror.py stage --sets /scratch/mono-opnsense/out/26.7 --mirror $M --series 26.7 --version 26.7.9 --upgrade-from 26.1
|
|
|
|
|
python3 mirror/gwmirror.py verify --root $M
|
|
|
|
|
rsync -rL -n -i -c --delete-after --exclude='.*' $M/ /mnt/opnsense-mirror/ # prints nothing: publish would change no content
|
|
|
|
|
```
|
|
|
|
|
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
## Serving the mirror
|
|
|
|
|
|
|
|
|
|
`mirror/server/` holds the stack:
|
|
|
|
|
- an unprivileged nginx on a read-only root;
|
mirror: store the tree under names an SMB share can hold
The mirror share refuses ":" in names, ignores case, and lists device
names such as "aux" under a mangled 8.3 name, which rsync would delete as
an unknown file (the real directory). So FreeBSD:<N>:aarch64 is stored
as FreeBSD_<N>_aarch64 and a series' aux repository as aux-repo, in the
staged tree and on the share alike; nginx rewrites the client URLs onto
them, and gwmirror reads and writes through the same mapping.
verify --root, and therefore publish, now fails on any other name the
share cannot store (reserved characters, device names, trailing dot or
space, names differing only in case).
Checked with the real nginx image in podman: a deep verify --url of a
staged fixture passes, aux included, with the live changelog/bogons proxy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 14:49:20 -05:00
|
|
|
- the URL-to-disk name rewrites (see "Names on disk");
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
- GET/HEAD only, dotfiles hidden, autoindex on;
|
|
|
|
|
- the changelog/bogons proxy;
|
|
|
|
|
- `/healthz`.
|
|
|
|
|
|
|
|
|
|
Deploy it as a Portainer stack from this repository (compose path
|
|
|
|
|
`mirror/server/docker-compose.yml`), with the SMB share settings as stack
|
|
|
|
|
variables. The header of the compose file lists the variables, the
|
|
|
|
|
reverse-proxy requirements and the DOCKER-USER rule.
|
|
|
|
|
|
|
|
|
|
The gateway itself must reach the proxy. If `opnsense.karsttech.com`
|
|
|
|
|
resolves to the gateway's own WAN address, add an Unbound host override that
|
|
|
|
|
points it at the proxy's LAN IP.
|
|
|
|
|
|
|
|
|
|
To test locally with podman, serving a staged tree:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
podman build -t opnsense-mirror:local mirror/server
|
|
|
|
|
podman run -d --rm --name gwmirror -p 127.0.0.1:18080:8080 -v $M:/srv/mirror:ro \
|
|
|
|
|
--read-only --tmpfs /tmp --cap-drop ALL --security-opt no-new-privileges opnsense-mirror:local
|
|
|
|
|
python3 mirror/gwmirror.py verify --url http://127.0.0.1:18080 --allow-http --series FreeBSD:14:aarch64/26.1
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Migrating a gateway from opnsense.mono.si
|
|
|
|
|
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
Shell commands, run on the gateway over ssh as root. Root's shell there is
|
|
|
|
|
csh, which does not take `#` comments typed at the prompt: start `sh` first.
|
|
|
|
|
ApolloGuardian was migrated this way on 2026-11-23.
|
|
|
|
|
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
**Before you start:**
|
|
|
|
|
- Download a configuration backup (System > Configuration > Backups).
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
- Have the serial console (115200 baud), or Recovery Linux and the image in
|
|
|
|
|
`releases/26.1/`, at hand for the first kernel update.
|
|
|
|
|
- `opnsense.karsttech.com` resolves to the public address, which is the
|
|
|
|
|
gateway's own WAN address: without an Unbound host override to the
|
|
|
|
|
proxy's LAN IP, the gateway connects to its own web GUI. With the
|
|
|
|
|
override, the URL depends on the proxy's LAN port (step 4).
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
**1. Checks.** `opnsense-verify -a` must print `FreeBSD:14:aarch64`,
|
|
|
|
|
`opnsense-version -a` `26.1`, and the fetches `ok` and `repo-ok` (add the
|
|
|
|
|
proxy's port to the URLs if it is not 443 inside the LAN):
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
```sh
|
|
|
|
|
sh
|
|
|
|
|
opnsense-verify -a
|
|
|
|
|
opnsense-version -a
|
|
|
|
|
fetch -qo - https://opnsense.karsttech.com/healthz
|
|
|
|
|
fetch -qo /dev/null https://opnsense.karsttech.com/FreeBSD:14:aarch64/26.1/latest/meta.conf && echo repo-ok
|
|
|
|
|
```
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
**2. Backup and boot environment:**
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
B=/root/gwmirror-backup-$(date +%Y%m%d%H%M%S)
|
|
|
|
|
mkdir -p $B
|
|
|
|
|
cp -p /usr/local/etc/pkg/repos/* $B/
|
|
|
|
|
bectl create pre-gwmirror
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**3. Trust the signing key** (keys/fingerprints/trusted):
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
printf 'function: "sha256"\nfingerprint: "5fc1e2bf74e0386a2ea1ee60d085d683735a9d7cd8090647be0f476c779c0dc3"\n' > /usr/local/etc/pkg/fingerprints/OPNsense/trusted/opnsense.karsttech.com.20261117
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**4. Point the repositories at the mirror.** If the proxy answers on 443
|
|
|
|
|
inside the LAN, rewrite the URLs in the repository files and their
|
|
|
|
|
`.sample` files (`${ABI}` stays literal):
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
cd /usr/local/etc/pkg/repos
|
|
|
|
|
for f in OPNsense.conf.sample OPNsense-aux.conf.sample OPNsense.conf OPNsense-aux.conf; do
|
|
|
|
|
[ -f $f ] && sed -i '' 's|^\([[:space:]]*url:[[:space:]]*"\)[^"]*\(/${ABI}/\)|\1https://opnsense.karsttech.com\2|' $f
|
|
|
|
|
done
|
|
|
|
|
cd
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If the gateway reaches the proxy only on another port (at home Traefik
|
|
|
|
|
listens on 444 and the router forwards WAN 443 to it; pf cannot redirect
|
|
|
|
|
connections the firewall makes itself), set a custom mirror instead. It is
|
|
|
|
|
kept in `config.xml`, and core applies it at every firmware reload
|
|
|
|
|
(`opnsense-update -sd -m`), so it survives core updates. The GUI (System >
|
|
|
|
|
Firmware > Settings, Mirror "(custom)") did not store it on the vendor's
|
|
|
|
|
26.1.9; this did, keeping the previous version in System > Configuration >
|
|
|
|
|
History:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
/usr/local/bin/php -r 'require_once("config.inc"); require_once("util.inc"); global $config; $config["system"]["firmware"]["mirror"] = "https://opnsense.karsttech.com:444"; write_config("custom mirror opnsense.karsttech.com:444");'
|
|
|
|
|
pluginctl -g system.firmware.mirror
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The changelog and bogons downloads do not follow a custom mirror:
|
|
|
|
|
`opnsense-update -X` reads core's `OPNsense.conf.sample`, which names the
|
|
|
|
|
mirror without a port. On such a gateway the GUI changelog does not load
|
|
|
|
|
and the bogons list keeps the version it has. Serving the proxy on 443
|
|
|
|
|
inside the LAN avoids both.
|
|
|
|
|
|
|
|
|
|
**5. Drop the vendor's MonoGateway repository** and move `mono-gateway` to
|
|
|
|
|
the OPNsense repository (`opnsense-update -P` of a major upgrade only
|
|
|
|
|
upgrades that one):
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
rm -f /usr/local/etc/pkg/repos/MonoGateway.conf
|
|
|
|
|
pkg info -e mono-gateway && pkg annotate -qyM mono-gateway repository OPNsense
|
|
|
|
|
```
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
**6. Reload and check.** `opnsense-update -M` must name the new mirror, and
|
|
|
|
|
`pkg update -f` must accept the catalogue ("804 packages processed"; it
|
|
|
|
|
fails on a key that is not trusted):
|
2026-11-22 20:25:17 -05:00
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
configctl firmware reload
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
opnsense-update -M
|
|
|
|
|
grep -H url: /usr/local/etc/pkg/repos/OPNsense*.conf
|
|
|
|
|
pkg update -f
|
2026-11-22 20:25:17 -05:00
|
|
|
```
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
|
|
|
|
|
To undo before step 7: `cp -p $B/* /usr/local/etc/pkg/repos/`, remove the
|
|
|
|
|
fingerprint file (and the custom mirror, in System > Configuration >
|
|
|
|
|
History), `configctl firmware reload`. After step 7: `bectl activate
|
|
|
|
|
pre-gwmirror` and reboot.
|
|
|
|
|
|
|
|
|
|
**7. Update** in System > Firmware > Updates: Check for updates, then
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
update. This installs our core `26.1.11_2`, then the packages, base and
|
|
|
|
|
kernel, and reboots. That core names only our mirror and revokes the
|
|
|
|
|
vendor's keys. Besides ours it still trusts upstream's key
|
|
|
|
|
(`pkg.opnsense.org.20260120`; `.20260608` in 26.7), which signs the
|
|
|
|
|
changelog and bogons sets the mirror passes through from upstream.
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
|
|
|
|
|
**8. Reinstall everything once**, so no vendor-built binary remains, then
|
|
|
|
|
reboot:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
sh
|
|
|
|
|
opnsense-update -pf
|
|
|
|
|
opnsense-update -bkf
|
|
|
|
|
reboot
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**9. Check:**
|
|
|
|
|
- `opnsense-version` shows the release, `uname -v` our src fork's commit and
|
|
|
|
|
`MONO-GATEWAY`;
|
|
|
|
|
- `kldstat` lists cdx, fci and the other board modules (`ina2xx` is built
|
|
|
|
|
into the kernel: `kldstat -v | grep ina`), and mwifiex and dpaa_wifi when
|
|
|
|
|
the Wi-Fi card is fitted;
|
|
|
|
|
- System > Firmware > Status > Audit > Health is clean.
|
2026-11-22 20:21:15 -05:00
|
|
|
|
2026-11-28 04:16:25 -05:00
|
|
|
**10. Turn off hardware flow offload** (see "Hardware flow offload (off by
|
|
|
|
|
default)"; README.md has how to turn it on later). The vendor image's `/etc/rc.conf.local`
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
enables cmm and no package manages that file:
|
2026-11-22 21:12:19 -05:00
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
sh
|
|
|
|
|
sysrc -f /etc/rc.conf.local cmm_enable=NO
|
|
|
|
|
service cmm onestop
|
|
|
|
|
pgrep -l cmm || echo cmm-stopped
|
|
|
|
|
```
|
|
|
|
|
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
## Major upgrade (26.1 to 26.7)
|
|
|
|
|
|
|
|
|
|
1. **Kernel fork:** rebase `stable/26.7` of the src fork onto the 26.7.x tag
|
2026-11-22 20:45:30 -05:00
|
|
|
(see README.md). For 26.7.9 (2026-11-23), Mono's 27 commits on 26.7
|
|
|
|
|
rebased onto the tag without conflicts; Mono's tip is tagged
|
2026-11-22 21:17:37 -05:00
|
|
|
`mono/stable/26.7`. One of them was broken on Mono's 26.7 branch:
|
|
|
|
|
"pf: add state creation/destruction notification hooks" also replaced
|
|
|
|
|
parts of `pf.c` with older 14.x code (`s->rule.ptr`, the former SCTP and
|
|
|
|
|
ICMP cases), which does not compile. It was rebuilt from its 26.1
|
|
|
|
|
version: the hook call after each pfsync insert, update and delete call
|
|
|
|
|
(five in 26.7's single `pf_test`) and the declarations. To spot such a
|
|
|
|
|
commit, compare each commit's insertions and deletions with its 26.1
|
2026-11-23 16:52:50 -05:00
|
|
|
counterpart (`git show --numstat`); the others matched. FreeBSD 15 also
|
|
|
|
|
removed `GEOM_BDE`, so a commit on top drops it from the `GATEWAY` kernel
|
|
|
|
|
config. Before building, check the config's options against the new tree:
|
|
|
|
|
`config -d /tmp/x GATEWAY` in `sys/arm64/conf` stops at the first unknown
|
2026-11-23 19:26:41 -05:00
|
|
|
one. A second commit fixes three FreeBSD 15 compile errors in Mono's
|
|
|
|
|
code: two `machdep.c` lines that 26.7 no longer needs (upstream defines
|
|
|
|
|
`socdev_va` itself and dropped `hcr_el2`), the moved `dev/clk/clk.h`, and
|
|
|
|
|
`cpu_dcache_wbinv_range()` now taking a pointer. To find every compile
|
|
|
|
|
error in one pass rather than one per build, run tools' `buildkernel`
|
2026-11-27 15:20:05 -05:00
|
|
|
by hand in the VM with `make -k ... KERNFAST=1` after a failure. A third
|
|
|
|
|
commit sets `makeoptions WITH_KERNEL_BIN=t`: FreeBSD 15 builds
|
|
|
|
|
`kernel.bin` only when asked, and the 26.7.9 image build was the first
|
|
|
|
|
to notice. To rebuild just the kernel set after such a change, remove
|
|
|
|
|
it from the VM's `sets/` and run tools' `kernel` step, then `sign`
|
|
|
|
|
again.
|
2026-11-22 20:45:30 -05:00
|
|
|
2. **Core patches:** write `patches/26.7/` against core 26.7.x. For 26.7.9:
|
|
|
|
|
- the CMM restart moved from `interfaces_assign.php`, which 26.7 no
|
|
|
|
|
longer has, to the MVC assignment API
|
|
|
|
|
(`Interfaces/Api/AssignmentController::reconfigureAction`, after its
|
|
|
|
|
filter reload);
|
|
|
|
|
- the mirror patch applied as is, except for the `plist` lines, where
|
|
|
|
|
upstream's trusted key changed (`pkg.opnsense.org.20260608`).
|
|
|
|
|
- Also pin `www/caddy-custom`'s plugins at the release's tag date in
|
|
|
|
|
`config/make-26.7.conf` (build step 4).
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
3. **Board package:** fix this repository's drivers for the FreeBSD 15 kernel
|
|
|
|
|
interfaces. `build` compiles the modules right after the kernel, so this
|
2026-11-23 19:26:41 -05:00
|
|
|
fails early. For 26.7: caam's bus resource methods lost their `type`
|
|
|
|
|
and `rid` arguments, and `sys/cdefs.h` now defines `__maybe_unused`,
|
|
|
|
|
which cdx's `linux_compat.h` also did. The repository then stopped
|
|
|
|
|
building 26.1 (its patches and `make-26.1.conf` are gone); the 26.1
|
|
|
|
|
tree on the mirror stays, for gateways that still have to upgrade.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
4. **Build:** run `vm.sh create 15.1`, then `build 26.7 26.7.x`, `sign` and
|
|
|
|
|
`pull-out`.
|
|
|
|
|
5. **Stage, verify, publish:**
|
|
|
|
|
`gwmirror.py stage ... --series 26.7 --version 26.7.x --upgrade-from 26.1`,
|
|
|
|
|
then verify and publish.
|
|
|
|
|
6. **Back up:** full eMMC backup from Recovery Linux, or at least a
|
|
|
|
|
configuration backup, with the 26.1 image at hand.
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
7. **Offer the upgrade** on the gateway. Core only offers it once
|
|
|
|
|
`packages-26.7.x` is on the mirror (checked in core 26.1.11's check.sh);
|
|
|
|
|
`opnsense-update -SRp` prints its size once it is:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
sh
|
|
|
|
|
sed -i '' '/^UPGRADE_RELEASE=/d' /usr/local/etc/opnsense-update.conf
|
|
|
|
|
echo 'UPGRADE_RELEASE="26.7.x"' >> /usr/local/etc/opnsense-update.conf
|
|
|
|
|
opnsense-update -SRp
|
|
|
|
|
```
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
8. **Upgrade in the GUI.** It reboots three times: kernel, then base, then
|
|
|
|
|
packages.
|
|
|
|
|
- Until the packages stage, the 26.1 board modules don't load under the
|
|
|
|
|
26.7 kernel. `01-mono-modules` logs them and carries on, and the
|
|
|
|
|
in-kernel DPAA driver keeps the network up.
|
|
|
|
|
- At that last stage, the FreeBSD 15 `mono-gateway` package arrives.
|
|
|
|
|
|
|
|
|
|
## Ongoing releases
|
|
|
|
|
|
|
|
|
|
- **Point release** (e.g. 26.7.10):
|
|
|
|
|
1. Rebase the src fork onto the new tag.
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
2. Run `build.sh lock` in the VM, check the commits and commit
|
|
|
|
|
`config/lock-<version>` (build step 1).
|
|
|
|
|
3. Run `build` / `sign` / `pull-out`; tools skips unchanged ports.
|
|
|
|
|
4. Run `stage`, `verify`, `publish`.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
- **Major release** (27.1 is due January 2027): the procedure above.
|
|
|
|
|
- **Board fix between releases:** commit here, then rebuild. The package
|
|
|
|
|
version rises with the commit count.
|
Release tooling: commit lock per release, escaping symlinks, doc fixes
- K2: config/lock-<version> gives tools, src, ports, plugins and core
their exact commits; build stops when a checkout differs (a tag moved
upstream, or src moved on), and fetches tags without --force.
build.sh lock resolves and writes them. lock-26.7.9 is what 26.7.9 was
built from, checked against the upstream tags.
- K3: verify --root reports symlinks that lead outside the tree or
nowhere, which publish (rsync -L) would follow; such a path is now
reported instead of crashing verify.
- K6: RELEASE.md no longer says core trusts only our key (it also trusts
upstream's, for changelog and bogons), and names no host or user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
|
|
|
- **Kernel-only fix between releases:** push it to the src fork, update `src`
|
|
|
|
|
in `config/lock-<version>`, delete the kernel set in the VM and rebuild,
|
|
|
|
|
then republish the same-version kernel set; gateways pick it up with
|
|
|
|
|
`opnsense-update -fk`.
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
|
|
|
|
## Monitoring
|
|
|
|
|
|
|
|
|
|
`mirror/monitor/` has a systemd user timer that runs
|
|
|
|
|
`gwmirror.py verify --url` daily (install steps in the unit file). Its
|
|
|
|
|
failures land in the journal. That is the failure that killed the vendor's
|
|
|
|
|
mirror: the certificate is due to be renewed by the proxy, and the timer
|
|
|
|
|
complains 21 days before expiry if it isn't.
|
|
|
|
|
|
|
|
|
|
## Recovery
|
|
|
|
|
|
|
|
|
|
The kernel is booted by U-Boot from the FAT partition, not from
|
|
|
|
|
`/boot/kernel`. After a kernel set update, `rc.syshook.d/stop/20-kernel-update`
|
|
|
|
|
installs the new kernel there at shutdown. It keeps the previous one as
|
|
|
|
|
`kernel.old`, never leaves `kernel.img` missing, and retries at the next
|
2026-11-27 18:54:16 -05:00
|
|
|
shutdown if it can't finish. `/boot/kernel/kernel.bin` stays where the kernel
|
|
|
|
|
set put it, so the health audit finds the set complete; a shutdown whose
|
|
|
|
|
kernel and device tree are on the FAT partition already does nothing. (Up to
|
|
|
|
|
`mono-gateway` 26.7.9_116 the hook deleted it, and the audit reported it
|
|
|
|
|
missing; `opnsense-update -fk` puts it back.)
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
|
|
|
|
|
If a new kernel doesn't boot, interrupt U-Boot on the serial console:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
=> load mmc 0:1 ${kernel_addr_r} kernel.old; load mmc 0:1 ${fdt_addr_r} dtb/mono-gateway-dk.old; booti 0x82000000 - 0x88000000
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then roll back the boot environment (`bectl activate pre-gwmirror-...`), or
|
|
|
|
|
reflash from Recovery Linux with the signed image from `/releases/` (README.md,
|
|
|
|
|
"Local / Test Deployment") and restore the configuration backup.
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
python3 -m unittest discover -s mirror/tests # gwmirror stage/verify/publish, incl. HTTPS
|
Drop the cross-build leftovers, pilot and migrate-device.sh
The build runs natively on arm64 since 2026-11-18: setup no longer installs
qemu-user-static and aarch64-binutils (and refuses a non-aarch64 host),
GATEWAY.conf drops PRODUCT_WANTS_CROSS, build no longer asks tools for an
xtools set, finish no longer moves one aside, and mk-image.sh no longer
sets up xtools or removes qemu. The pilot command, which timed ports
before the first full build, goes too.
Gateways are migrated with the shell commands in RELEASE.md, as
ApolloGuardian was, instead of migrate-device.sh; that includes the
custom mirror for a proxy that is not on 443 inside the LAN, and the
major upgrade's UPGRADE_RELEASE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:41:11 -05:00
|
|
|
python3 -m unittest discover -s release/tests # build.sh, 20-kernel-update, fetch-distfile.sh
|
2026-11-23 19:26:41 -05:00
|
|
|
release/vm.sh ssh 15.1 'cd /usr/deps && python3 -m unittest discover -s release/tests'
|
mirror: gwmirror stage/verify/publish, nginx stack, release docs
- gwmirror.py: lay a build into the mirror tree, verify it (signatures,
catalogues, sizes, hashes, aarch64-only ELF, and over HTTPS also TLS
expiry, Content-Length, redirects) and publish it with rsync only when
it verifies; tests cover tampering, untrusted and revoked keys,
traversal and decompression limits
- server/: unprivileged nginx for a Portainer stack serving the SMB share
read-only, GET/HEAD only, proxying changelog/bogons from upstream
- monitor/: daily systemd user timer running verify --url
- RELEASE.md: design and runbook; README.md points to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:56:54 -05:00
|
|
|
```
|
|
|
|
|
|
Recover GitHub-generated patch distfiles; fix git ownership in the VM
The first pilot stopped building the host pkg: GitHub now abbreviates the
object names on the index lines of its generated commit patches with 10
digits instead of 9, so OPNsense's patches of ports-mgmt/pkg no longer
match distinfo, and nothing caches OPNsense's own distfiles.
- release/fetch-patch.sh: FETCH_CMD that, when fetch(1) fails for a
GitHub commit/pull/compare patch, shortens the abbreviations until the
size matches; the port's checksum target verifies the SHA256.
- build.sh: run tools' distfiles step on its own, repair the ports it
could not fetch on the host into the distfiles set, and rerun it; the
pilot fetches its ports' distfiles too; host pkg uses the wrapper.
- vm.sh sync: files owned by root in the VM. They kept the workstation's
uid, git refused the "dubious" repository, and that defeated the dirty
check silently. build.sh now fails when git cannot read /usr/deps, and
the package target refuses a version without the commit count.
- migrate-device.sh: FreeBSD grep rejects the empty alternative in the
fingerprint file check, so it failed on every device. Found by running
release/tests on the build VM, now part of the documented test run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 13:43:10 -05:00
|
|
|
Run `release/tests` on the build VM as well (after `vm.sh sync`): those
|
|
|
|
|
scripts run on FreeBSD, whose `grep`, `sed` and `sh` reject things the GNU
|
|
|
|
|
tools accept (an empty alternative in a `grep -E` pattern, for one).
|