e66aead87b
Downloader sometimes fails on external .dsc files signed with unusable
GPG keys:
- expired keys
- .dsc file signed with a key that is not in apt's GPG database.
These files are typically signed by individual package maintainers, not
the official Debian/binary repository key that APT uses for binary
package indexes.
Downloader uses 2 different methods to fetch source packages, which
behave differently w.r.t. GPG checks:
- with "archive" key present in meta_data.yaml, we download using the
"dget" utility, which in turn validates against a set of known keys
in /usr/share/keyrings/
- without "archive", we download using "apt-get source", which doesn't
validate GPG at all
This patch makes the downloader script ignore GPG signature errors, but
print a warning in the log. We also allow package maintainers to add an
additional option, "dsc_sha256", to check the .dsc file's checksum,
instead of its GPG signature (this will suppress the warning).
Rationale:
- it's difficult to make GPG verification accept expired keys
- we always verify sha256 checksums of the files making up the source
package (ie the files referenced by .dsc)
- as for the .dsc file itself, we only verify its checksum if it is
present in meta_data.yaml, "dsc_sha256". No packages do that as of
this writing.
CHANGES
=====================
- utils.py: add a slightly different version of run_shell_cmd that
captures and returns both STDOUT and STDERR
- debrepack.py:
* use "dscverify" (from "devscripts" package) to verify .dsc files
* if normal verification fails, try again with GPG check disabled
* new key in meta_data.yaml: dsc_sha256. If present, make sure .dsc
file's checksum matches.
* workaround for "dget" and "dscverify" falsely succeeding when
files referenced by .dsc are missing
* removed functions "download_check_dsc" and "check_dsc" as they are
no longer used after this change
HOW TO REPRODUCE
=====================
One example of a package signed with a key that is not in the current
(bullseye) version of debian-keyring, is golang-github-golang-jwt-jwt
[1]. The download fails on that package.
TESTS
=====================
- Remove golang-github-golang-jwt-jwt from /import/mirrors and reproduce
the download error (unknown GPG key)
- Apply this patch, remove all downloaded sources, re-run downloader and
make sure it succeeds with GPG-related warnings
- Simulate various problems with a .dsc file and make sure they are
detected (ie the script fails):
* .dsc URL in meta_data.yml returns http 404
* one of the files referenced by .dsc returns http 404
* one of the checksums in .dsc doesn't match
* .dsc checksum it self doesn't match "dsc_sha256" in meta_data.yaml
[1]
|
||
---|---|---|
.. | ||
branching | ||
build_guest | ||
build_iso | ||
build_minimal_iso | ||
build-docker-images | ||
build-wheels | ||
certificates | ||
deb-utils | ||
mk | ||
repo_files | ||
requirements | ||
signing | ||
stx | ||
unit-tests | ||
audit-pkgs | ||
build-avoidance-utils.sh | ||
build-extra-helm-charts.sh | ||
build-guest | ||
build-helm-charts.sh | ||
build-img | ||
build-iso | ||
build-pkg-srpm | ||
build-pkgs | ||
build-pkgs-parallel | ||
build-pkgs-serial | ||
build-remote-cli.sh | ||
build-rpms | ||
build-rpms-parallel | ||
build-rpms-serial | ||
build-srpms | ||
build-srpms-common.sh | ||
build-srpms-parallel | ||
build-srpms-serial | ||
Cached_Data.txt | ||
classify | ||
create_dependancy_cache.py | ||
create-prepatched-iso | ||
create-yum-conf | ||
deb-utils.sh | ||
default_build_srpm | ||
find_klm | ||
find_patched_srpms_needing_upgrade | ||
git-repo-utils.sh | ||
git-utils.sh | ||
helm_chart_modify.py | ||
image-utils.sh | ||
ip_report.py | ||
make-installer-images.sh | ||
mock_cfg_to_yum_conf.py | ||
mockchain-parallel | ||
mockchain-parallel-1.3.4 | ||
mockchain-parallel-1.4.16 | ||
mockchain-parallel-2.6 | ||
mockchain-parallel-2.7 | ||
modify-build-cfg | ||
patch_rebase_1 | ||
patch_rebase_2 | ||
patch_rebase_3 | ||
patch_rebase_4 | ||
patch-iso | ||
patch-iso-debian | ||
pkg-manager-utils.sh | ||
repo-utils.sh | ||
sign_initramfs-sign-script | ||
sign_iso_formal.sh | ||
sign_patch_formal.sh | ||
sign_rootfs-post-scripts | ||
sign-rpms | ||
sign-secure-boot | ||
sign-secure-boot_debian | ||
source_lookup.txt | ||
spec-utils | ||
srpm-utils | ||
stxRpmUtils.py | ||
sync_jenkins.sh | ||
sync-jenkins | ||
tis.macros | ||
update-efiboot-image | ||
update-pxe-network-installer | ||
url_utils.sh | ||
utils.sh | ||
wheel-utils.sh | ||
wrs_orig.txt | ||
yum-builddep-wrapper |