43 Commits
Author SHA1 Message Date
Morning Star d9da6b5109 feat(onboard): Add hardware without ntfs-3g and iscsiadm (the job reaches the VM over HTTP) (#7)
The golden's startup task fetches the server's script at every start; for the VM of a running Add hardware job the server answers with broom-onboard.ps1 and the job's token. The script gets the job and the library's drivers over HTTP and posts its result; the VM's disk is an NBD export. Nothing is written into the golden's disk by the server: no iscsiadm, no ntfs-3g. The Update script feature is removed. The VM features now need QEMU and OVMF only.
2026-11-22 12:57:33 +07:00
Morning StarandMojo-LB 0d49fc8428 feat: diskless machines (no SSD), machine power / display / hardware list, HTTPS admin (#3)
Diskless goldens over iSCSI, Add hardware, maintenance VM in the browser, machine power / display / hardware list, roles with permissions and HTTPS for the web admin. Includes the security fixes from the review on #2.

Co-authored-by: Mojo-LB <35627917+Mojo-LB@users.noreply.github.com>
2026-11-22 11:28:59 +07:00
morningstar-sudo d4ad73166b feat(boot): support legacy BIOS clients
BIOS PXE ROMs (DHCP arch 0) got no boot file; Broom was UEFI-only.

- DHCP/TFTP: serve undionly.kpxe (iPXE + embedded bios.ipxe:
  chains autoexec.ipxe, so router-DHCP mode does not loop)
- iPXE patch 0003: menu rules as CP437 0xc4 on the BIOS text
  console, which does not decode UTF-8 (screen was garbled)
- SSD on BIOS machines: MBR (Windows boots BIOS only from MBR),
  disk id "BROM" ("BROL" Linux-only), partition role from its
  place. Relaid only when the table is surely of the other kind
- Windows stage: no BootNext under BIOS. Writes the boot
  partition + MBR code from bios.tar.gz, then POST
  /api/boot/local; next /boot.ipxe sanboots that drive once
  (300 s, only from the IP of the machine's menu choice). Drive
  from EDD MBR ids in /sys/kernel/boot_params, no edd module
- prep-win: build broom\bios (fixed MBR VHD, bcdboot /f BIOS);
  any failure there leaves a UEFI-only golden, never stops prep.
  Publish packs it as bios.tar.gz when present
- strict reset on BIOS: bootorder task deletes \bootmgr and drops
  BROOMWIN/BROOMEFI drive letters
- shim line skipped on pcbios; deploy warns on firmware mismatch
- docs: legacy BIOS, tested on Windows 11 Pro and Enterprise

Windows goldens prepped before this boot UEFI clients only: run the
prep command again, upload, Publish. Stage bundle needs a rebuild.
2026-10-30 16:27:32 +07:00
morningstar-sudo 4891415ffa feat(boot): support legacy BIOS clients
BIOS PXE ROMs (DHCP arch 0) got no boot file; Broom was UEFI-only.

- DHCP/TFTP: serve undionly.kpxe (iPXE with bios.ipxe embedded:
  chains autoexec.ipxe, so router-DHCP mode does not loop)
- SSD on BIOS machines: MBR (Windows boots BIOS only from MBR),
  marked by disk id "BROM" ("BROL" Linux-only); partition role
  from its place. GPT<->MBR layout redone on firmware mode switch
- Windows stage: no BootNext under BIOS. Writes the boot
  partition + MBR code from bios.tar.gz, then POST /api/boot/local;
  the next /boot.ipxe sanboots that drive once (120 s, only from
  the IP of the machine's menu choice). Drive found via EDD MBR ids
  in /sys/kernel/boot_params, no edd module
- prep-win: build broom\bios (fixed MBR VHD, bcdboot /f BIOS);
  publish packs it as bios.tar.gz when present
- strict reset on BIOS: bootorder task deletes \bootmgr and drops
  BROOMWIN/BROOMEFI drive letters
- shim line skipped on pcbios; deploy warns on UEFI image to BIOS PC

Windows goldens prepped before this boot UEFI clients only: run the
prep command again, upload, Publish. Stage bundle needs a rebuild.
2026-10-30 14:26:52 +07:00
morningstar-sudo 35b10703b2 feat(auth)!: password-free sign-in handshake, signed releases
The web admin and Capture ran over plain HTTP and sent the owner
password in the clear on a LAN that may not be isolated.

- auth: 4-message handshake (hello → salt + nonce → proof → server
  proof). PBKDF2-SHA256 runs on the client; the server keeps a
  verifier only, so a copied DB logs nobody in and a sniffed sign-in
  yields no password or replayable proof.
- new passwords (setup, change, owner reset) travel as verifiers
  sealed with the handshake's session key, or the setup token for
  the first owner; neither the token nor the password is sent
- web: SHA-256/HMAC/PBKDF2 in plain JS (crypto.js), since WebCrypto
  is off on http:// to an IP; values pinned against the Rust side
- capture: same handshake, checks the server's proof
- deps: argon2 out (no server-side KDF left), pbkdf2 in; random
  bytes from getrandom(2)
- ci: SLSA build provenance (attest-build-provenance) on every
  release file
- docs: quick start checks SHA256SUMS and explains
  `gh attestation verify`; read-before-run variant of the prep
  scripts
- prep-linux.sh: body in main() so a cut-off `curl | bash` runs
  nothing
- comments: drop stale "one-time token" wording for the prep
  scripts

BREAKING CHANGE: accounts store a verifier instead of an argon2
hash and sessions gain a key column; an existing bootrom.db no
longer works, so start with a new one. /api/auth/login takes
{hs, proof} after /api/auth/hello; /api/password and /api/users
take a sealed `cred` instead of a plain password.
2026-10-19 02:56:54 +07:00
morningstar-sudo c91b21dbb9 refactor!: drop upgrade paths from pre-2026-10-09 servers
No server runs an older version; every deploy starts fresh, so the
code that migrated old installs goes.

- remove LIO/zram-kernel cleanup, dnsmasq/tftpd takeover, old
  directory layout move, admin_pw → owner account conversion
- remove DB migrations: schema comes from SCHEMA only, unique
  indexes live there; leases lose the always-"full" source column
- rename config keys ltsp_user/ltsp_password → guest_user/
  guest_password
- golden: no ServeFile fallback for a golden.vhdx file (404 →
  publish again), drop tower dependency
- versions: drop 4 MB chunk versions, a version is its file only
- iscsid: peers is a plain list, no "old daemon" branch
- publish refuses a golden prepped without the script stubs
  (was a warning: its scripts never updated)
- stage/linux-cache: stop cleaning delta-update leftovers
- tests: reuse disk.rs readers in vhdx tests
- docs: README rewritten shorter (618 → 259 lines), Pages updated,
  imaging (capture/deploy) added to the comparisons

BREAKING CHANGE: an existing bootrom.db is not migrated: start with
a new one. Goldens prepped before 2026-10-09 must be prepped again
in the VM before upload.
2026-10-19 01:41:33 +07:00
morningstar-sudo bce46d7d61 feat: enhance driver layer handling and update related documentation 2026-10-18 21:53:23 +07:00
morningstar-sudo cb597c1d66 Refactor Windows base mode handling and database schema
- Removed the `base_mode` field from the `Image` struct and related database schema.
- Introduced `base_image` field in the `Machine` struct to track the Windows image that boots its base.
- Updated database schema to reflect changes, including migration for existing databases.
- Modified relevant database methods to support new base mode functionality.
- Updated API routes and handlers to manage base mode settings for machines.
- Adjusted frontend code to include base mode selection and display.
- Removed obsolete references to the old base mode logic in tests and other modules.
2026-10-18 21:06:19 +07:00
morningstar-sudo 07f049bd0b feat: enhance key handling in canvas to manage held keys on blur event 2026-10-18 19:22:18 +07:00
morningstar-sudo 0b962d793e Implement GPT backup relocation and enhance image deployment API
- Add `move_backup_gpt` function to relocate the GPT backup header and entries to the end of a larger disk.
- Modify the export module to include `full_disk` function for handling Windows images with preserved boot partitions.
- Introduce new API endpoints `/api/images/deploy-map` and `/api/images/deploy-chunk` for retrieving image deployment information and chunks.
- Update image routing to include the new deployment endpoints.
- Enhance end-to-end tests for capturing and deploying images, ensuring proper functionality of the new features.
- Add unit tests for the `move_backup_gpt` function to verify correct behavior and partition integrity after relocation.
2026-10-18 17:18:24 +07:00
morningstar-sudo e8cb7961d7 feat: update broom-vnc and stage scripts for improved desktop handling and capture tool path 2026-10-18 16:09:42 +07:00
morningstar-sudo cfac831baf feat: add disk capture functionality and enhance SSD settings
- Implemented disk size retrieval in `disk.rs` to handle empty files.
- Introduced a new module `capture` in `main.rs` for handling disk capture requests.
- Added a new endpoint `/broom-capture` to serve the binary for capture operations.
- Enhanced NTFS reading capabilities with methods to retrieve file head and used ranges.
- Updated SSD settings to include a configurable pagefile size, with appropriate validation.
- Modified frontend to support new SSD settings, including pagefile input.
- Added tests for capture functionality and NTFS bitmap handling.
2026-10-18 15:52:47 +07:00
morningstar-sudo 865e42b086 feat: enhance user account management and permissions
- Updated CSS to hide owner-specific actions for staff accounts.
- Modified JavaScript to load user roles and manage permissions based on user type.
- Enhanced HTML structure to reflect user roles and permissions in navigation and forms.
- Updated login functionality to support user accounts instead of a single admin password.
- Added tests for session tokens and user permissions to ensure proper access control.
- Implemented checks for games update permissions based on IP and MAC address.
2026-10-18 09:46:56 +07:00
morningstar-sudo 520ae049d1 feat: Enhance cursor handling in VNC viewer with dynamic shape updates 2026-10-17 19:23:15 +07:00
morningstar-sudo 10c9358ecd feat: Enhance disk management features and UI updates
- Added functionality to display and manage local disks in the server and games pages.
- Implemented disk visibility options for machines, allowing users to hide non-Broom disks from guests.
- Introduced server disk selection for images and games, enabling users to choose where to store new disks.
- Updated various HTML pages to reflect new disk management features, including server disk selection in images and games sections.
- Added unit tests for disk parsing and volume management to ensure robustness.
- Improved user experience with clearer messaging and options related to disk management.
2026-10-17 13:42:45 +07:00
morningstar-sudo a181b23325 feat: enhance remote control features and health monitoring in web admin 2026-10-17 00:43:44 +07:00
morningstar-sudo f023150d3b fix: update STARTUPINFO struct to use Unicode charset for compatibility with CreateProcessAsUser 2026-10-16 21:54:08 +07:00
morningstar-sudo 79be73dd32 Refactor and enhance management interface for Windows 11 diskless boot
- Updated documentation for guest user settings in Broom's web admin.
- Improved VNC agent script with enhanced logging and privilege management.
- Modified PowerShell script to compile VNC agent using .NET Framework's csc.
- Added new HTML pages for server and games management, including relevant functionality.
- Updated existing pages to reflect new structure and improved user experience.
- Removed obsolete SSD settings from system page and consolidated them into the Windows page.
- Enhanced server monitoring features and adjusted alert settings for better resource management.
2026-10-16 21:23:00 +07:00
morningstar-sudo f6fb31553f Add hardware metrics collection and reporting
- Introduced a new `metrics.rs` module to handle per-machine hardware health metrics (CPU %, RAM %, temperatures, disks).
- Updated the `broom-watch.ps1` script to reference System.Management for improved functionality.
- Modified `AppState` to store and retrieve metrics for each machine.
- Enhanced the `MachineStatus` struct to include metrics data.
- Implemented disk health checks using SMART data for NVMe and SATA disks in `sysmon.rs`.
- Updated the VNC agent to push hardware health metrics over WebSocket connections.
- Enhanced the frontend to display hardware health metrics in the UI, including disk status and temperatures.
- Added unit tests for metrics parsing and disk health attribute extraction.
2026-10-16 20:46:51 +07:00
morningstar-sudo be72b3dcf8 feat: enhance remote agent functionality with thumbnail wall and connection handling 2026-10-16 20:10:49 +07:00
morningstar-sudo e475d25be4 feat: add remote VNC support for Windows machines
- Implemented a remote agent (broom-vnc.exe) that allows viewing and controlling Windows machines via a WebSocket connection.
- Updated broom-watch.ps1 to start the VNC agent and ensure it runs in the console session.
- Added new API endpoints for VNC agent management and viewing.
- Created a new remote page in the web interface for connecting to and controlling Windows machines.
- Enhanced asset management to include VNC-related scripts and binaries.
- Updated the frontend to support remote control features, including mouse and keyboard events.
- Added tests for VNC agent and viewer functionality.
2026-10-16 15:43:51 +07:00
morningstar-sudo 303bebcde2 feat(games): add RAM option for games.img serving
- Introduced a configuration option to serve games.img from a RAM copy, improving read performance.
- Implemented background loading of the RAM copy and handling of stale copies during merges.
- Updated the state structure to track RAM loading status and merge counts.
- Enhanced the API to toggle RAM serving and retrieve relevant information.
- Added frontend support for managing the RAM serving option in the UI.
- Updated tests to cover new RAM functionality and ensure proper behavior with incompressible blocks.
2026-10-16 11:58:00 +07:00
morningstar-sudo 3a9abc20e6 feat: enhance broom-bootorder and broom-fw scripts for improved UEFI BootOrder management and volume free space checks 2026-10-14 20:21:20 +07:00
morningstar-sudo e5ce3501e1 Refactor and optimize various components for improved performance and maintainability
- Enhanced `serve` function in `goldenram.rs` to read and send data in 1 MB chunks concurrently, improving throughput.
- Updated `hash.rs` to implement a more efficient `sha256_with` function that reads data in parallel while hashing, reducing overall processing time.
- Modified `write_chunk` in `images.rs` to skip writing zeroed MBs, optimizing disk usage.
- Improved `command` function in `conn.rs` to streamline read operations.
- Optimized `read_at` method in `overlay.rs` to read neighboring blocks in a single call, reducing disk access overhead.
- Adjusted `main.rs` to increase the buffer chunk size for TFTP service, enhancing data transfer efficiency.
- Refined `status` function in `monitor.rs` to limit concurrent pings, improving responsiveness and resource management.
- Changed default `boot_timeout` in `settings.rs` from 10 to 3 seconds for quicker boot processes.
- Updated `autoexec` function in `tftp.rs` to utilize existing IP addresses, reducing DHCP wait times.
- Enhanced `sha256` function in `vhdx.rs` to leverage the new `sha256_with` for better performance.
- Added tests for sparse file writing and hash caching behavior in `hash.rs` and `golden.rs` to ensure correctness and performance.
2026-10-14 18:17:20 +07:00
morningstar-sudo 0168dcb189 refactor: optimize build scripts and improve driver handling for reduced boot time 2026-10-12 18:11:08 +07:00
morningstar-sudo d084891e13 feat: enhance stage logging and boot script generation for improved diagnostics 2026-10-12 16:43:25 +07:00
morningstar-sudo a4fe5f8c04 feat: enhance benchmarking functionality with live iSCSI data and improve logging 2026-10-12 10:13:12 +07:00
morningstar-sudo e392cb2548 feat: add benchmarking functionality for server disk, iSCSI, and client performance
- Implemented a new benchmark module to track server disk performance, including sequential and random read speeds.
- Added database support for storing benchmark results with a new BenchRow struct and associated methods in the Db trait.
- Enhanced the SQLite database schema to include a new table for benchmark results.
- Created a new benchmark page in the web interface, allowing users to view current and historical benchmark data.
- Integrated iSCSI read statistics into the benchmark page, displaying real-time data on client read performance.
- Updated the main application routing to include the new benchmark page and its associated API endpoints.
- Added JavaScript functionality to dynamically load benchmark data and handle user interactions for initiating benchmarks.
2026-10-12 09:47:26 +07:00
morningstar-sudo a555d67d13 feat: implement retry logic for server connection in broom-games.ps1 2026-10-11 11:29:02 +07:00
morningstar-sudo f42a47b24b feat: add groups management and games disk functionality
- Introduced a new "Groups" page for managing machine groups, including creating, editing, and deleting groups.
- Updated the navigation to include a link to the new "Groups" page.
- Enhanced the "Images" page to display associated groups for each image.
- Added functionality for managing games disks, allowing users to create, update, and delete games disks for Windows machines.
- Implemented SSD room management settings for Windows machines, including options for keeping free space, warning thresholds, and restart conditions.
- Updated JavaScript to handle new API calls and UI interactions for groups and games disks.
- Added relevant hints and descriptions to guide users on the new features.
2026-10-09 21:21:12 +07:00
morningstar-sudo c4e1448239 fix: correct message in BASE MODE setup instructions 2026-10-09 18:36:11 +07:00
morningstar-sudo 832bf8e21e fix: prevent redundant DHCP calls by managing networking state in ask_disk 2026-10-09 18:07:06 +07:00
morningstar-sudo 6878b62ecf Refactor VHDX handling and improve publish logic
- Updated the VHDX module to create a virtual dynamic VHDX that reads directly from the raw disk without writing to a file, improving efficiency and reducing storage needs.
- Enhanced the `publish` function in the winstage module to manage golden VHDX files more effectively, ensuring that the golden file is only rebuilt when necessary and maintaining its identity through a unique stamp.
- Adjusted the logic for checking if the golden file is fresh, now returning both the ID and hash for better tracking.
- Improved error handling and file management during the publish process, ensuring that outdated files are removed and the latest versions are served.
- Updated the frontend JavaScript to provide clearer messaging during version loading and comparison with the current golden.
2026-10-09 15:22:25 +07:00
morningstar-sudo f01eed0939 Refactor snapshot handling and improve cache management
- Enhanced snapshot_at function to write new chunks as temporary files, ensuring data integrity during writes and reducing the risk of data loss.
- Introduced sync_fs function to flush filesystem changes efficiently, minimizing the number of fsync calls.
- Updated tests to verify the new chunk handling logic and ensure proper garbage collection.
- Simplified the find_windows function to directly read NTFS partitions without mounting, improving reliability.
- Removed deprecated functions related to OOBE handling and streamlined the boot storage logic.
- Updated frontend to reflect changes in cache mode terminology from 'zram' to 'RAM' for clarity.
- Improved user interface messages and hints regarding RAM cache usage and limitations.
2026-10-09 10:02:04 +07:00
morningstar-sudo dacc97240e chore: wget timeouts in the stage, cache-list waits for the network, label read without blkid, dead code
- stage: GNU wget defaults to a 30 s read timeout and 3 tries (was 15 min x 20)
  so a stalled server can't hang the stage.
- linux cache: waits up to a minute for the network before fetching the
  cache list (on a cache HIT the initramfs never brought it up).
- linux hook: the broomcache label is read from the ext4 superblock — with a
  busybox blkid the kept cache was formatted on every boot.
- publish: the Secure Boot shim is copied to a temp file and renamed in.
- startup clean-up also removes driver upload/extract dirs, the stage build's
  initramfs config, driver archive temps and upload/unzip.
- web: an expired session on a page load goes to /login instead of caching
  the "login required" text as the page.
- broom-done: the BASE MODE message warns that a hard power-off loses the
  setup.
- removed: GET /api/machines, /api/machines/group, /api/dhcp/apply, the
  tftp::serve wrapper and dhcp::handle's unused parameters.

Scripts changed -> the next publish rebuilds the golden/stage once.
2026-10-04 21:44:01 +07:00
morningstar-sudo 06937323aa fix: server IP at boot time, DoS/flood limits, license ARP check, session room, safer upload/cache mode/delete
- boot: boot scripts use ${broom-srv}, set by /boot/start from the current
  Server IP — changing it needs no republish (once more after this upgrade).
- images: the SSD switch asks for a republish when the boot script predates
  it; an upload to a disk-cache Linux image with clients is refused before
  the convert; cache mode goes back when its publish fails.
- linuxfs/vmdk: LVM metadata nesting capped (a crafted one overflowed the
  stack and aborted the server), kernel/initrd read capped at 512 MiB, VMDK
  grain directory capped at 16 MiB (sparse uploads).
- settings/dhcp: the interface must exist to be saved; at start a failed :67
  bind still leaves TFTP serving; each DHCP packet's DB work runs on a
  blocking thread.
- limits: pxe_seen holds at most 4096 MACs; the remembered IP is the
  connection's, not the claimed ?ip=; /api/status pings at most 32 at once.
- license: an ARP entry matching the machine's MAC is required; /api/status
  no longer carries full keys (machine detail still does).
- stage: step 0 keeps >= 20 GB / 10 % free on BROOMWIN by evicting the oldest
  parked images; files.sha256 names its golden and a client on another
  golden never applies it.
- linux cache: a golden larger than the cache partition evicts nothing.
- devices: bulk Register takes the PXE-seen IP when there is no lease.
- main: one instance per data directory (flock on bootrom.lock).
- db: deleting the default moves it only to a published image of the same OS.
- versions: delete reports success even if the following gc fails; snapshot
  checks free space. golden: converted image fsynced before the rename.

Scripts changed -> publish every image again (boot scripts gain ${broom-srv}).
2026-10-04 20:18:15 +07:00
morningstar-sudo bd0ab8375b fix: no Windows/Linux layout ping-pong, safe Linux publish generations, atomic rollback, ESP/boot-order hardening
- linux hook: never lays out a Broom SSD that holds Windows' partitions
  (small disks / disks laid out before any Linux image): Linux runs from RAM
  (zram + iSCSI) there instead of wiping the Windows goldens and bases — and
  Windows wiping it back on its next boot.
- publish (Linux): the new iSCSI generation is recorded only when the publish
  succeeded; a failure removes that generation's target/zram device and puts
  the old kernel/initrd back, so the 60 s gc never drops the target the saved
  boot script points at. A stale zram device of a reused generation is freed.
  restore_targets claims the job slot per image.
- rollback: version (manifest + every chunk) and free space checked first,
  rebuilt into image.img.new, targets dropped and the file swapped only then —
  a bad version, full disk or crash leaves the image and its target as they
  were. New versions::check.
- stage: the ESP gets a fresh filesystem every boot; strict reset keeps every
  entry on this SSD (its PARTUUID) but Broom Windows out of BootOrder; a
  parked image's golden is re-hashed against the server's hash when it comes
  back to the top.

Scripts changed -> the next publish rebuilds the stage once.
2026-10-04 19:48:36 +07:00
morningstar-sudo 688344d344 fix: no license re-arm on an image change; writeback size set by the server only
- devices: giving a machine another image no longer re-arms its key — it may
  already keep a base of that image on its SSD, leaving the key armed with
  nothing to fetch it. A new image's base activates through Windows' digital
  license (or the admin re-arms). Renaming still re-arms (base rebuilt).
- boot: the Linux writeback size lives only in WB_GB (boot.rs); /boot/start
  sets broom-wbgb and both boot scripts pass broom.wbgb to the Windows stage
  and the Linux hook (30 when an older boot script has none).

Scripts changed -> publish every image again (boot scripts gain broom.wbgb).
2026-10-04 19:04:26 +07:00
morningstar-sudo 90eeb53fba fix: menu labels, TFTP cap, WoL NIC, durable versions, startup clean-up, netmask, logout
- boot: menu labels by position (img1, img2...): "win-11" and "win_11" no
  longer collide; image/package names capped at 64 (what /boot/start keeps).
- tftp: at most 64 transfers at once (an RRQ flood can't use up the fds).
- wol: magic packet to the boot LAN's broadcast (server IP | !netmask), so it
  leaves through that NIC, not the default route's.
- dhcp: listeners swapped in one step — two Applies at once never leave an
  extra listener with an old config.
- versions: chunks/manifests flushed before rename; a stored chunk is reused
  only with the right length (a power-cut one is written again); gc skips
  non-.json files.
- images: cache mode is changed inside its publish job (409 with a job
  running, DB untouched); the first upload is saved as v1 even when its
  publish fails.
- export: built in <dir>.new and renamed when complete (no half-written
  vmdk download).
- startup: leftovers of interrupted jobs removed (image.img.new,
  golden.vhdx.tmp, <name>.new/.old, stage temp dirs/downloads, export .new).
- space: converting a vmdk and building golden.vhdx check free space first
  (one shared need_space helper, also used by export).
- network: setup detects the netmask (prefix of the connected route); Netmask
  field on the Network page.
- machines: with the DHCP server off, machines seen PXE-booting show up on
  the Machines page with their IP.
- web: Log out button; dead /api/machines/assign (and Db::assign_image)
  removed.
- broom-done: a failed rename or boot-order task is logged (done.log) instead
  of swallowed.

broom-done changed -> the next publish rebuilds the golden once.
2026-10-04 18:55:27 +07:00
morningstar-sudo bd20a76152 feat: per-image SSD on/off, every image keeps its own copy, Broom SSD shared by Windows and Linux
Shared SSD layout: p1 BROOMEFI 512M | p2 BROOMWIN | p3 broomwb 30G | p4
broomcache, found by GPT partition name (sysfs) by both the Windows stage
and the Linux initrd hook. Whichever OS boots first lays it out and formats
only its own partitions — switching images no longer wipes the disk.

Every image a machine boots keeps its copy: Windows sets parked in
broom\img.<image>\ (the booting one at the top, so the BCD and broom-done
are unchanged; a rename, VHDX parent links are relative), Linux goldens as
<image>.img in broomcache. On every boot the machine fetches
/api/cache-list ("name hash" of images it may keep: published and using the
SSD) and removes the others; no answer -> nothing removed; the running copy
is never touched. Out of space -> the copy unused the longest goes.

SSD on/off per Linux image (Images page, POST /api/images/ssd): off = the
SSD is never touched, golden over iSCSI, writes in RAM. Windows always uses
the SSD. Read per boot (broom.ssd); the Linux share of a new layout is
30 GB + the total of the Linux goldens using the SSD + 5 GB (broom.lxgb).

Also:
- vmdk/linuxfs: crafted headers refused (no giant buffer / panic).
- stage: one disk on a registered machine is looked at again after 5 s
  before it is wiped (a late Broom SSD / second disk).
- iscsi: idle superseded generations (and their zram) dropped every 60 s.
- winstage: single-partition GPT written before the holes are punched.

Upgrade: publish every image again (boot scripts gain broom.lxgb, broom.ssd,
broom.srv). Scripts changed -> golden/stage rebuilt once.
2026-10-04 16:15:02 +07:00
morningstar-sudo 09e855063d fix: license/guest hardening, image delete, Network Apply; golden always downloaded whole
Golden download (Windows stage + Linux SSD cache): always one whole file, no
4 MB chunk delta. The old copy goes first, the new one is written in one
sequential stream (less fragmentation, nothing to compare) and hashed on the
way; it is accepted only when the hash AND the size (new golden.size from the
server) match, so a disk-full or cut download is never taken. The stage checks
free space first and resumes a cut download with wget -c. Removed: delta(),
/api/golden-chunk, the compressed chunk cache, the zstd crate, broom.srv on
the Linux cmdline. chunks.rs -> hash.rs (file_hash only).

Windows publish: the stage bundle and server IP are checked before anything
is written; golden.sha256/size/key are removed only right before the new
golden replaces the old one and golden.sha256 is written last; the .tmp file
is removed on error.

- drivers: a client can no longer re-arm its own license key. Re-arming on a
  driver-set change is decided on the server (driver upload/delete/targets,
  machine group change) from the stored hardware IDs.
- devices: renaming a machine or giving it another image re-arms its key.
- stage: first.pending next to an existing base is ignored (a guest could make
  the reset child the base -> base pointing at itself, machine never boots).
- stage: driver archives are kept; every base build extracts them again after
  a sha256 check, so a folder the guest edited on BROOMWIN never reaches base.
- stage: `cp base-template.vhdx child.vhdx` checked.
- images: delete refuses while a Linux client uses the image, removes files
  before the DB row, and claims the job slot under the lock. The DB unlinks
  machines from the deleted id (SQLite reuses it) and moves the default.
- iscsi: per-target session check from LIO's dynamic_sessions replaces the
  portal-wide `ss` check (publish, rollback, gc of superseded generations).
- publish (Linux): every refusal before anything is written; kernel/initrd
  are built in <name>.new and swapped in right before the new boot script is
  saved. Rollback of a disk-cache image drops its targets before rewriting.
- Network page: Apply works with the DHCP server off (range fields may be
  blank; checked only in full mode: start <= end, inside the subnet).
  dhcp_mode 'proxy' migrated to 'off'. Lease accepts s/m/h/d like the parser;
  gateway is a single IP; server IP must be one of this host's.
- auth: Host check accepts any IP literal, localhost and the machine's
  hostname (DNS rebinding always carries a domain name).
- web: the Images "Boot" button works again.
- publish: bundled shim path restored (broom-stage/shimx64.efi).

Residual: a guest can still fetch an *armed* key through /boot/start +
/api/license (a local admin can fake the pre-boot side).

Upgrade: publish each Windows image once (writes golden.size; the scripts
changed, so the golden/stage are rebuilt anyway). Each Windows machine then
downloads the golden whole and rebuilds its base once.
2026-10-04 14:10:16 +07:00
morningstar-sudo dd53b26208 feat: DHCP option checkboxes, one box per DNS server, comment review
DHCP (Network page, only shown when broom is the DHCP server):
- iPXE: don't wait for ProxyDHCP (option 175.176), default on
- Authoritative NAK for machines asking for an IP that isn't theirs, default on
- Send hostname (option 12), default on
- Rapid Commit (RFC 4039, option 80): ACK straight after DISCOVER when the
  client asks for it, default off
- DNS: one input per server ("+ DNS"), up to 8; the server validates them,
  drops duplicates and keeps the order

Comments across src, scripts, web, build.sh, CI and README brought in line
with the current code (module split, stage bundle from CI, no distro
packages, TFTP always on).

Note: the comment edits change the embedded scripts, so the next publish
rebuilds the golden image and the stage once, and each Windows machine
downloads the delta and rebuilds its base once.
2026-10-04 09:15:47 +07:00
morningstar-sudo 6baa0f37f1 refactor: scripts as files, split winstage/publish/machines, shared API helpers
- the 8 embedded shell/PowerShell scripts move to mgmt/scripts/ (still
  include_str! into the binary, byte-identical: same golden key, no client
  rebuild); .gitattributes keeps them LF on every checkout
- winstage.rs → winstage/{mod.rs (publish + golden), stage.rs (client
  stage bundle), prep.rs (what goes into the golden)}
- publish.rs → golden.rs (upload → raw) + chunks.rs (hashes, manifest,
  delta chunks) + publish.rs (Linux iSCSI/zram)
- machines.rs → machines.rs (table) + license.rs (keys, boot reports) +
  settings.rs (boot menu, zram, DHCP, guest user)
- api.rs: ApiError/ise/bad/ok shared instead of 4 copies; duplicate now()
  helpers use crate::now_secs
- fix: pxe_seen (fed by public endpoints) drops entries older than 30 min;
  the driver-set baseline is kept for registered machines only — neither
  grows with made-up MACs any more
2026-10-04 08:45:15 +07:00