Initial commit: PXEForge Phases 1-4
Container-native PXE boot server in Rust, designed as a clean-room alternative to iVentoy that never touches the client OS trust store. This is the first commit of the project; it lands the full output of Phases 1, 2, 3, and 4 in one shot. ## Phase 1 — protocol stack - 8-crate workspace (core, dhcp-proxy, tftp, http-api, iso-store, ipxe-assets, webui, pxeforge bin). - DHCP proxy (RFC 4578): replies with boot info only, never leases — sidesteps CAP_NET_RAW. Architecture-aware bootfile selection from option 93 (BIOS, IA32, x64-UEFI alias 0x0007/0x0009, ARM64). - TFTP server with full OACK negotiation: blksize, tsize, windowsize. Without it a 1 MiB iPXE binary takes 2000 packets and unusably long. - Two-stage iPXE chain: firmware PXE -> TFTP iPXE binary -> iPXE re-DHCPs with user-class iPXE -> HTTP /boot.ipxe -> kernel+initrd. - HTTP server (axum) with byte-Range ISO streaming and an in-place ISO9660 lookup so kernel/initrd are served from inside the ISO without ever extracting it to disk. - Linux ISOs boot via kernel+initrd extraction (memdisk/sanboot fail for >1-2 GiB modern distros). Distro-family detection drives the cmdline (Debian/Ubuntu, RHEL/Fedora, openSUSE, Arch, Alpine). ## Phase 2 — UX + Windows - Hierarchical PXE menu (Default / Installers / Tools / Gated Deployment) generated from settings — no hand-written .ipxe paths surface in the UI. Number-key + letter hotkeys, BIOS+UEFI variants for some RHEL ISOs. - Gated Deployment "horse-race" queue: clients join, operator picks one ISO, every gate launches simultaneously via tokio::sync::Notify. - Bootimus-pattern Windows: WimPatcher injects a CRLF startnet.cmd into boot.wim so vanilla WinPE net-uses an SMB share and runs setup.exe. All Microsoft-signed; no test certs, no testsigning, no httpdisk.sys. SmbManager supervises smbd start/stop/SIGHUP. - Netbox-style dark UI, fully offline (no CDN, no external fonts). ## Phase 3 — MVP hardening - TFTP retransmit rewrite with explicit window tracking — UEFI SNP clients no longer hang on files that end mid-window. 4 new tests. - DHCP broadcast-flag honored per RFC 2131 §4.1. - Multi-arch container (linux/amd64 + linux/arm64). Entrypoint chowns bind-mounts as root then drops to uid 10001 via gosu. - /healthz + /readyz split from /api/status — readyz fails if no iPXE binaries are bundled. - pxeforge seed --from <path> CLI: same pipeline as web upload (slug, sha256, introspection, boot-entry). - All timestamps RFC 3339 (browser Date couldn't parse the 9-tuple). - Gate poll retains assignment until operator releases — clients that retry on transient network errors reuse the assignment instead of falling back to the menu. - Custom OpenShift SCC: hostNetwork + NET_BIND_SERVICE only, no NET_RAW. ## Phase 4 — UI restructure + remote storage - Web UI rebuilt around six tabs inspired by the iVentoy layout: Dashboard / Network / Forge Gate / Storage / Terminal / About. Old "Monitoring/Content/Configuration" sidebar groups are gone. - NFS share manager (crates/iso-store/src/nfs.rs): mount NFSv3 or NFSv4.1 shares as ISO sources instead of uploading every file into the PVC. New IsoSource enum on IsoMeta lets the store resolve Local vs NFS lazily. Persisted to <work_dir>/nfs.json; failed mounts surface in the UI rather than blocking startup. - Dockerfile gains nfs-common + iproute2; mounting NFS in-container also requires CAP_SYS_ADMIN. Documented in docs/architecture.md. - LogBus + tracing layer in core: 500-line ring buffer + broadcast channel feed an SSE endpoint at /api/log/stream. - Operator terminal at /api/terminal: whitelisted commands (status, isos, clients, gate, nfs, smb, log) — deliberately not a shell. Output mirrored onto the LogBus so the live tail and the terminal pane share one timeline. - Network tab: read-only nic_name / subnet_mask / gateway probed from `ip` at startup; only DNS server is editable. Editing IP/mask on a hot UI would silently break PXE for every client mid-boot. - Bootimus parity (releases v0.1.55 -> v0.1.62): amber row tint on un-bootable ISOs with inline reasons, dashboard "won't boot" panel. ## Tests 56 tests passing across the workspace: - 16 core (LogBus, gate, settings, arch, client) - 1 dhcp-proxy (raw option-93 extraction) - 8 http-api unit (range parsing, terminal split/format) - 13 http-api integration (gated deployment, range, settings, NFS, terminal, log SSE, network endpoint, ui assets, no-external-urls) - 12 iso-store (introspect, slugify, smb, windows wim, NFS options) - 6 tftp (RRQ parsing, plan_window edges) cargo build --workspace and cargo clippy --workspace --all-targets both finish clean (warnings only, no errors).
This commit is contained in:
Executable
+83
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
# Fetch prebuilt iPXE binaries from the official distribution at
|
||||
# https://boot.ipxe.org/ and place them under assets/ipxe/ with the filenames
|
||||
# PXEForge's arch mapping expects.
|
||||
#
|
||||
# Why not build from source?
|
||||
# - Building iPXE requires the toolchain + several megabytes of source, and
|
||||
# the official binaries are rebuilt nightly from upstream master with the
|
||||
# standard driver set. For Phase 1 we use those. A later iteration can
|
||||
# add an optional Dockerfile build stage that compiles iPXE with custom
|
||||
# driver or scripting patches if needed.
|
||||
#
|
||||
# Safety:
|
||||
# - Upstream (boot.ipxe.org) serves over HTTPS.
|
||||
# - We do NOT pin by sha256 because upstream is a nightly rolling build;
|
||||
# pinning would mean stale binaries with known CVEs. If you need
|
||||
# deterministic builds, mirror these to your own artifact store and
|
||||
# point the Dockerfile there instead.
|
||||
# - Each binary is boot firmware the client executes. Only fetch from
|
||||
# upstream or a mirror you trust; never from random sources.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
DEST="$ROOT/assets/ipxe"
|
||||
mkdir -p "$DEST"
|
||||
|
||||
# Map: local filename <- upstream path on boot.ipxe.org
|
||||
# Upstream uses arch-scoped subdirectories; we flatten to the names our
|
||||
# ClientArch::ipxe_bootfile() expects.
|
||||
declare -a MAP=(
|
||||
"undionly.kpxe=undionly.kpxe"
|
||||
"snponly.efi=x86_64-efi/snponly.efi"
|
||||
"snponly-i386.efi=i386-efi/snponly.efi"
|
||||
"snponly-arm64.efi=arm64-efi/snponly.efi"
|
||||
"ipxe.efi=x86_64-efi/ipxe.efi" # fallback with bundled drivers
|
||||
)
|
||||
|
||||
BASE="https://boot.ipxe.org"
|
||||
|
||||
# wimboot lives in its own GitHub release. Fetching it enables the Windows
|
||||
# toggle in the WebUI. Safe to leave disabled — the binary is vendor-signed
|
||||
# for iPXE's own use; we never modify it and it only runs inside iPXE's
|
||||
# memory space, never the target OS.
|
||||
WIMBOOT_URL="https://github.com/ipxe/wimboot/releases/latest/download/wimboot"
|
||||
|
||||
fetched=0
|
||||
for entry in "${MAP[@]}"; do
|
||||
local_name="${entry%%=*}"
|
||||
upstream_name="${entry#*=}"
|
||||
url="$BASE/$upstream_name"
|
||||
out="$DEST/$local_name"
|
||||
echo ">> fetching $url -> $out"
|
||||
if ! curl --fail --silent --show-error --location --output "$out.tmp" "$url"; then
|
||||
echo " skip: upstream not available ($url)"
|
||||
rm -f "$out.tmp"
|
||||
continue
|
||||
fi
|
||||
mv "$out.tmp" "$out"
|
||||
fetched=$((fetched+1))
|
||||
done
|
||||
|
||||
if [ "$fetched" -eq 0 ]; then
|
||||
echo
|
||||
echo "ERROR: zero iPXE binaries were downloaded. The container would build"
|
||||
echo " but no PXE client could boot. Check your network egress to"
|
||||
echo " $BASE and re-run this script. Aborting."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo
|
||||
echo ">> fetching wimboot (optional, enables Windows ISO support)"
|
||||
if curl --fail --silent --show-error --location --output "$DEST/wimboot.tmp" "$WIMBOOT_URL"; then
|
||||
mv "$DEST/wimboot.tmp" "$DEST/wimboot"
|
||||
echo " wimboot installed"
|
||||
else
|
||||
echo " skip: wimboot unreachable — Windows toggle will stay disabled in the WebUI"
|
||||
rm -f "$DEST/wimboot.tmp"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "iPXE assets now in $DEST:"
|
||||
ls -lh "$DEST" | tail -n +2
|
||||
Reference in New Issue
Block a user