]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-releasefile-verification
Merge remote-tracking branch 'mvo/bugfix/coverity' into debian/sid
[apt.git] / test / integration / test-releasefile-verification
index 961c498950dc716fc3b85b6744e13dc82f3c6fab..e56f458d3be4309b67666acd6b8f4178fee490e5 100755 (executable)
@@ -19,13 +19,12 @@ prepare() {
        for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
                touch -d 'now - 6 hours' $release
        done
        for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
                touch -d 'now - 6 hours' $release
        done
-       rm -rf rootdir/var/cache/apt/archives
-       rm -f rootdir/var/cache/apt/*.bin
+       aptget clean
        cp $1 aptarchive/Packages
        find aptarchive -name 'Release' -delete
        cat aptarchive/Packages | gzip > aptarchive/Packages.gz
        cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
        cp $1 aptarchive/Packages
        find aptarchive -name 'Release' -delete
        cat aptarchive/Packages | gzip > aptarchive/Packages.gz
        cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
-       cat aptarchive/Packages | lzma > aptarchive/Packages.lzma
+       cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma
        generatereleasefiles "$DATE"
 }
 
        generatereleasefiles "$DATE"
 }
 
@@ -38,7 +37,7 @@ The following NEW packages will be installed:
   apt
 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 After this operation, 5370 kB of additional disk space will be used.
   apt
 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 After this operation, 5370 kB of additional disk space will be used.
-Get:1 http://localhost/  apt 0.7.25.3
+Get:1 http://localhost:8080/  apt 0.7.25.3
 Download complete and in download only mode' aptget install apt -dy
 }
 
 Download complete and in download only mode' aptget install apt -dy
 }
 
@@ -51,7 +50,7 @@ The following NEW packages will be installed:
   apt
 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 After this operation, 5808 kB of additional disk space will be used.
   apt
 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
 After this operation, 5808 kB of additional disk space will be used.
-Get:1 http://localhost/  apt 0.8.0~pre1
+Get:1 http://localhost:8080/  apt 0.8.0~pre1
 Download complete and in download only mode' aptget install apt -dy
 }
 
 Download complete and in download only mode' aptget install apt -dy
 }
 
@@ -154,6 +153,35 @@ runtest() {
        installaptold
 }
 
        installaptold
 }
 
+runtest2() {
+       prepare ${PKGFILE}
+       rm -rf rootdir/var/lib/apt/lists
+       signreleasefiles 'Joe Sixpack'
+       msgtest 'Cold archive signed by' 'Joe Sixpack'
+       aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+
+       # New .deb but now an unsigned archive. For example MITM to circumvent
+       # package verification.
+       prepare ${PKGFILE}-new
+       find aptarchive/ -name InRelease -delete
+       find aptarchive/ -name Release.gpg -delete
+       msgtest 'Warm archive signed by' 'nobody'
+       aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+       testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt
+       failaptnew
+
+       # Unsigned archive from the beginning must also be detected.
+       rm -rf rootdir/var/lib/apt/lists
+       msgtest 'Cold archive signed by' 'nobody'
+       aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+       testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt
+       failaptnew
+}
+runtest2
+
+
 DELETEFILE="InRelease"
 runtest
 DELETEFILE="Release.gpg"
 DELETEFILE="InRelease"
 runtest
 DELETEFILE="Release.gpg"