3 # Ensure that a MITM can not stale the Packages/Sources without
4 # raising a error message. Note that the Release file is protected
5 # via the "Valid-Until" header
9 TESTDIR
=$(readlink -f $(dirname $0))
13 configarchitecture
"i386"
15 insertpackage
'unstable' 'foo' 'all' '1.0'
20 listcurrentlistsdirectory
> lists.before
23 mkdir aptarchive
/dists
/unstable
/main
/binary
-i386/saved
24 cp -p aptarchive
/dists
/unstable
/main
/binary
-i386/Packages
* \
25 aptarchive
/dists
/unstable
/main
/binary
-i386/saved
26 insertpackage
'unstable' 'foo' 'all' '2.0'
28 compressfile aptarchive
/dists
/unstable
/main
/binary
-i386/Packages
29 # ensure that we do not get a I-M-S hit for the Release file
31 generatereleasefiles
'+1hour'
34 # but now only deliver the previous Packages file instead of the new one
35 # (simulating a stale attack)
36 cp -p aptarchive
/dists
/unstable
/main
/binary
-i386/saved
/Packages
* \
37 aptarchive
/dists
/unstable
/main
/binary
-i386/
39 # ensure this raises an error
40 testequal
"W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch
42 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
-qq
43 testfileequal lists.before
"$(listcurrentlistsdirectory)"