]>
git.saurik.com Git - apt.git/blob - test/integration/test-releasefile-verification
4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
"i386"
14 webserverconfig
'aptwebserver::support::range' 'false'
17 local DATE
="${2:-now}"
18 if [ "$DATE" = 'now' ]; then
19 if [ "$1" = "${PKGFILE}-new" ]; then
25 for release
in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
26 touch -d 'now - 1 year' $release
29 cp $1 aptarchive
/Packages
30 find aptarchive
-name 'Release' -delete
31 compressfile
'aptarchive/Packages' "$DATE"
32 generatereleasefiles
"$DATE"
36 testequal
'Reading package lists...
37 Building dependency tree...
39 aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
40 The following NEW packages will be installed:
42 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
43 After this operation, 5370 kB of additional disk space will be used.
44 Get:1 http://localhost:8080/ apt 0.7.25.3
45 Download complete and in download only mode' aptget
install apt
-dy
49 testequal
'Reading package lists...
50 Building dependency tree...
52 aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
53 The following NEW packages will be installed:
55 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
56 After this operation, 5808 kB of additional disk space will be used.
57 Get:1 http://localhost:8080/ apt 0.8.0~pre1
58 Download complete and in download only mode' aptget
install apt
-dy
62 testequal
'Reading package lists...
63 Building dependency tree...
65 aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
66 The following NEW packages will be installed:
68 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
69 After this operation, 5370 kB of additional disk space will be used.
70 WARNING: The following packages cannot be authenticated!
72 E: There are problems and -y was used without --force-yes' aptget
install apt
-dy
76 testequal
'Reading package lists...
77 Building dependency tree...
79 aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
80 The following NEW packages will be installed:
82 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
83 After this operation, 5808 kB of additional disk space will be used.
84 WARNING: The following packages cannot be authenticated!
86 E: There are problems and -y was used without --force-yes' aptget
install apt
-dy
89 # fake our downloadable file
90 touch aptarchive
/apt.deb
92 PKGFILE
="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
95 local LOG='update.log'
96 if aptget update >$LOG 2>&1 || grep -q -E '^(W|E): ' $LOG; then
105 local LOG='update.log'
106 aptget update >$LOG 2>&1 || true
107 if grep -q -E "$1" $LOG; then
117 rm -rf rootdir/var/lib/apt/lists
118 signreleasefiles 'Joe Sixpack'
119 find aptarchive/ -name "$DELETEFILE" -delete
120 msgtest 'Cold archive signed by' 'Joe Sixpack'
122 testequal "$(cat ${PKGFILE})
126 prepare ${PKGFILE}-new
127 signreleasefiles 'Joe Sixpack'
128 find aptarchive/ -name "$DELETEFILE" -delete
129 msgtest 'Good warm archive signed by' 'Joe Sixpack'
131 testequal "$(cat ${PKGFILE}-new)
136 rm -rf rootdir/var/lib/apt/lists
137 cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
138 signreleasefiles 'Rex Expired'
139 find aptarchive/ -name "$DELETEFILE" -delete
140 msgtest 'Cold archive signed by' 'Rex Expired'
141 updatefailure '^W: .* KEYEXPIRED'
142 testequal "$(cat ${PKGFILE})
145 rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
148 rm -rf rootdir/var/lib/apt/lists
149 signreleasefiles 'Marvin Paranoid'
150 find aptarchive/ -name "$DELETEFILE" -delete
151 msgtest 'Cold archive signed by' 'Marvin Paranoid'
152 updatefailure '^W: .* NO_PUBKEY'
153 testequal "$(cat ${PKGFILE})
157 prepare ${PKGFILE}-new
158 # weborf doesn't support If-Range
159 for release in $(find rootdir/var/lib/apt/lists/partial/ -name '*Release'); do
163 signreleasefiles 'Joe Sixpack'
164 find aptarchive/ -name "$DELETEFILE" -delete
165 msgtest 'Bad warm archive signed by' 'Joe Sixpack'
167 testequal "$(cat ${PKGFILE}-new)
173 rm -rf rootdir/var/lib/apt/lists
174 signreleasefiles 'Joe Sixpack'
175 find aptarchive/ -name "$DELETEFILE" -delete
176 msgtest 'Cold archive signed by' 'Joe Sixpack'
178 testequal "$(cat ${PKGFILE})
182 prepare ${PKGFILE}-new
183 signreleasefiles 'Marvin Paranoid'
184 find aptarchive/ -name "$DELETEFILE" -delete
185 msgtest 'Good warm archive signed by' 'Marvin Paranoid'
186 updatefailure '^W: .* NO_PUBKEY'
187 testequal "$(cat ${PKGFILE})
191 prepare ${PKGFILE}-new
192 cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
193 signreleasefiles 'Rex Expired'
194 find aptarchive/ -name "$DELETEFILE" -delete
195 msgtest 'Good warm archive signed by' 'Rex Expired'
196 updatefailure '^W: .* KEYEXPIRED'
197 testequal "$(cat ${PKGFILE})
200 rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
202 prepare ${PKGFILE}-new
204 find aptarchive/ -name "$DELETEFILE" -delete
205 msgtest 'Good warm archive signed by' 'Joe Sixpack'
207 testequal "$(cat ${PKGFILE}-new)
214 rm -rf rootdir/var/lib/apt/lists
215 signreleasefiles 'Joe Sixpack'
216 msgtest 'Cold archive signed by' 'Joe Sixpack'
219 # New .deb but now an unsigned archive. For example MITM to circumvent
220 # package verification.
221 prepare ${PKGFILE}-new
222 find aptarchive/ -name InRelease -delete
223 find aptarchive/ -name Release.gpg -delete
224 msgtest 'Warm archive signed by' 'nobody'
226 testequal "$(cat ${PKGFILE}-new)
230 # Unsigned archive from the beginning must also be detected.
231 rm -rf rootdir/var/lib/apt/lists
232 msgtest 'Cold archive signed by' 'nobody'
234 testequal "$(cat ${PKGFILE}-new)
241 DELETEFILE="InRelease
"
243 DELETEFILE="Release.gpg
"