Repository navigation
Description
FOG's docs now describe two ways to get this server's certificate into UEFI db, and they need different numbers of variables. Only one of them has been tested, and only on a narrow set of machines. This issue is to find out where the line actually falls, with help from the community.
What we think is true
db is what firmware consults to verify a boot image. PK and KEK only control who may change db. So how many variables you need is not a property of db — it is a property of who performs the write, and whether the platform is in Setup/Custom Mode.
| Enrolling via | Expected to need | Reasoning |
|---|---|---|
| The firmware's own tool, platform in Setup/Custom Mode | db alone |
The write is unauthenticated; nothing has to vouch for it |
A hypervisor setting (e.g. VMware uefi.secureBoot.dbDefault.file0) |
db alone |
Same — the hypervisor writes the default before the guest owns the platform |
A running OS: FOG's enrolment task, efi-updatevar/similar on Linux, PowerShell's Secure Boot cmdlets |
PK, KEK and db |
In User Mode a db write must be authenticated by a KEK-signed update, and the machine only trusts FOG's KEK if FOG's PK is enrolled too |
What has actually been tested
One cell. On VMware, MOK.der added to db alone — no PK, no KEK — then a FOG-signed EFI binary booted directly with no shim. That is the top row, on one hypervisor.
Everything else in that table is mechanism-based reasoning, not measurement. It is the kind of reasoning that has already been wrong more than once during this work: an earlier round concluded that upstream's iPXE loader "cannot drive virtio" when the actual cause was a firmware NIC with no IPv4 configuration, and a claim that shim derives its second stage purely from its own filename turned out to be incomplete (ipxe/ipxe#1684).
What would help
If you have enrolled FOG's certificate into db, please report:
- How you enrolled — firmware menu, hypervisor setting, FOG's Enroll Secure Boot Key task, a Linux tool, PowerShell, something else
- Which variables you wrote —
dbonly, or PK + KEK +db - Whether the platform was in Setup/Custom Mode at the time (firmware menus usually label this Custom, not Setup Mode)
- Whether it worked, and if it failed, what the firmware or tool said
- Make and model, or hypervisor and firmware build
Specifically useful, because they are the untested cells:
dbalone from a firmware menu on physical hardware — confirmed on VMware only so fardbalone attempted from an OS tool. If this succeeds anywhere, the User Mode reasoning above is wrong and the docs should say so- PK + KEK +
dbfrom a firmware menu — does any firmware refuse a partial set even in Setup/Custom Mode? - PowerShell
Set-SecureBootUEFI— nobody here has tried it, and it is the route a Windows-shop admin will reach for first - Anything that triggered BitLocker recovery. Changing Secure Boot variables is measured into PCR 7, so it can; we would like to know how often it does in practice
Why it matters
If the OS-side row is right, then FOG's own enrolment task genuinely needs all three variables and the .auth files are not redundant — which is worth stating clearly, because the db-alone finding makes them look redundant at a glance. If it is wrong, FOG's task could be simplified to a single variable and the enrolment story gets substantially shorter.
Either way the docs currently lean on one measurement, and should not.
Related
- FOGProject/fog-docs#129 — where this is documented; the table above is the corrected version
- #1265 — the local ESP boot archive that made
dbenrolment worth documenting - #1266 — two reporting bugs in the enrolment path, which made
dbenrolment look unavailable on a server that was configured for it
🤖 Generated with Claude Code
Activity
Scope the db-alone claim to firmware and hypervisor enrolment
Scope the db-alone claim to firmware and hypervisor enrolment
Scope the db-alone claim to firmware and hypervisor enrolment
mastacontrola commentedon Aug 28, 2026
Ran the untested cells against EDK2/OVMF. Three of the table's entries need
changing, and one of them changes the advice rather than just the wording.
Docs PR: FOGProject/fog-docs#148.
Rig
QEMU 10.2.2,
q35,smm=on, edk2-ovmf 20260508, Linux guest writing throughefivarfs. SMM is not optional here — it is what protects the variable storefrom the guest, so without it every "the write succeeded" would be meaningless.
Two starting states, both stock Fedora firmware images:
OVMF_VARS_4M.qcow2— no PK → Setup ModeOVMF_VARS_4M.secboot.qcow2— Microsoft's PK/KEK/db → User Mode, and a PKwhose private key I do not hold. That is the real-hardware situation, not a
simulation of it.
Every battery produces successes and denials in the same boot, so a denial is
firmware policy rather than a broken rig. That mattered — see the traps below.
1. "The write is unauthenticated" is wrong
Setup Mode skips the signature check. It does not accept a bare certificate.
Writing the raw
.esl/.derbytes todb,KEKorPKisEINVALeven inSetup Mode; the authenticated-variable wrapper is always required.
That is the real reason a firmware file picker takes
MOK.derwhile FOG ships.authfiles: the picker builds the wrapper for you and FOG's task cannot.2.
dbalone works — and presupposes someone else supplies the PKFOG's own
db.auth, written by itself with no PK and no KEK: accepted, landsas 8494 bytes, survives a reboot. Top row confirmed on a second platform.
But the platform then stays in Setup Mode with
SecureBoot=0. Writtenalongside an unrelated PK and no KEK at all, the next boot comes up
SecureBoot=1with FOG's certificate indb— which is exactly the VMwaredbDefault.file0shape. So "db alone" is really "db alone, because the firmwareor hypervisor is providing the PK".
3. The OS-side row: right conclusion, wrong mechanism
EACCESEACCESEACCESEACCESEINVALEACCESEACCESEINVALOn a machine holding a vendor PK,
db,KEKandPKare all three refused.So the answer to "does the OS route need one variable or three" is neither — the
route is closed, and writing all three is not a workaround for it. Nothing
moved: sizes were identical before and after.
FOG's task works because it runs with the platform in Setup/Custom Mode,
which is the same precondition as the firmware-menu row — not because it writes
three variables instead of one.
Where the
.authfiles genuinely earn their place is the second row of thattable: once FOG's own PK and KEK are enrolled, a later
dbupdate is acceptedon a KEK-signed update alone. So they are not redundant, but the reason stated in
the issue ("a db write must be KEK-signed, and the machine only trusts FOG's KEK
if FOG's PK is enrolled too") describes a situation you can only reach by having
owned the platform in Setup Mode first.
Also confirmed: FOG's published
PK.auth/KEK.auth/db.authare well formed —written in Setup Mode all three land and the next boot is
SetupMode=0 SecureBoot=1.Three traps that fake a firmware denial
Worth stating, because anyone reporting into this issue with
efi-updatevarcanhit all three and report a confident wrong answer. I did, twice, before the
positive control caught it.
db/KEK/PKimmutable. An in-place write returnsEPERMfrom the kernel, which is indistinguishable from a firmware refusal in the
tool's message.
chattr -ifirst — and it is re-applied after every successfulwrite, so it must be cleared before each one.
efi-updatevarhas its own writability precheck. "Cannot write to db,wrong filesystem permissions" is the tool declining to call
write(); thefirmware was never asked. I ended up writing efivarfs directly so the errno
came from the firmware.
/bin/sh(minimal initramfs):efi-updatevarpopen()smount -l, soevery write fails with "Failed to get output of mount -l" — which again reads
as a denial.
Still open
I cannot settle these here: physical firmware menus, PowerShell
Set-SecureBootUEFI, and BitLocker/PCR 7 in practice. Those three are stillworth community reports and the docs callouts still ask for them.
mastacontrola commentedon Sep 8, 2026
The PowerShell
Set-SecureBootUEFIcell, measuredOne of the untested cells was "PowerShell
Set-SecureBootUEFI— nobody here has tried it, and it is the route a Windows-shop admin will reach for first." Measured now, and it lands the same place theefi-updatevarrow did.Rig
A Windows 11 VM (VirtualBox, SMM-protected varstore) whose platform key is Oracle's own VirtualBox PK — a vendor PK whose private key I do not hold, with the machine in User Mode. That is deliberately the real-hardware situation, the same shape as the Microsoft-PK row, not a Setup-Mode shortcut.
FOG publishes
dbas an assembled.auth.Set-SecureBootUEFIwill not take that — it composes the authenticated descriptor itself from-Time,-ContentFilePath(the ESL) and-SignedFilePath(a detached PKCS#7). So FOG's file was carved into those pieces; the signature fed to the cmdlet is FOG's own, unmodified, verified to beCN=FOG Project Secure Boot Signingbefore use. Five attempts, covering every shape a real admin would try: the carved ESL + FOG's bare SignedData (the UEFI form), the ContentInfo-wrapped variant, the ESL alone, FOG's whole.authhanded over, andFormat-SecureBootUEFIfromMOK.der(the documented Microsoft flow).Result: the OS route is closed, and PowerShell is no exception
Every attempt was refused. The proof is host-side, not the cmdlet's word for it: reading the varstore directly after the run,
dbholds exactly the five Microsoft CAs the machine shipped with, andCN=FOG Project Secure Boot Signingis absent — the one entry FOG'sdb.authwould have added. Nothing moved.So the PowerShell answer to "one variable or three" is the same neither the table already reaches for the OS row: on a machine holding a vendor PK you do not control, a
dbwrite is refused, and a friendlier command does not change that. FOG's own task succeeds only because it runs with the platform in Setup/Custom Mode — the same precondition as the firmware-menu row, not a property of writing three variables.Still open
Two cells I could not settle here and am not claiming: physical firmware menus, and BitLocker / PCR 7 in practice — this VM has no vTPM, so the measured-boot question is genuinely untouched. Both still want community reports.