summaryrefslogtreecommitdiff
path: root/test/integration/test-releasefile-verification
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-04-29 16:48:16 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-05-01 10:50:24 +0200
commit89901946f936446f439b95f1a9a85ac942ac2c92 (patch)
treef74a7cf049fbfbda478c1fdeec05c1a45d552302 /test/integration/test-releasefile-verification
parent46e00c9062d09a642973e83a334483db1f310397 (diff)
support Signed-By in Release files as a sort of HPKP
Users have the option since apt >= 1.1 to enforce that a Release file is signed with specific key(s) either via keyring filename or fingerprints. This commit adds an entry with the same name and value (except that it doesn't accept filenames for obvious reasons) to the Release file so that the repository owner can set a default value for this setting effecting the *next* Release file, not the current one, which provides a functionality similar "HTTP Public Key Pinning". The pinning is in effect as long as the (then old) Release file is considered valid, but it is also ignored if the Release file has no Valid-Until at all.
Diffstat (limited to 'test/integration/test-releasefile-verification')
-rwxr-xr-xtest/integration/test-releasefile-verification52
1 files changed, 51 insertions, 1 deletions
diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification
index e2e1b5b76..24e7830aa 100755
--- a/test/integration/test-releasefile-verification
+++ b/test/integration/test-releasefile-verification
@@ -29,7 +29,7 @@ prepare() {
cp "$1" aptarchive/Packages
find aptarchive -name 'Release' -delete
compressfile 'aptarchive/Packages' "$DATE"
- generatereleasefiles "$DATE"
+ generatereleasefiles "$DATE" 'now + 1 month'
}
installaptold() {
@@ -47,6 +47,7 @@ Download complete and in download only mode" aptget install apt -dy
}
installaptnew() {
+ rm -rf rootdir/var/cache/apt/archives
testsuccessequal "Reading package lists...
Building dependency tree...
Suggested packages:
@@ -301,6 +302,55 @@ runtest() {
rm -f rootdir/etc/apt/trusted.gpg.d/marvinparanoid.gpg
sed -i "s#^\(deb\(-src\)\?\) \[signed-by=${MARVIN},${SIXPACK}\] #\1 #" rootdir/etc/apt/sources.list.d/*
+ rm -rf rootdir/var/lib/apt/lists-bak
+ cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
+ prepare "${PKGFILE}-new"
+ signreleasefiles 'Joe Sixpack'
+ find aptarchive/ -name "$DELETEFILE" -delete
+
+ msgmsg 'Warm archive with signed-by' 'Joe Sixpack'
+ sed -i "/^Valid-Until: / a\
+Signed-By: ${SIXPACK}" rootdir/var/lib/apt/lists/*Release
+ touch -d 'now - 1 year' rootdir/var/lib/apt/lists/*Release
+ successfulaptgetupdate
+ testsuccessequal "$(cat "${PKGFILE}-new")
+" aptcache show apt
+ installaptnew
+
+ msgmsg 'Warm archive with signed-by' 'Marvin Paranoid'
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ sed -i "/^Valid-Until: / a\
+Signed-By: ${MARVIN}" rootdir/var/lib/apt/lists/*Release
+ touch -d 'now - 1 year' rootdir/var/lib/apt/lists/*Release
+ updatewithwarnings 'W: .* public key is not available: GOODSIG'
+ testsuccessequal "$(cat "${PKGFILE}")
+" aptcache show apt
+ installaptold
+
+ msgmsg 'Warm archive with outdated signed-by' 'Marvin Paranoid'
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ sed -i "/^Valid-Until: / a\
+Valid-Until: $(date -u -d "now - 2min" '+%a, %d %b %Y %H:%M:%S %Z') \\
+Signed-By: ${MARVIN}" rootdir/var/lib/apt/lists/*Release
+ touch -d 'now - 1 year' rootdir/var/lib/apt/lists/*Release
+ successfulaptgetupdate
+ testsuccessequal "$(cat "${PKGFILE}-new")
+" aptcache show apt
+ installaptnew
+
+ msgmsg 'Warm archive with two signed-bys' 'Joe Sixpack'
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ sed -i "/^Valid-Until: / a\
+Signed-By: ${MARVIN} ${MARVIN}, \\
+ ${SIXPACK}" rootdir/var/lib/apt/lists/*Release
+ touch -d 'now - 1 year' rootdir/var/lib/apt/lists/*Release
+ successfulaptgetupdate
+ testsuccessequal "$(cat "${PKGFILE}-new")
+" aptcache show apt
+ installaptnew
}
runtest2() {