From 89901946f936446f439b95f1a9a85ac942ac2c92 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 29 Apr 2016 16:48:16 +0200 Subject: 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. --- test/integration/test-releasefile-verification | 52 +++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'test/integration/test-releasefile-verification') 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() { -- cgit v1.2.3