blob: 26de76807959267b502c7a7db8aa1ed1c19a053e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
#!/bin/sh
set -e
TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
configarchitecture 'amd64'
buildsimplenativepackage 'foo' 'amd64' '1' 'stable'
buildsimplenativepackage 'foo' 'amd64' '2' 'testing'
setupaptarchive --no-update
APTARCHIVE=$(readlink -f ./aptarchive)
everythingsucceeds() {
testsuccessequal 'Listing...
foo/testing 2 amd64
foo/stable 1 amd64
' apt list foo -a
cd downloaded
rm -f foo_1_amd64.deb foo_2_amd64.deb
testsuccess aptget download foo "$@"
testsuccess test -s foo_1_amd64.deb -o -s foo_2_amd64.deb
rm -f foo_1.dsc foo_2.dsc
testsuccess aptget source foo --dsc-only -d "$@"
testsuccess test -s foo_1.dsc -o -s foo_2.dsc
cd - >/dev/null
}
everythingfails() {
testsuccessequal 'Listing...
foo/testing 2 amd64
foo/stable 1 amd64
' apt list foo -a
local WARNING='WARNING: The following packages cannot be authenticated!
foo
E: Some packages could not be authenticated'
cd downloaded
rm -f foo_1_amd64.deb foo_2_amd64.deb
testfailure aptget download foo "$@"
testequal "$WARNING" tail -n 3 ../rootdir/tmp/testfailure.output
testfailure test -s foo_1_amd64.deb -o -s foo_2_amd64.deb
rm -f foo_1.dsc foo_2.dsc
testfailure aptget source foo --dsc-only -d "$@"
testequal "$WARNING" tail -n 3 ../rootdir/tmp/testfailure.output
testfailure test -s foo_1.dsc -o -s foo_2.dsc
cd - >/dev/null
}
cp -a rootdir/etc/apt/sources.list.d/ rootdir/etc/apt/sources.list.d.bak/
echo 'Debug::Acquire::Transaction "true";
Debug::pkgAcquire::Worker "true";' > rootdir/etc/apt/apt.conf.d/00debugging
aptgetupdate() {
rm -rf rootdir/var/lib/apt/lists
# note that insecure with trusted=yes are allowed
# as the trusted=yes indicates that security is provided by
# something above the understanding of apt
${1:-testsuccess} aptget update --no-allow-insecure-repositories
}
insecureaptgetupdate() {
rm -rf rootdir/var/lib/apt/lists
testfailure aptget update --no-allow-insecure-repositories
rm -rf rootdir/var/lib/apt/lists
testwarning aptget update --allow-insecure-repositories
}
msgmsg 'Test without trusted option and good sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
aptgetupdate
everythingsucceeds
everythingsucceeds -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=yes option and good sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/*
aptgetupdate
everythingsucceeds
everythingsucceeds -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=no option and good sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/*
# we want the warnings on the actions, but for 'update' everything is fine
aptgetupdate
everythingfails
everythingfails -t stable
everythingfails -t testing
find aptarchive/dists/stable \( -name 'InRelease' -o -name 'Release.gpg' \) -delete
msgmsg 'Test without trusted option and good and unsigned sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
insecureaptgetupdate
everythingsucceeds
everythingfails -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=yes option and good and unsigned sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/*
aptgetupdate
everythingsucceeds
everythingsucceeds -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=no option and good and unsigned sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/*
insecureaptgetupdate
everythingfails
everythingfails -t stable
everythingfails -t testing
signreleasefiles 'Marvin Paranoid' 'aptarchive/dists/stable'
msgmsg 'Test without trusted option and good and unknown sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
insecureaptgetupdate
everythingsucceeds
everythingfails -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=yes option and good and unknown sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/*
aptgetupdate 'testwarning'
everythingsucceeds
everythingsucceeds -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=no option and good and unknown sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/*
insecureaptgetupdate
everythingfails
everythingfails -t stable
everythingfails -t testing
signreleasefiles 'Rex Expired' 'aptarchive/dists/stable'
cp -a keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
msgmsg 'Test without trusted option and good and expired sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
insecureaptgetupdate
everythingsucceeds
everythingfails -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=yes option and good and expired sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/*
aptgetupdate 'testwarning'
everythingsucceeds
everythingsucceeds -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=no option and good and expired sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/*
insecureaptgetupdate
everythingfails
everythingfails -t stable
everythingfails -t testing
# same as the one further above, but this time testing is unsigned
find aptarchive/ \( -name 'InRelease' -o -name 'Release.gpg' \) -delete
signreleasefiles 'Joe Sixpack' 'aptarchive/dists/stable'
msgmsg 'Test without trusted option and unsigned and good sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
insecureaptgetupdate
everythingfails
everythingsucceeds -t stable
everythingfails -t testing
msgmsg 'Test with trusted=yes option and unsigned and good sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=yes] #' rootdir/etc/apt/sources.list.d/*
aptgetupdate
everythingsucceeds
everythingsucceeds -t stable
everythingsucceeds -t testing
msgmsg 'Test with trusted=no option and unsigned and good sources'
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
sed -i 's#^deb\(-src\)\? #deb\1 [trusted=no] #' rootdir/etc/apt/sources.list.d/*
insecureaptgetupdate
everythingfails
everythingfails -t stable
everythingfails -t testing
msgmsg 'Test conflicting trusted options are refused'
testsource() {
echo "$@" > rootdir/etc/apt/sources.list.d/example.list
testfailuremsg 'E: Conflicting values set for option Trusted regarding source http://example.org/bad/ unstable
E: The list of sources could not be read.' aptget update --print-uris
}
for VAL in 'yes' 'no'; do
testsource "deb http://example.org/bad unstable main
deb [trusted=${VAL}] http://example.org/bad unstable non-free"
testsource "deb [trusted=${VAL}] http://example.org/bad unstable main
deb http://example.org/bad unstable non-free"
done
testsource 'deb [trusted=yes] http://example.org/bad unstable main
deb [trusted=no] http://example.org/bad unstable non-free'
testsource 'deb [trusted=no] http://example.org/bad unstable main
deb [trusted=yes] http://example.org/bad unstable non-free'
|