Support dracut FIPS module w/UKIs
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- linux, rust
調査の方向性
Start with crates/lib/src/ukify.rs and install.rs, then inspect dracut's modules.d/11fips/fips.sh and the existing tmt coverage. Confirm the current FIPS failures for UKI and Type 1 composefs boots before choosing the HMAC flow. Done means the agreed design is implemented, HMAC files remain aligned through install, GC, and rollback, and positive and corrupted-HMAC boot tests cover the supported paths.
索引モデルが issue の本文から書いたものです。
説明
Basically, AFAIK this .hmac thing is somewhat of an invention in the Fedora-dervative ecosystem. And I believe Secure Boot provides much stronger integrity than having the UKI basically go and re-checksum itself.
But I guess, for non-Secure Boot scenarios, it does kind of make sense.
I think the ugly thing is whether we just default to generating .hmac files in bootc container ukify or not. Is it an opt-in feature or opt-out feature at build time for those people who don't care about the dracut FIPS check? Or we have bootc container ukify --fips-hmac?
LLM generated notes:
Design for cgwalters-forge/tracker#25. Checked against CentOS Stream 10
(quay.io/centos-bootc/centos-bootc:stream10: kernel-6.12.0-271.el10,
dracut-107-11.el10, systemd-257-34.el10), dracut-ng main
(modules.d/11fips/fips.sh, the same logic as CS10's 01fips) and bootc
main at 683bb05f, which includes bootc#2499.
Summary
A composefs system booted with fips=1 fails dracut's kernel integrity
check today. With a UKI (sealed or not) it fails because dracut can't find
bootc's UKI on the ESP. With Type 1 BLS it fails because bootc installs no
HMAC next to the kernel. The fips=1 karg and the dracut module are the easy
part: kargs.d already flows into the UKI cmdline, and the CS10 base image
already puts fips in its initramfs. The work is the HMAC file: where it
comes from, what it is named, and how dracut finds it. That needs a small
dracut change plus bootc install support.
What FIPS mode checks at boot
With fips=1, dracut's fips module (always included on CS10: its check()
returns 0, and lsinitrd on the stock initramfs lists fips and
fips-crypto-policies) runs do_fips in the initramfs. Unless
rd.fips.skipkernel is set, it verifies the booted kernel against an HMAC
file with sha512hmac -c. A failed check halts the boot. There are two paths:
- UKI (
is_uki: systemd-stub'sStubFeaturesand
LoaderDevicePartUUIDEFI variables are both set). It mounts the ESP
read-only at/bootbyLoaderDevicePartUUID, then for each
/boot/EFI/Linux/*-$(uname -r).efiit checks.<name>.efi.hmacin the
same directory. If no UKI matches, the check fails. - Type 1: it uses the
BOOT_IMAGE=karg (GRUB sets it; systemd-boot
doesn't), finds/boot/<dir>/.<kernel-name>.hmacand checks it./bootis
boot=if given, otherwise a symlink to$NEWROOT/boot.
The HMAC file's format is <hex> <filename>, and the filename is resolved
relative to the HMAC file's directory. CS10's
/usr/lib/modules/<kver>/.vmlinuz.hmac reads
<hex> vmlinuz-6.12.0-271.el10.x86_64. The key is libkcapi's fixed public
key, so this is an integrity self-test (a FIPS 140 requirement), not
authentication. The hash covers only the file's bytes, so a copy of the file
under another name only needs its filename field rewritten.
Sealed UKI
fips=1in the UKI cmdline.bootc container ukifybuilds the
cmdline fromkargs.d(crates/lib/src/ukify.rs), so a
/usr/lib/bootc/kargs.d/01-fips.tomlwithkargs = ["fips=1"]in the
image is enough. Kargs given at install time can't reach a sealed UKI, so
this has to be in the image, alongsideupdate-crypto-policies --set FIPS
for userspace. rhel-bootc-examples' sealing Containerfile should get a
FIPS option that does both.- dracut module. It is already in the base image's initramfs, which the
UKI embeds. Nothing to do on CS10/RHEL 10. A from-scratch image that
drops it needsadd_dracutmodules+=" fips ". - The HMAC must cover the signed UKI. The hash covers the whole
.efi,
so it can only be computed after signing: by the build step that signs the
UKI, or by bootc from the bytes it installs. - dracut can't find bootc's UKI. bootc installs
ESP/EFI/Linux/bootc/bootc_composefs-<digest>.efi(plus grubuser.cfg
or BLSuki/efientries). dracut only globsEFI/Linux/*-<kver>.efi,
which matches neither thebootc/subdirectory nor the name. So even a
correct.bootc_composefs-<digest>.efi.hmacnext to it is never checked,
and the boot dies with "Failed for find UKI". The workaround is
rd.fips.skipkernel, which must also go in the signed cmdline. - What
.vmlinuz.hmacand split-kernel (bootc#2499) mean here. bootc#2499
makessplit-kernel-and-rootfsmove.vmlinuz.hmacalong withvmlinuz,
so it is no longer orphaned in a sealed rootfs. For a UKI that HMAC is only
an input: it covers the barevmlinuz, which becomes the UKI's.linux
section and is never a file on the ESP, and dracut's UKI path never looks
at it. The UKI build step should consume it (optionally verifying
vmlinuzagainst it before wrapping, which keeps a build-time integrity
chain) and emit a new HMAC over the signed UKI.
Proposal
- dracut (upstream first, then RHEL 10): in
do_uki_check, find the
booted UKI from systemd-stub'sStubImageIdentifierEFI variable (the
UKI's path on the ESP; the exact systemd version that added it still needs
checking) and check.<basename>.hmacnext to it, falling back to today's
glob. Checking exactly the booted image is also more correct than "every
UKI matchinguname -r". This works for bootc'sbootc/subdirectory and
names, under systemd-boot and GRUB chainloading alike. A simpler dracut
patch that also globsEFI/Linux/*/*.efiwould check every bootc UKI on
the ESP, and fail on any stale one without an HMAC. - bootc: carry a build-time UKI HMAC like #2499 carries
.vmlinuz.hmac.
If the image has.<uki>.efi.hmacnext to its UKI, install it as
.bootc_composefs-<digest>.efi.hmacin the same directory with the
filename field rewritten, and verify it against the installed UKI first,
failing the install on a mismatch. GC and rollback must delete and keep it
together with its UKI. - Build (
bootc container ukify/ the seal flow): after signing, write
.<uki>.efi.hmacnext to the UKI in the image (sha512hmac, or the same
HMAC-SHA512 in Rust with the fixed key). - Until dracut changes, document
rd.fips.skipkernelin kargs.d as the only
way to boot a sealed UKI withfips=1. Whether that is acceptable for
certification is for the RHEL FIPS folks. Secure Boot does verify the UKI,
but that is not the module's own integrity test.
Composefs Type 1 (BLS, not UKI)
bootc copies vmlinuz and the initramfs to
/boot/bootc_composefs-<digest>/ (GRUB) or ESP/EFI/Linux/bootc_composefs-<digest>/
(systemd-boot), and neither bootc nor composefs-rs copies an HMAC. So:
- Install
/usr/lib/modules/<kver>/.vmlinuz.hmacas.vmlinuz.hmacnext to
the installedvmlinuz, with its filename field rewritten from
vmlinuz-<kver>tovmlinuz. It must also count in the shared-entry
dedup thatcompute_boot_digest/find_vmlinuz_initrd_duplicatedoes. /bootin the initramfs: withoutboot=, dracut falls back to
$NEWROOT/boot, which on composefs is the image's empty/boot, not the
physical one. bootc already addsboot=UUID=...when there is a separate
/bootpartition (install.rs, "things like FIPS"). Without one, it would
needboot=naming the root filesystem, and dracut'sBOOT_IMAGEhandling
then finds/boot/boot/bootc_composefs-.../vmlinuz. That needs testing.- systemd-boot sets no
BOOT_IMAGE, so dracut looks for
/boot/vmlinuz-<kver>and fails. Either bootc addsBOOT_IMAGE=to the
entry's options, or composefs systemd-boot with FIPS is UKI-only.
Test plan
A tmt test with fips=1 in kargs.d, for composefs grub/BLS and systemd-boot
UKI (sealed on CI's sealed leg), that asserts
cat /proc/sys/crypto/fips_enabled is 1 and that the journal shows
dracut's checking .<uki>.hmac or the kernel HMAC line. A negative case
corrupts the HMAC and expects the boot to fail. From reading fips.sh, every
composefs leg should fail the positive case today, which makes it the
reproducer. I haven't booted one with fips=1 yet; that is the next step
once the approach is agreed.
- 主要言語
- Rust
- スター
- 2.3k
- フォーク
- 230
- 平均マージ
- 2日 11時間
- マージ済み PR(30日)
- 42
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bootc-dev/bootc のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
install: improve error message when systemd-boot is selected without composefs backend再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 2 日以内に返信
bootc-dev/bootc の issue をすべて見る
似ている issue
-
[Bug]: layer.move to the place a layer already has fails and stops a script; with several layers it leaves an empty undo step対応中かも @jgregoriorincon が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
opengeos/RustGIS#2621 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
good first issue web
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Wait for the IDS correction dialog to settle in the stale-audit test対応中かも @louistrue が今日担当しました。 オープンready
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信