]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-update-stale
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / integration / test-apt-update-stale
... / ...
CommitLineData
1#!/bin/sh
2#
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
6#
7set -e
8
9TESTDIR=$(readlink -f $(dirname $0))
10. $TESTDIR/framework
11
12setupenvironment
13configarchitecture "i386"
14
15insertpackage 'unstable' 'foo' 'all' '1.0'
16
17setupaptarchive
18changetowebserver
19aptget update -qq
20listcurrentlistsdirectory > lists.before
21
22# insert new version
23mkdir aptarchive/dists/unstable/main/binary-i386/saved
24cp -p aptarchive/dists/unstable/main/binary-i386/Packages* \
25 aptarchive/dists/unstable/main/binary-i386/saved
26insertpackage 'unstable' 'foo' 'all' '2.0'
27
28compressfile aptarchive/dists/unstable/main/binary-i386/Packages
29# ensure that we do not get a I-M-S hit for the Release file
30
31generatereleasefiles '+1hour'
32signreleasefiles
33
34# but now only deliver the previous Packages file instead of the new one
35# (simulating a stale attack)
36cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \
37 aptarchive/dists/unstable/main/binary-i386/
38
39# ensure this raises an error
40testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch
41
42E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
43testfileequal lists.before "$(listcurrentlistsdirectory)"