Repository navigation
The build verifies the staging archive instead of reading it unverified - #4
Conversation
…erified
The staging distribution was given its own signing key so that a nightly could
sign itself and so recipes could stop reading it through [trusted=yes], which
switches verification off. Signing landed; verification did not. A layer build
printed
W: OpenPGP signature verification failed: file:/srv/keel-apt/repo
trixie-staging InRelease: Missing key
8CFD1A4841448B2227341CEB202CACBD0E97090A
and carried on, so it installed the project own packages unverified, which is
where it was before, only now it said so (tracker#7).
The public half of the staging key is installed into the build tree as
/etc/apt/keyrings/keel-staging-keyring.asc, from /srv/keel-apt/keys where
bin/publish of keel-linux/apt leaves it; the source entry names it through
signed-by; and apt-get update runs with --error-on=any. Measured against the
real archive: with signed-by named and no key, apt exits 100 and says the
repository is not signed, where before it warned and exited 0. A warning
nobody fails on is how this shipped.
bin/keel-archive-check makes the same checks itself rather than trusting apt to
have complained, because the tree that is about to be configured is checked at
a step where no apt-get update runs: the copied index is the live one, the
entry names the keyring and this distribution, no apt source in the tree says
trusted=yes, and the signature on the copied InRelease verifies against the
named key with gpgv. The keyring leaves the image with the source entry and the
copy of the archive, and common/removelists-final/turnkey takes all three out
as well.
The check refused a trusted=yes on any apt source in the build tree. The captured pool of decision 0012 sets Trusted: yes on purpose, for a file: index generated on this machine from files keel-pool verify checks against the same digests apt does, so the wider rule would have failed every pinned build. What is refused is now a source that names the project archive and switches verification off, which is the defect of tracker#7, in whichever file and in either of apt's two formats. What the pool does is the pool's business. Measured with the same suite: bin/keel-archive-check 100 percent (54/54) over 27 bats tests, three of them new: the pool's Trusted: yes passes, a trusted=yes on the project archive in another file fails, and the archive the rule applies to is overridable.
|
Pushed a second commit: the
|
Closes part of Keel-Linux/tracker#7 for this recipe.
The defect
The staging distribution was given its own signing key so that a nightly could
sign itself and so appliance recipes could stop reading it through
[trusted=yes], which switches verification off. Signing landed; verificationdid not, so a layer build printed
and carried on, installing the project's own packages unverified.
How the build verifies now
/etc/apt/keyrings/keel-staging-keyring.asc, taken from/srv/keel-apt/keys/keel-staging-keyring.asc, wherebin/publishofKeel-Linux/apt now leaves the keyring of whichever distribution it signed;
signed-byand no longer saystrusted=yes, which no file in any of the four recipes does any more;apt-get updateruns with--error-on=any, so a warning is an error;bin/keel-archive-checkmakes the same checks itself, withgpgv, becausethe tree that is about to be configured is checked at a step where no
apt-get updateruns: the copied index is the live one, the entry names thekeyring and the distribution, nothing in the tree says
trusted=yes, and thesignature on the copied
InReleaseverifies against the named fingerprint.How it fails
Measured against the real archive on the build host, in a scratch apt root:
[trusted=yes], no keyringW: ... Missing key, exit 0, packages installedsigned-by, no keyringE: The repository ... is not signed, exit 100signed-by, the wrong keyE: The repository ... is not signed, exit 100signed-by, the staging keyGet:1 ... InRelease, exit 0bin/keel-archive-checkexits 1 with aFATAL [archive-check <step>]line ineach of those failures, before a package is installed.
The keyring does not reach the image
The conf script removes it with the source entry and the copy of the archive,
and Keel-Linux/common#4 adds all three to
common/removelists-final/turnkey,which is the arrangement that holds whether or not a recipe remembers.
Also here
conf.d/zzz-keel-archiverefuses to enable the appliance own source while thebuild time keyring is still in the image, and the boot test reads the assembled
rootfs and fails when the archive copy, the source entry or the staging keyring
is there. That is the only place that looks at a finished image and says so,
which is what "not in the image" has to mean.
Test plan
COVERAGE_THRESHOLD=97 tests/coverage.sh: 99.07 percent (533/538) over194 bats tests.
bin/keel-archive-check100 (52/52),zz-project-packages100 (31/31),zzz-keel-archive100 (26/26),boot-test-lib.sh98.95 (282/285)shellcheck -S warning bin/keel-archive-checkcleanappliance / build-and-bootagainst the rebuilt layer