summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-update-nofallback
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-06-06 12:28:00 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-06-09 12:57:35 +0200
commit448c38bdcd72b52f11ec5f326f822cf57653f81c (patch)
tree98f26e9d477e720c3448773f398e6b13e0e431c7 /test/integration/test-apt-update-nofallback
parent58702f8563a443a7c6e66253b259c2488b877290 (diff)
rework hashsum verification in the acquire system
Having every item having its own code to verify the file(s) it handles is an errorprune process and easy to break, especially if items move through various stages (download, uncompress, patching, …). With a giant rework we centralize (most of) the verification to have a better enforcement rate and (hopefully) less chance for bugs, but it breaks the ABI bigtime in exchange – and as we break it anyway, it is broken even harder. It shouldn't effect most frontends as they don't deal with the acquire system at all or implement their own items, but some do and will need to be patched (might be an opportunity to use apt on-board material). The theory is simple: Items implement methods to decide if hashes need to be checked (in this stage) and to return the expected hashes for this item (in this stage). The verification itself is done in worker message passing which has the benefit that a hashsum error is now a proper error for the acquire system rather than a Done() which is later revised to a Failed().
Diffstat (limited to 'test/integration/test-apt-update-nofallback')
-rwxr-xr-xtest/integration/test-apt-update-nofallback11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback
index db4430ea3..f132bcf8e 100755
--- a/test/integration/test-apt-update-nofallback
+++ b/test/integration/test-apt-update-nofallback
@@ -28,6 +28,7 @@ Description: an autogenerated evil package
EOF
# avoid ims hit
touch -d '+1hour' aptarchive/dists/unstable/main/binary-i386/Packages
+ compressfile aptarchive/dists/unstable/main/binary-i386/Packages
}
assert_update_is_refused_and_last_good_state_used()
@@ -87,16 +88,16 @@ test_from_inrelease_to_unsigned_with_override()
{
# setup archive with InRelease file
setupaptarchive_with_lists_clean
- # FIXME: is not what the server reported 4104 4106
- testsuccess aptget update #-o Debug::pkgAcquire::Worker=1
+ testsuccess aptget update
# simulate moving to a unsigned but otherwise valid repo
simulate_mitm_and_inject_evil_package
- generatereleasefiles
+ generatereleasefiles '+2 hours'
+ find $APTARCHIVE -name '*Packages*' -exec touch -d '+2 hours' {} \;
# and ensure we can update to it (with enough force)
testwarning aptget update --allow-insecure-repositories \
- -o Acquire::AllowDowngradeToInsecureRepositories=1
+ -o Acquire::AllowDowngradeToInsecureRepositories=1 -o Debug::pkgAcquire::Worker=1 -o Debug::pkgAcquire::Auth=1
# but that the individual packages are still considered untrusted
testfailureequal "WARNING: The following packages cannot be authenticated!
evil
@@ -167,7 +168,7 @@ test_inrelease_to_invalid_inrelease()
listcurrentlistsdirectory > lists.before
# now remove InRelease and subvert Release do no longer verify
- sed -i 's/Codename.*/Codename: evil!'/ $APTARCHIVE/dists/unstable/InRelease
+ sed -i 's/^Codename:.*/Codename: evil!/' $APTARCHIVE/dists/unstable/InRelease
inject_evil_package
testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>