Repository navigation
feat(ukisign): sign an unsigned ISO with cryptosctl image sign - #384
Merged
Merged
Conversation
cryptosctl image sign now takes an unsigned ISO as well as a UKI. It signs the UKI inside it the same way and writes it back over every copy, the El Torito EFI boot image's BOOTX64.EFI and the ISO 9660 file the installer copies, in pure Go with no root and no xorriso. The signed UKI and its .sig are written beside the ISO for staging upgrades. Refs CryptOS-PKI/cryptos-appliance#83 Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The release attaches unsigned ISOs next to the unsigned UKIs, and
cryptosctl image signonly took a UKI. To install from my own signed, anchored ISO I had to sign the UKI and rebuild the ISO around it with xorriso. Nowimage signdoes the ISO too, with no root, no xorriso and no rebuild.cryptosctl image sign --image <unsigned.iso>: an ISO is detected by content (CD001at sector 16), not by name. It signs the UKI inside exactly as the UKI path does, writes it back over every copy, and writes three files: the signed ISO (default: the name without-unsigned, else.signed.iso), the signed UKI beside it (<out without .iso>.uki) and its.sig, so the same key stages upgrades. Nothing is written unless the self-check passes.internal/isoimage(new), a contained reader and writer for the layoutbuild/iso/build.shproduces, not a general library:EFI/BOOT/BOOTX64.EFI(orBOOTAA64.EFI) in each FAT boot image, and every tree file with the same content (/cryptos.uki);ErrFATFull);internal/ukisign:SignISOandCheckISO(re-open the output, the boot image holds the signed UKI, the copy count matches the input, then the existingCheck),DefaultISOOut,ISOUKIPath.internal/isoimage/isotest: builds synthetic ISOs for tests, written byte by byte (FAT12/16/32 boot images, Rock Ridge names, a subdirectory, El Torito default or section entry, optional MBR or GPT with the backup outside or inside the volume).docs/image-sign.mdgets a "Sign an ISO" section; the README line mentions ISOs.Refs CryptOS-PKI/cryptos-appliance#83
Verification
internal/isoimage, over eight layouts (FAT12, FAT16, FAT32, with GPT, GPT inside the volume, MBR, EFI image in a catalog section):/cryptos.uki;/cryptos.ukisits at the old insertion point with its old sectors zero. The other FAT file and a file in a subdirectory are intact, and the boot image keeps its place and size. FAT32 FSInfo matches the free count. The GPT is read back on its own terms (header and entry CRCs, backup in the last block and identical to the primary, last usable LBA, ISO partition grown, EFI partition unchanged, protective MBR size). The MBR partitions follow the same rules;internal/ukisign:SignISOon synthetic ISOs carrying the test UKI signs both copies,Checkandimageupgrade.Verifypass, a non-ISO and a non-UKI boot image are refused, andCheckISOcatches a missing copy, a different UKI and another certificate. Default output names are table-tested.cmd/cryptosctl: an ISO whose boot image isn't a UKI is refused and none of the three outputs is written.How this was verified
CI is the proof. I built and tested nothing locally, and I did not run the doc's command blocks locally. The appliance's QEMU suite will sign an ISO from the real release build with this command, check both copies with
sbverify --cert, install a node from it and upgrade it (cryptos-appliance#83).