X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/c99fe2e169243fc6e1a3278ce3768f0f521e260b..d61960d9244340956a27f4ca46aecd15cc75e18b:/test/integration/test-apt-update-nofallback diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback index a53226e18..e82a976a6 100755 --- a/test/integration/test-apt-update-nofallback +++ b/test/integration/test-apt-update-nofallback @@ -39,8 +39,9 @@ assert_update_is_refused_and_last_good_state_used() assert_repo_is_intact() { testequal "foo/unstable 2.0 all" apt list -q - testsuccess "" aptget install -y -s foo - testfailure "" aptget install -y evil + testsuccess aptget install -y -s foo + testfailure aptget install -y evil + testsuccess aptget source foo --print-uris LISTDIR=rootdir/var/lib/apt/lists if ! ( ls $LISTDIR/*InRelease >/dev/null 2>&1 || @@ -53,8 +54,7 @@ assert_repo_is_intact() setupaptarchive_with_lists_clean() { setupaptarchive --no-update - rm -f rootdir/var/lib/apt/lists/_* - #rm -rf rootdir/var/lib/apt/lists + rm -rf rootdir/var/lib/apt/lists } test_from_inrelease_to_unsigned() @@ -62,9 +62,11 @@ test_from_inrelease_to_unsigned() # setup archive with InRelease file setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before simulate_mitm_and_inject_evil_package assert_update_is_refused_and_last_good_state_used + testfileequal lists.before "$(listcurrentlistsdirectory)" } test_from_release_gpg_to_unsigned() @@ -73,23 +75,26 @@ test_from_release_gpg_to_unsigned() setupaptarchive_with_lists_clean rm $APTARCHIVE/dists/unstable/InRelease testsuccess aptget update + listcurrentlistsdirectory > lists.before simulate_mitm_and_inject_evil_package assert_update_is_refused_and_last_good_state_used + testfileequal lists.before "$(listcurrentlistsdirectory)" } test_from_inrelease_to_unsigned_with_override() { # setup archive with InRelease file setupaptarchive_with_lists_clean - testsuccess aptget update + # FIXME: is not what the server reported 4104 4106 + testsuccess aptget update #-o Debug::pkgAcquire::Worker=1 # simulate moving to a unsigned but otherwise valid repo simulate_mitm_and_inject_evil_package generatereleasefiles # and ensure we can update to it (with enough force) - testsuccess aptget update --allow-insecure-repositories \ + testwarning aptget update --allow-insecure-repositories \ -o Acquire::AllowDowngradeToInsecureRepositories=1 # but that the individual packages are still considered untrusted testequal "WARNING: The following packages cannot be authenticated! @@ -118,6 +123,7 @@ test_cve_2012_0214() # setup archive with InRelease setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before # do what CVE-2012-0214 did rm $APTARCHIVE/dists/unstable/InRelease @@ -127,6 +133,7 @@ test_cve_2012_0214() aptftparchive -qq release ./aptarchive > aptarchive/dists/unstable/Release assert_update_is_refused_and_last_good_state_used + testfileequal lists.before "$(listcurrentlistsdirectory)" # ensure there is no _Release file downloaded testfailure ls rootdir/var/lib/apt/lists/*_Release @@ -137,6 +144,7 @@ test_subvert_inrelease() # setup archive with InRelease setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before # replace InRelease with something else mv $APTARCHIVE/dists/unstable/Release $APTARCHIVE/dists/unstable/InRelease @@ -146,6 +154,7 @@ test_subvert_inrelease() E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure we keep the repo + testfileequal lists.before "$(listcurrentlistsdirectory)" assert_repo_is_intact } @@ -154,6 +163,7 @@ test_inrelease_to_invalid_inrelease() # setup archive with InRelease setupaptarchive_with_lists_clean testsuccess aptget update + listcurrentlistsdirectory > lists.before # now remove InRelease and subvert Release do no longer verify sed -i 's/Codename.*/Codename: evil!'/ $APTARCHIVE/dists/unstable/InRelease @@ -161,13 +171,14 @@ test_inrelease_to_invalid_inrelease() testequal "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) -W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq # ensure we keep the repo + testfailure grep 'evil' rootdir/var/lib/apt/lists/*InRelease + testfileequal lists.before "$(listcurrentlistsdirectory)" assert_repo_is_intact - testfailure grep "evil" rootdir/var/lib/apt/lists/*InRelease } test_release_gpg_to_invalid_release_release_gpg() @@ -176,15 +187,21 @@ test_release_gpg_to_invalid_release_release_gpg() setupaptarchive_with_lists_clean rm $APTARCHIVE/dists/unstable/InRelease testsuccess aptget update + listcurrentlistsdirectory > lists.before # now subvert Release do no longer verify echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release inject_evil_package - testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq + testequal "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 Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) + +W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) +W: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq + + testfailure grep 'evil' rootdir/var/lib/apt/lists/*Release + testfileequal lists.before "$(listcurrentlistsdirectory)" assert_repo_is_intact - testfailure grep "evil" rootdir/var/lib/apt/lists/*Release } @@ -225,6 +242,6 @@ test_inrelease_to_invalid_inrelease msgmsg "test_release_gpg_to_invalid_release_release_gpg" test_release_gpg_to_invalid_release_release_gpg -# ensure we can ovveride the downgrade error -msgmsg "test_from_inrelease_to_unsigned" +# ensure we can override the downgrade error +msgmsg "test_from_inrelease_to_unsigned_with_override" test_from_inrelease_to_unsigned_with_override