Author: canutethegreat

  • Horcrux dev log 6: clustering, an ISO you can install from, and real laptops

    Horcrux dev log 6: clustering, an ISO you can install from, and real laptops

    Part 6 in the Horcrux dev log series.

    Backdated: written in November 2026 from git, CI and my QA ledger. Part 5 was the audit.

    With the basics fixed I moved on to clustering. In five days the log shows an HA supervisor (failure detection, fencing, recovery, self-fencing), cluster create and join, guest save state on host shutdown (QEMU migrate-to-file for VMs, CRIU for containers), draining a node with live moves, SDN zones, Ceph management, deduplicating backups, PCI and vGPU passthrough and a Redfish fencing driver.

    On October 24 live migration got a hard block between AMD and Intel CPUs, and the drain planner never moves a running guest across vendors. Cold migration is still allowed.

    From the Forgejo API for October 22 to November 6: 725 runs, 493 success, 78 failure, 154 cancelled, about 450 commits.

    ha-failover.yml 68 success, 4 failure
    vm-migration.yml 32 success, 0 failure
    guest-power.yml 30 success, 7 failure
    live-iso.yml 21 success, 4 failure, 26 cancelled

    I haven’t checked every cancelled run, but newer pushes superseding a run in progress account for many of them.

    October 27: an ISO that boots

    The December ISO builder never got finished. This one has a different design. A Docker-only builder (Gentoo stage3 plus the official binhost, dracut with dmsquash-live, GRUB for BIOS and UEFI in a hybrid ISO), and a QEMU test that boots it by UEFI and USB and by BIOS and CD, runs an unattended install, reboots into the result and probes the web API. A daily job publishes only if the tests pass. First version: 31 files, about 1,000 lines.

    By the 28th it had a text installer, an answer-file mode, no default password, key-only SSH and aarch64 images. This is the boot menu from that week, taken from the repo’s docs folder at the time:

    The Horcrux installer boot menu in GRUB, committed October 28, 2026
    Boot menu as committed on October 28, 2026 (docs/images/boot in the repo).

    And the installer’s file system page, committed the same day:

    Horcrux text installer file system page with ext4 as the default
    File system page as committed October 28. The default is ext4, which was wrong and got changed within days.

    The default is ext4. I’d decided ZFS should be the default, with an automatic XFS fallback under 8 GB of RAM or when there’s no ZFS module for the kernel.

    T2 laptops, tablets, encrypted ZFS

    There’s a GNOME desktop edition on top of the server core and hardware profiles for an Apple T2 MacBook and a Surface tablet. The installer learned encrypted ZFS root with boot environments, and hibernate on encrypted ZFS. The initramfs has to resume from the LUKS swap before it imports the pool, because importing first and resuming into it corrupts the pool. A QEMU test does install, passphrase, hibernate, power off, boot, passphrase, same process still running, clean scrub.

    What real machines found

    QEMU didn’t catch several things. The November 3 commits are the list the laptops produced.

    The clock: a live system with a months-off RTC can’t do TLS, so Tailscale and package syncs failed. The installer now writes the hardware clock only from a verified clock, and the tests boot QEMU with -rtc base= months in the past. The size-trimming step on the desktop image kept deleting /usr/include and every static library, so installed systems had no C compiler and ZFS couldn’t rebuild its module on a kernel update. A zfs-kmod from a cached binary package had been built for a different kernel. Plain XFS and ext4 installs didn’t write /etc/fstab, so /boot wasn’t mounted and kernel updates landed on the root filesystem. GDM login started two keyrings. The disk passphrase could be reused as an account password, so the installer now refuses that. And the desktop had apps missing from the launcher because their binary didn’t exist, no sound, dead volume keys, and a Log Out button that did nothing, because the session was split across two D-Bus buses.

    Most of these got a gate in the QEMU suite afterwards (months-off clock, compiler present, module builds, fstab, keyring, password reuse, the desktop session items). On November 3 I also fixed CI reporting green after a failed step (“green-but-failed 8637” in the commit), so some earlier runs looked healthier than they were.

    Where it stands

    This week I moved on to a lab of three old laptops to prove the HA claims. The goal in the lab plan: every scenario of the HA suite green ten runs in a row, failover under 120 seconds, no data loss, never two copies of a guest. As of this writing that’s 0 of 10. The old manager took 126 seconds to fail over after a hard crash, over the limit, and a one-node partition ran two copies of a guest for several seconds. Both are logged as bugs with fixes pending. So I can’t say Horcrux has HA yet. The next post is about that.

    The aarch64 ISO build takes hours under emulation and hit the runner’s time cap on November 6, so it moved to a runner with a longer limit.

    Design decisions

    OpenRC is the only init on the ISOs. systemd wants to run the world, and that costs you in feature bloat.

    ZFS by default, with an automatic XFS fallback when RAM is under 8 GB or the kernel has no ZFS module. The installer shows its reason on the disk page (“XFS instead of ZFS: only 4.0 GB RAM (ZFS wants 8 GB or more)”). I want ZFS boot environments and an automatic snapshot before every update for recovery, bit rot protection and resilience. ext4 is never the default, only a manual choice. Gentoo recommends XFS, and ZFS is just superior tech.

    Encrypted ZFS needs a static grub.cfg and a kernel per boot environment under /boot, because GRUB can’t read an encrypted ZFS pool.

    Hibernate goes to a separate LUKS2 swap partition and not a zvol, because OpenZFS doesn’t support hibernating onto its own zvol and doing it anyway risks the pool. For the Surface XFS layout the notes reject a separate LUKS swap, since it would need a second keyslot or a second prompt.

    Surface tablets get XFS plus LUKS and a light touch desktop, because the docs say a GNOME-class desktop doesn’t fit in 4 GB.

    Server first. On November 3 I wrote down the rule: “it should work on a headless server too, it shouldn’t be a desktop-only OS”. The desktop is a layer on top of a headless core and personal apps live in per-machine layers, not the public images.

    Live migration between AMD and Intel is refused and cold migration is allowed (see Oct 24 above).

    Other parts: Part 1, Part 2, Part 3, Part 4, Part 5. The series continues with the latest Horcrux dev log post.

  • Patronus dev log 5: security holes, netlab, and the 0.2.0 release

    Patronus dev log 5: security holes, netlab, and the 0.2.0 release

    Part 5 in the Patronus dev log series.

    Backdated, written in November 2026 from git and CI records. Part 4 ended with the installer test paused.

    October 16: two things at once

    First, the installer test moved off the Mac. It now runs on a KVM runner with QEMU directly: install with the ISO attached, then cold boot the disk with the media removed. A live system comes up in about 25 seconds, and install plus reboot takes about 6 minutes. The installed system comes up on rpool with zpool ONLINE. The first green run is recorded in the commit. Getting there turned up five real installer bugs, which the commit lists: a bad parted mkpart fs-type for ZFS, a free-space calculation that started partition 2 at the disk end, a root pool that kept its temporary mountpoint forever, pool features GRUB couldn’t read, and chroot bind mounts that stacked and never unmounted, so the pool export failed and the next boot refused to import it. From then to November 6, that workflow has 25 passing runs and 3 cancelled ones.

    Second, the security commits from the same day. Here’s what the commit messages say:

    patronus-web created 'admin'/'admin' and 'operator'/'operator' accounts on
    every install, so anyone reaching :8443 could take over the firewall.
    SECURITY (CRITICAL): only /api/auth/me and /api/auth/logout checked the
    session. Every other page and the whole management API -- add/delete
    firewall and NAT rules, WireGuard peers, interface up/down, backups,
    service start/stop -- answered anonymous requests

    So for a year after the “Complete Implementation” commit, the web UI had no login that mattered, and it shipped with default passwords. Both are fixed now. The admin password is per install: a random 24 character one, written to a 0600 file on first start, and the service refuses to start with a known or short one. A session is required for every page and API call, with regression tests.

    netlab

    There’s a harness called netlab: network namespaces, a router and clients and an ISP, real nftables and real daemons, scenarios as shell scripts, and power-cut and upgrade tests. The README says a ledger maps every claim to a test that proves it, and an “honesty guard” test scans the web code for old fixture values.

    Failures that only showed up in CI: sh -c with bash functions (dash can’t see them), a DNS resolver in the CI image binding port 53 before a scenario’s own, grep -q under pipefail killing nft with SIGPIPE, kernel logging that doesn’t reach a namespace, and a runner with br_netfilter loaded that made bridged traffic hit the firewall. Some scenarios couldn’t pass at all, so I parked them in a pending/ directory instead of leaving main red: UPnP port mapping (miniupnpd answered 501 on the nftables backend and I never solved it), DHCPv6 prefix delegation for a while, and VRF.

    From Forgejo, October 16 to November 6: 416 runs, 209 success, 108 failure, 82 cancelled. About 294 commits.

    Features, and what they were proven on

    Multi-WAN with failover, QoS (CAKE, fq_codel), DHCPv6 prefix delegation, OpenVPN, IPsec road warriors, VRFs, zero-touch provisioning, factory reset, LDAP login, GitOps, and per-device segmentation with DNS policy and time limits. The 0.2.0 CHANGELOG lists its own limits: unmanaged switches, IPv6 binding “next”, and simulated radios only. Most of this was proven in namespaces and one lab VM, not on a production network.

    The ISO and 0.2.0

    On October 27, Patronus got a live installer ISO built with the same builder as Horcrux, plus a text installer with no default password and key-only SSH, aarch64 images and a console menu. The v0.2.0 release on the 30th (“device segmentation (opt-in), per-device Wi-Fi, DNS rebinding, per-device DNS policy, time limits, insight history, uplink health”) needed five migrations. The first release.yml didn’t produce a release, so another commit made it do so. Fat LTO of the web crate was OOM-killed in a 6 GB runner slot, so aarch64 uses thin LTO. The stable ISO gate also failed on stale red statuses from a superseded tag.

    Design decisions

    Headless first. Horcrux’s rule was “it should work on a headless server too, it shouldn’t be a desktop-only OS”, so on November 3 I made the same call for Patronus. A box is installed and recovered from the console, and operated over SSH and the web UI. There’s no desktop edition and none is planned. CI fails the build if a desktop or personal package lands in the image inputs. There’s also deliberately no private image variant: per-box data comes in via an answer file on the install USB and via GitOps.

    Encryption and boot: a firewall should never stop at boot waiting for a console passphrase. So the installer encrypts only if an unattended unlock works (a TPM2-sealed key, self-tested). Otherwise it installs unencrypted and says so.

    ZFS by default, with an XFS fallback below 8 GB (the disk page shows the reason). I want ZFS for recovery, bit rot protection and resilience. ext4 is never the default. Gentoo recommends XFS, and ZFS is the better filesystem for this job. There’s no on-disk swap on a firewall.

    Opt-in segmentation: the release ships with it off by default, and an upgrade test asserts that an upgraded box keeps isolation off.

    State on November 6

    The UI now requires a login, the installer passes a KVM test, and v0.2.0 is out with its limits written down.

    Other parts: Part 1, Part 2, Part 3, Part 4.

  • Flipper Zero, part 5: the Wi-Fi board, rogue access points and why 802.11w matters

    Flipper Zero, part 5: the Wi-Fi board, rogue access points and why 802.11w matters

    Part 5 of 5 in the Flipper Zero series. Part 1: what it actually is and what it can’t do. Part 2: why so many office badges are weaker than they look. Part 3: Sub-GHz remotes, rolling codes and how gates should be built. Part 4: USB keystroke injection and how to lock USB down.

    What the Wi-Fi board is

    The last part of this series is about the small green board that clips onto the back of the Flipper. Mine is the official Wi-Fi dev board, an Espressif ESP32-S2 module on a carrier, and I run the community Marauder firmware on it. The rules are the same as in the earlier parts: my own hardware, my own network, and defender’s goals. Sending forged frames at networks you don’t control is illegal in most places. In 2014 the FCC fined Marriott $600,000 for using deauthentication frames to stop guests from using their own hotspots, so “it’s only management frames” has been tried as a defense before, and it didn’t work.

    Here’s a screenshot from the Flipper mobile app’s remote screen, showing the Marauder GUI’s Wi-Fi submenu on my device.

    Screenshot of the Flipper mobile app remote screen showing the Marauder WiFi submenu: WiFi Spam, Attacks, Monitor&Sniff, Network Tools

    The menu has four entries: WiFi Spam, Attacks, Monitor&Sniff and Network Tools. I’m not going to walk through the offensive ones. What matters to a defender is what each one puts on the air, because that’s what your monitoring has to recognise. The next photo is the info screen on the same board, which shows the firmware name and the hardware it thinks it’s running on.

    Photo of the Flipper Zero screen showing the Marauder info page with the firmware name and hardware Flipper Zero Dev Board

    One limit worth knowing: the ESP32-S2 has a 2.4 GHz radio only, 802.11 b/g/n, and no Bluetooth. If you scan with it, everything on 5 GHz and 6 GHz is invisible. A clean scan from this board says nothing about your 5 GHz network.

    What a passive scan gives away

    Beacons are broadcast in the clear by design. Anyone in range gets your SSID, the access point’s BSSID, the channel, the signal strength and the security suite from the RSN information element. They don’t need to associate or send any traffic of their own. That element also carries two bits called MFPC and MFPR, management frame protection capable and required. So an outsider can see whether you require protected management frames before they send anything.

    I use the scan list as a cheap audit of my own airspace: what am I advertising, on which channels, with which security. I haven’t put a screenshot of a scan result in this post. On my unit it lists the MAC addresses and names of whatever networks are nearby, and those belong to my neighbours.

    Deauthentication and what 802.11w changes

    Original 802.11 management frames were unauthenticated. A deauthentication frame only had to carry the access point’s address as its source for the client to believe it and drop the connection. Send them in a loop and the client never stays up. That’s the whole attack. It needs no password and no association.

    802.11w, ratified in 2009 and now part of the base standard, protects those frames. After the four-way handshake, unicast management frames are encrypted and integrity checked with the pairwise key, and broadcast ones are protected with an integrity group key. A forged deauth fails the check and the client throws it away. There’s also an SA Query exchange for when an unprotected disassociation arrives for a session the client believes is still alive.

    The diagram shows the same forged frame against a client with and without protection. I drew it. It isn’t a capture from any tool.

    Diagram: a forged deauthentication frame drops a client without protected management frames and is ignored when PMF is required

    Protected management frames are optional in WPA2 and mandatory in WPA3. The Wi-Fi Alliance started certifying WPA3 in 2018, and certification requires PMF. The catch is transition mode, where one SSID accepts both WPA2-PSK and WPA3-SAE clients. PMF is only “capable” there, so a WPA2-only client on that SSID can still be kicked off.

    The diagram also lists what 802.11w leaves alone. Beacons, probe requests and responses, and the frames exchanged before association stay unprotected. Nothing in software stops someone from jamming the channel. PMF raises the cost of one specific cheap attack. It doesn’t make the radio link trustworthy.

    On a hostapd-based access point, requiring it for a WPA3-only network looks like this:

    wpa=2
    wpa_key_mgmt=SAE
    rsn_pairwise=CCMP
    ieee80211w=2
    sae_require_mfp=1
    sae_pwe=2

    sae_pwe=2 selects hash-to-element only. That closes the timing side channel behind the SAE flaws that Mathy Vanhoef and Eyal Ronen published as Dragonblood in 2019 (CVE-2019-9494 and CVE-2019-9495). It also locks out clients that only speak the older method, so test your device mix first. For a mixed network, use wpa_key_mgmt=WPA-PSK SAE with ieee80211w=1 and accept the downgrade exposure.

    Evil twins and captive portals

    Marauder can also stand up a fake access point with a login page. That’s the evil twin: same SSID, different BSSID, often a stronger signal, and a portal asking for a password. On an open network the client can’t tell the difference at all. With WPA3-SAE, the twin has to know the password to complete the handshake, because SAE authenticates both sides. With WPA2-PSK the same holds in principle, but everyone who has the shared key can build a convincing twin, and that includes former employees and guests.

    The enterprise case is where I see the real damage. A client set to PEAP-MSCHAPv2 that doesn’t validate the RADIUS server certificate will happily send its challenge response to a twin, and MSCHAPv2 responses can be cracked offline. The fix is on the client side. Push a Wi-Fi profile through MDM that pins the CA and the expected server name, and prefer EAP-TLS where you can issue device certificates.

    What to watch for

    Detection comes down to a few facts you can state precisely:

    • Your SSID appears from a BSSID that isn’t in your access point inventory.
    • Your SSID appears with a different security suite than your own access points advertise.
    • A burst of deauthentication or disassociation frames, or a sudden crowd of unfamiliar SSIDs on one channel.

    You need a monitor-mode adapter, or the wireless controller’s own rogue detection, to see any of this. With a Linux adapter in monitor mode, this shows deauthentication frames (management subtype 12) with their reason codes:

    tshark -i wlan0mon -Y 'wlan.fc.type_subtype == 0x000c' \
      -T fields -e frame.time -e wlan.sa -e wlan.da -e wlan.fixed.reason_code

    A handful of deauths a day from real roaming events is normal. Hundreds per second aimed at one client is not. Alert on the rate per source. When PMF is required, clients ignore the frames anyway, so the alert tells you someone is trying, not that something broke.

    Two older bugs are worth a mention because PMF doesn’t cover them. Kr00k, CVE-2019-15126, let some Broadcom and Cypress Wi-Fi chips encrypt data with an all-zero key after a disassociation. It was fixed in client firmware, which means it gets fixed by patching laptops and phones. Treat Wi-Fi chip firmware like any other software you have to update.

    If I had to pick one change from this part, it would be requiring PMF on every SSID whose clients all support it, then adding the unknown-BSSID alert to the same place where you read your other detections.