]>
Commit | Line | Data |
---|---|---|
80f3aeb0 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
bc8f83a5 DK |
4 | # apt-key is a shell script, so relatively prune to be effected by 'crazy' things: |
5 | # confuses config parser as there exists no way of escaping " currently. | |
6 | #TMPDIR="$(mktemp -d)/This is \"fü\$\$ing cràzy\", \$(man man | head -n1 | cut -d' ' -f 1)\$!" | |
7 | # gpg doesn't like | in path names – documented e.g. in the man gpg2 --agent-program | |
8 | #TMPDIR="$(mktemp -d)/This is fü\$\$ing cràzy, \$(man man | head -n1 | cut -d' ' -f 1)\$!" | |
9 | TMPDIR_ADD="This is fü\$\$ing cràzy, \$(apt -v)\$!" | |
10 | ||
3abb6a6a DK |
11 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
12 | . "$TESTDIR/framework" | |
80f3aeb0 DK |
13 | |
14 | setupenvironment | |
15 | configarchitecture 'amd64' | |
16 | ||
93d0d08c DK |
17 | # start from a clean plate again |
18 | cleanplate() { | |
0cfec3ab DK |
19 | rm -rf "${ROOTDIR}/etc/apt/trusted.gpg.d/" "${ROOTDIR}/etc/apt/trusted.gpg" |
20 | mkdir "${ROOTDIR}/etc/apt/trusted.gpg.d/" | |
93d0d08c | 21 | } |
fb7b11eb DK |
22 | testmultigpg() { |
23 | testfailure --nomsg aptkey --quiet --readonly "$@" | |
0cfec3ab DK |
24 | testsuccess grep "^gpgv: Can't check signature" "${ROOTDIR}/tmp/testfailure.output" |
25 | testsuccess grep '^gpgv: Good signature from' "${ROOTDIR}/tmp/testfailure.output" | |
fb7b11eb | 26 | } |
80f3aeb0 | 27 | |
93d0d08c | 28 | testrun() { |
0cfec3ab DK |
29 | echo "APT::Key::ArchiveKeyring \"${KEYDIR}/joesixpack.pub\"; |
30 | APT::Key::RemovedKeys \"${KEYDIR}/rexexpired.pub\";" > "${ROOTDIR}/etc/apt/apt.conf.d/aptkey.conf" | |
31 | ||
93d0d08c | 32 | cleanplate |
0cfec3ab DK |
33 | ln -sf "$(readlink -f "${KEYDIR}/joesixpack.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
34 | testaptkeys 'Joe Sixpack' | |
80f3aeb0 | 35 | |
0cfec3ab | 36 | testsuccess aptkey list |
93d0d08c | 37 | msgtest 'Check that paths in list output are not' 'double-slashed' |
0cfec3ab | 38 | testfailure --nomsg grep '//' "${ROOTDIR}/tmp/testsuccess.output" |
80f3aeb0 | 39 | |
0cfec3ab | 40 | testsuccess aptkey finger |
93d0d08c | 41 | msgtest 'Check that paths in finger output are not' 'double-slashed' |
0cfec3ab | 42 | testfailure --nomsg grep '//' "${ROOTDIR}/tmp/testsuccess.output" |
80f3aeb0 | 43 | |
25b86db1 | 44 | testsuccessequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed |
93d0d08c DK |
45 | gpg: Total number processed: 1 |
46 | gpg: unchanged: 1' aptkey --fakeroot update | |
80f3aeb0 | 47 | |
f14cde2c | 48 | testaptkeys 'Joe Sixpack' |
0cfec3ab | 49 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg" |
f14cde2c | 50 | |
0cfec3ab DK |
51 | testsuccess aptkey --fakeroot add "${KEYDIR}/rexexpired.pub" |
52 | testfilestats "${ROOTDIR}/etc/apt/trusted.gpg" '%a' '=' '644' | |
04937adc | 53 | |
f14cde2c | 54 | testaptkeys 'Rex Expired' 'Joe Sixpack' |
04937adc | 55 | |
38005d8b | 56 | msgtest 'Check that Sixpack key can be' 'exported' |
0cfec3ab DK |
57 | aptkey export 'Sixpack' > "${TMPWORKINGDIRECTORY}/aptkey.export" |
58 | aptkey --keyring "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" exportall > "${TMPWORKINGDIRECTORY}/aptkey.exportall" | |
59 | testsuccess --nomsg cmp "${TMPWORKINGDIRECTORY}/aptkey.export" "${TMPWORKINGDIRECTORY}/aptkey.exportall" | |
60 | testsuccess test -s "${TMPWORKINGDIRECTORY}/aptkey.export" | |
61 | testsuccess test -s "${TMPWORKINGDIRECTORY}/aptkey.exportall" | |
38005d8b | 62 | |
93d0d08c DK |
63 | msgtest 'Execute update again to trigger removal of' 'Rex Expired key' |
64 | testsuccess --nomsg aptkey --fakeroot update | |
65 | ||
f14cde2c | 66 | testaptkeys 'Joe Sixpack' |
93d0d08c DK |
67 | |
68 | msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring' | |
0cfec3ab | 69 | testsuccess --nomsg aptkey --fakeroot --keyring "${ROOTDIR}/etc/apt/trusted.gpg" del DBAC8DAE |
93d0d08c | 70 | |
f14cde2c | 71 | testaptkeys 'Joe Sixpack' |
93d0d08c DK |
72 | |
73 | testsuccess aptkey --fakeroot del DBAC8DAE | |
74 | testempty aptkey list | |
75 | ||
b0d40854 | 76 | msgtest 'Test key removal with' 'lowercase key ID' #keylength somewhere between 8byte and short |
05f64ca2 | 77 | cleanplate |
0cfec3ab | 78 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
05f64ca2 DK |
79 | testsuccess --nomsg aptkey --fakeroot del d141dbac8dae |
80 | testempty aptkey list | |
81 | ||
93d0d08c DK |
82 | msgtest 'Test key removal with' 'single key in real file' |
83 | cleanplate | |
0cfec3ab | 84 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
93d0d08c DK |
85 | testsuccess --nomsg aptkey --fakeroot del DBAC8DAE |
86 | testempty aptkey list | |
0cfec3ab DK |
87 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
88 | testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~" | |
93d0d08c | 89 | |
031a3f25 DK |
90 | msgtest 'Test key removal with' 'different key specs' |
91 | cleanplate | |
0cfec3ab DK |
92 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
93 | cp -a "${KEYDIR}/marvinparanoid.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/marvinparanoid.gpg" | |
031a3f25 DK |
94 | testsuccess --nomsg aptkey --fakeroot del 0xDBAC8DAE 528144E2 |
95 | testempty aptkey list | |
0cfec3ab DK |
96 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
97 | testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~" | |
98 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/marvinparanoid.gpg" | |
99 | testsuccess cmp "${KEYDIR}/marvinparanoid.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/marvinparanoid.gpg~" | |
031a3f25 | 100 | |
29f1b977 JM |
101 | msgtest 'Test key removal with' 'long key ID' |
102 | cleanplate | |
0cfec3ab | 103 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
29f1b977 JM |
104 | testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE |
105 | testempty aptkey list | |
0cfec3ab DK |
106 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
107 | testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~" | |
29f1b977 | 108 | |
ba72845c DK |
109 | msgtest 'Test key removal with' 'fingerprint' |
110 | cleanplate | |
0cfec3ab | 111 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
ba72845c DK |
112 | testsuccess --nomsg aptkey --fakeroot del 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE |
113 | testempty aptkey list | |
0cfec3ab DK |
114 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
115 | testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~" | |
ba72845c | 116 | |
93d0d08c DK |
117 | msgtest 'Test key removal with' 'single key in softlink' |
118 | cleanplate | |
0cfec3ab | 119 | ln -s "$(readlink -f "${KEYDIR}/joesixpack.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
93d0d08c DK |
120 | testsuccess --nomsg aptkey --fakeroot del DBAC8DAE |
121 | testempty aptkey list | |
0cfec3ab DK |
122 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
123 | testsuccess test -L "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~" | |
93d0d08c DK |
124 | |
125 | cleanplate | |
0cfec3ab DK |
126 | testsuccess aptkey --fakeroot add "${KEYDIR}/joesixpack.pub" |
127 | ln -sf "$(readlink -f "${KEYDIR}/marvinparanoid.pub")" "${KEYDIR}/marvin paránöid.pub" | |
128 | testsuccess aptkey --fakeroot add "${KEYDIR}/marvin paránöid.pub" | |
f14cde2c | 129 | testaptkeys 'Joe Sixpack' 'Marvin Paranoid' |
0cfec3ab | 130 | cp -a "${ROOTDIR}/etc/apt/trusted.gpg" "${KEYDIR}/testcase-multikey.pub" # store for reuse |
93d0d08c DK |
131 | |
132 | msgtest 'Test key removal with' 'multi key in real file' | |
133 | cleanplate | |
0cfec3ab | 134 | cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg" |
93d0d08c | 135 | testsuccess --nomsg aptkey --fakeroot del DBAC8DAE |
f14cde2c | 136 | testaptkeys 'Marvin Paranoid' |
0cfec3ab | 137 | testsuccess cmp "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~" |
93d0d08c DK |
138 | |
139 | msgtest 'Test key removal with' 'multi key in softlink' | |
140 | cleanplate | |
0cfec3ab | 141 | ln -s "$(readlink -f "${KEYDIR}/testcase-multikey.pub")" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg" |
93d0d08c | 142 | testsuccess --nomsg aptkey --fakeroot del DBAC8DAE |
f14cde2c | 143 | testaptkeys 'Marvin Paranoid' |
0cfec3ab DK |
144 | testsuccess cmp "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~" |
145 | testfailure test -L "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg" | |
146 | testsuccess test -L "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~" | |
93d0d08c DK |
147 | |
148 | msgtest 'Test key removal with' 'multiple files including key' | |
149 | cleanplate | |
0cfec3ab DK |
150 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
151 | cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg" | |
93d0d08c | 152 | testsuccess --nomsg aptkey --fakeroot del DBAC8DAE |
f14cde2c | 153 | testaptkeys 'Marvin Paranoid' |
0cfec3ab DK |
154 | testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
155 | testsuccess cmp "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg~" | |
156 | testsuccess cmp "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg~" | |
0dae96a2 DK |
157 | |
158 | cleanplate | |
0cfec3ab DK |
159 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
160 | cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg" | |
f14cde2c | 161 | testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid' |
0dae96a2 | 162 | msgtest 'Test merge-back of' 'added keys' |
0cfec3ab | 163 | testsuccess --nomsg aptkey adv --batch --yes --import "${KEYDIR}/rexexpired.pub" |
f14cde2c | 164 | testaptkeys 'Rex Expired' 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid' |
0dae96a2 DK |
165 | |
166 | msgtest 'Test merge-back of' 'removed keys' | |
167 | testsuccess --nomsg aptkey adv --batch --yes --delete-keys 27CE74F9 | |
f14cde2c | 168 | testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid' |
0dae96a2 DK |
169 | |
170 | msgtest 'Test merge-back of' 'removed duplicate keys' | |
171 | testsuccess --nomsg aptkey adv --batch --yes --delete-keys DBAC8DAE | |
f14cde2c | 172 | testaptkeys 'Marvin Paranoid' |
b0d40854 DK |
173 | |
174 | cleanplate | |
0cfec3ab DK |
175 | cp -a "${KEYDIR}/joesixpack.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.gpg" |
176 | cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg" | |
177 | local SIGNATURE="${TMPWORKINGDIRECTORY}/signature" | |
b0d40854 | 178 | msgtest 'Test signing a file' 'with a key' |
0cfec3ab DK |
179 | echo 'Verify me. This is my signature.' > "$SIGNATURE" |
180 | echo 'lalalalala' > "${SIGNATURE}2" | |
181 | testsuccess --nomsg aptkey --quiet --keyring "${KEYDIR}/marvinparanoid.pub" --secret-keyring "${KEYDIR}/marvinparanoid.sec" --readonly \ | |
182 | adv --batch --yes --default-key 'Marvin' --armor --detach-sign --sign --output "${SIGNATURE}.gpg" "${SIGNATURE}" | |
183 | testsuccess test -s "${SIGNATURE}.gpg" -a -s "${SIGNATURE}" | |
b0d40854 | 184 | |
2fac0dd5 | 185 | msgtest 'Test verify a file' 'with no sig' |
0cfec3ab | 186 | testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}" "${SIGNATURE}2" |
2fac0dd5 | 187 | |
25f27319 | 188 | for GPGV in '' 'gpgv' 'gpgv2'; do |
0cfec3ab | 189 | echo "APT::Key::GPGVCommand \"$GPGV\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd" |
f14cde2c DK |
190 | |
191 | msgtest 'Test verify a file' 'with all keys' | |
0cfec3ab | 192 | testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
b0d40854 | 193 | |
f14cde2c | 194 | msgtest 'Test verify a file' 'with good keyring' |
0cfec3ab | 195 | testsuccess --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
b0d40854 | 196 | |
f14cde2c | 197 | msgtest 'Test fail verify a file' 'with bad keyring' |
0cfec3ab | 198 | testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/joesixpack.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
b0d40854 | 199 | |
f14cde2c | 200 | msgtest 'Test fail verify a file' 'with non-existing keyring' |
0cfec3ab DK |
201 | testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/does-not-exist.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
202 | testfailure test -e "${KEYDIR}/does-not-exist.pub" | |
b0d40854 | 203 | |
4e03c47d | 204 | # note: this isn't how apts gpgv method implements keyid for verify |
f14cde2c | 205 | msgtest 'Test verify a file' 'with good keyid' |
0cfec3ab | 206 | testsuccess --nomsg aptkey --quiet --readonly --keyid 'Paranoid' verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
b0d40854 | 207 | |
f14cde2c | 208 | msgtest 'Test fail verify a file' 'with bad keyid' |
0cfec3ab | 209 | testfailure --nomsg aptkey --quiet --readonly --keyid 'Sixpack' verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
b0d40854 | 210 | |
f14cde2c | 211 | msgtest 'Test fail verify a file' 'with non-existing keyid' |
0cfec3ab | 212 | testfailure --nomsg aptkey --quiet --readonly --keyid 'Kalnischkies' verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
f14cde2c DK |
213 | |
214 | msgtest 'Test verify fails on' 'bad file' | |
0cfec3ab | 215 | testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}2" |
f14cde2c | 216 | done |
0cfec3ab | 217 | rm -f "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd" |
fb7b11eb DK |
218 | |
219 | msgtest 'Test verify a file' 'with good keyring' | |
0cfec3ab | 220 | testsuccess --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase-multikey.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
221 | |
222 | cleanplate | |
0cfec3ab DK |
223 | cat "${KEYDIR}/joesixpack.pub" "${KEYDIR}/marvinparanoid.pub" > "${KEYDIR}/double.pub" |
224 | cat "${KEYDIR}/joesixpack.sec" "${KEYDIR}/marvinparanoid.sec" > "${KEYDIR}/double.sec" | |
225 | cp -a "${KEYDIR}/double.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/double.gpg" | |
226 | cp -a "${KEYDIR}/testcase-multikey.pub" "${ROOTDIR}/etc/apt/trusted.gpg.d/multikey.gpg" | |
227 | rm -f "${SIGNATURE}.gpg" | |
228 | testsuccess aptkey --quiet --keyring "${KEYDIR}/double.pub" --secret-keyring "${KEYDIR}/double.sec" --readonly \ | |
229 | adv --batch --yes -u 'Marvin' -u 'Joe' --armor --detach-sign --sign --output "${SIGNATURE}.gpg" "${SIGNATURE}" | |
230 | testsuccess test -s "${SIGNATURE}.gpg" -a -s "${SIGNATURE}" | |
fb7b11eb DK |
231 | |
232 | for GPGV in '' 'gpgv' 'gpgv2'; do | |
0cfec3ab | 233 | echo "APT::Key::GPGVCommand \"$GPGV\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd" |
fb7b11eb DK |
234 | |
235 | msgtest 'Test verify a doublesigned file' 'with all keys' | |
0cfec3ab | 236 | testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
237 | |
238 | msgtest 'Test verify a doublesigned file' 'with good keyring joe' | |
0cfec3ab | 239 | testmultigpg --keyring "${KEYDIR}/joesixpack.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
240 | |
241 | msgtest 'Test verify a doublesigned file' 'with good keyring marvin' | |
0cfec3ab | 242 | testmultigpg --keyring "${KEYDIR}/marvinparanoid.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
243 | |
244 | msgtest 'Test fail verify a doublesigned file' 'with bad keyring' | |
0cfec3ab | 245 | testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/rexexpired.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
246 | |
247 | msgtest 'Test fail verify a doublesigned file' 'with non-existing keyring' | |
0cfec3ab DK |
248 | testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/does-not-exist.pub" verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
249 | testfailure test -e "${KEYDIR}/does-not-exist.pub" | |
fb7b11eb DK |
250 | |
251 | # note: this isn't how apts gpgv method implements keyid for verify | |
252 | msgtest 'Test verify a doublesigned file' 'with good keyid' | |
0cfec3ab | 253 | testmultigpg --keyid 'Paranoid' verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
254 | |
255 | msgtest 'Test fail verify a doublesigned file' 'with bad keyid' | |
0cfec3ab | 256 | testfailure --nomsg aptkey --quiet --readonly --keyid 'Rex' verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
257 | |
258 | msgtest 'Test fail verify a doublesigned file' 'with non-existing keyid' | |
0cfec3ab | 259 | testfailure --nomsg aptkey --quiet --readonly --keyid 'Kalnischkies' verify "${SIGNATURE}.gpg" "${SIGNATURE}" |
fb7b11eb DK |
260 | |
261 | msgtest 'Test verify fails on' 'bad doublesigned file' | |
0cfec3ab | 262 | testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}2" |
fb7b11eb | 263 | done |
0cfec3ab | 264 | rm -f "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd" |
93d0d08c | 265 | } |
04937adc | 266 | |
93d0d08c | 267 | setupgpgcommand() { |
0cfec3ab | 268 | echo "APT::Key::GPGCommand \"$1\";" > "${ROOTDIR}/etc/apt/apt.conf.d/00gpgcmd" |
f14cde2c DK |
269 | msgmsg 'Force tests to be run with' "$1" |
270 | testsuccess aptkey --readonly adv --version | |
0cfec3ab DK |
271 | cp "${ROOTDIR}/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/aptkey.version" |
272 | testsuccess grep "^gpg (GnuPG) $2\." "${TMPWORKINGDIRECTORY}/aptkey.version" | |
04937adc DK |
273 | } |
274 | ||
0cfec3ab DK |
275 | # run with default (whatever this is) in current CWD with relative paths |
276 | ROOTDIR="./rootdir" | |
277 | KEYDIR="./keys" | |
93d0d08c | 278 | testrun |
0cfec3ab DK |
279 | |
280 | # run with … and up the game with a strange CWD & absolute paths | |
281 | ROOTDIR="${TMPWORKINGDIRECTORY}/rootdir" | |
282 | KEYDIR="${TMPWORKINGDIRECTORY}/keys" | |
283 | mkdir inaccessible | |
284 | cd inaccessible | |
285 | chmod 600 ../inaccessible | |
286 | testfilestats "${TMPWORKINGDIRECTORY}/inaccessible" '%a' '=' '600' | |
287 | ||
fecfbf2e | 288 | setupgpgcommand 'gpg' '1' |
93d0d08c | 289 | testrun |
fecfbf2e | 290 | setupgpgcommand 'gpg2' '2' |
93d0d08c | 291 | testrun |