feat(kernel-sweep): support the RHEL family (dnf/grubby)#94
Conversation
kernel-sweep was Ubuntu-only, so the RHEL-family profiles could never be credited by the family-aware freshness added in #93 -- there was no way to validate their newest kernel at all. Extend it to AlmaLinux, Rocky and CentOS Stream: - RHELKernelRPMs derives the bootable kernel RPMs from the crawler entry. The crawler publishes only kernel-devel, from AppStream, while kernel-core and the modules packages live in BaseOS; swapping the component and file name inherits mirror, repository version, arch and any per-letter subdirectory (Rocky's Packages/k/). - In-guest install is now family-aware: dnf plus 'grubby --set-default' (which selects by vmlinuz path, with none of the grub menu-title matching Debian needs). - KernelInstallFamily centralises the distro -> family mapping used by validation, install and sweep. Oracle (UEK ships from its own repos), Amazon, and the immutable image-based systems stay unsupported. - Profile validation accepts .rpm for RHEL-family profiles and still rejects it for Debian ones. Also fixes a latent bug: --target defaulted to ubuntu-generic, which is wrong for the -minimal profiles (they run ubuntu-kvm). The crawler mapping now comes from vm/kernel-baselines.yaml for the base profile -- including release_contains, which keeps el9 and el10 apart under one distro key -- with flags still overriding. Validated on real boots: almalinux-9, rocky-9 and centos-stream-9 each installed and booted their newest kernel (5.14.0-687.26.1.el9_8, 5.14.0-687.26.1.el9_8, 5.14.0-725.el9) and passed. Freshness stale count 6 -> 3; the remainder are amazon-linux-2, oracle-linux-9-uek7 and rhel-8, none reachable by a base-image or sweep refresh. Signed-off-by: ErenAri <erenari27@gmail.com>
Hardens the kernel install path flagged by security review. Transport: kernel-crawler publishes plain http mirror URLs, and the derivations passed the scheme through, so a kernel installed into the guest was modifiable in transit. Both derivations now emit https (every mirror serves the same paths over TLS, verified), and profile validation rejects any kernel_packages entry that is not https, so a hand-written or future profile cannot reintroduce plaintext. All previously generated sweep profiles are regenerated accordingly. Verification: the RHEL install used --nogpgcheck, disabling package signature checks entirely. It now runs 'rpm --checksig' and installs with localpkg_gpgcheck=1 -- dnf skips GPG verification for local package files unless that option is set, so dropping --nogpgcheck alone would have verified nothing. Enforcing verification exposed a second problem in real boots: AlmaLinux pre-imports the distro keys into the rpm keyring, but Rocky and CentOS Stream cloud images only place them on disk, so both failed with 'SIGNATURES NOT OK' for valid vendor packages. The install now imports the keys shipped in the image before verifying -- the same trust anchor dnf uses for the image's configured repositories. Re-validated on real boots after the change: almalinux-9, rocky-9, centos-stream-9 (RHEL, signatures verified) and ubuntu-24.04 (https through the dpkg path) all pass. Note: the Debian path gets transport integrity only. dpkg cannot verify signatures on standalone .deb files; apt verifies at the index level instead. Signed-off-by: ErenAri <erenari27@gmail.com>
Security hardening (from automated review)Pushed Transport. kernel-crawler publishes plain Verification — the more serious one, which the review understated. The RHEL install used What enforcing it exposed. Real boots failed on two of three distros:
The packages were fine — AlmaLinux pre-imports the distro keys into the rpm keyring, while Rocky and CentOS cloud images only place them on disk. The install now imports the keys shipped inside the vendor image before verifying (the same trust anchor dnf uses for that image's configured repos, so it does not weaken the check). Re-validated on real boots after the change: Known limit, stated plainly: the Debian path gets transport integrity only. |
Why
kernel-sweepwas Ubuntu-only, so RHEL-family profiles could never be credited by the family-aware freshness from #93 — there was no way to validate their newest kernel at all. They were the largest remaining block of genuinely-stale profiles.What
Extends sweep to AlmaLinux, Rocky and CentOS Stream:
RHELKernelRPMsderives the bootable kernel RPMs from the crawler entry. The crawler publishes onlykernel-devel, from AppStream, whilekernel-coreand the modules packages live in BaseOS — so the component is swapped as well as the file name, inheriting mirror, repo version, arch, and any per-letter subdirectory (Rocky'sPackages/k/).dnf+grubby --set-default, which selects by vmlinuz path and avoids the grub menu-title matching Debian requires.KernelInstallFamilycentralises distro → family for validation, install and sweep. Oracle (UEK ships from its own repos, not BaseOS), Amazon, and immutable image-based systems (RHCOS/FCOS/Flatcar/Bottlerocket/Talos) stay explicitly unsupported..rpmfor RHEL-family profiles and still rejects it for Debian ones.Latent bug fixed
--targetdefaulted toubuntu-generic, which is wrong for the-minimalprofiles (they runubuntu-kvm) — sweeping one would have generated profiles from the wrong kernel flavor. The crawler mapping now comes fromvm/kernel-baselines.yamlfor the base profile, includingrelease_contains(which keepsel9andel10apart under one distro key). Flags still override.Verification — real boots, not just URL checks
5.14.0-687.26.1.el9_85.14.0-687.26.1.el9_85.14.0-725.el9All three pass, kernels confirmed from in-guest
uname -r. Unit tests cover both mirror layouts (AlmaLinux flat, Rocky letter-subdir) and the mismatched-release error path. Full suite,gofmt,golangci-lint, and profile-catalog validation all clean.Effect
Freshness stale 6 → 3. The remaining three are not reachable by a base-image or sweep refresh:
amazon-linux-2(no browsable pool the crawler maps to),oracle-linux-9-uek7(UEK own repos),rhel-8(subscription-gated, nosource_url).