4 TESTDIR
="$(readlink -f "$(dirname "$0")")" 
   8 configarchitecture 'i386' 
  10 export APT_DONT_SIGN='' 
  12 insertpackage 'unstable' 'foo' 'i386' '1.0' 
  13 insertsource 'unstable' 'foo' 'any' '1.0' 
  15 setupaptarchive --no-update 
  16 APTARCHIVE="$(readlink -f ./aptarchive)" 
  23         testempty find rootdir/var/lib/apt/lists -maxdepth 1 -name '*InRelease' -o -name '*Release.gpg' 
  24         testnotempty find rootdir/var/lib/apt/lists -maxdepth 1 -name '*Release' 
  25         testnotempty apt show "$@
" 
  26         testnotempty apt showsrc "$@
" 
  27         testfailureequal "WARNING
: The following packages cannot be authenticated
! 
  29 E
: There were unauthenticated packages and 
-y was used without 
--allow-unauthenticated" aptget install -qq -y "$@
" 
  30         testfailureequal "WARNING
: The following packages cannot be authenticated
! 
  32 E
: Some packages could not be authenticated
" aptget source -qq "$@
" 
  39         local MANGLED="$(readlink -f ./rootdir)/var
/lib
/apt
/lists
/partial
/$(echo "$FILENAME" | sed 's#/#_#g')" 
  40         msgmsg "$TYPE contains only weak hashes
" 
  46                 listcurrentlistsdirectory > lists.before 
  47                 testfailuremsg "W
: No Hash entry 
in Release 
file ${MANGLED} which is considered strong enough 
for security purposes
 
  48 E
: The repository 
'file:${APTARCHIVE} unstable $(basename "$FILENAME")' provides only weak security information.
 
  49 N
: Updating from such a repository can
't be done securely, and is therefore disabled by default. 
  50 N: See apt-secure(8) manpage for repository creation and user configuration details." apt update 
  51                 testfileequal lists.before "$(listcurrentlistsdirectory)" 
  54                 testwarningmsg "W: No Hash entry in Release file ${MANGLED} which is considered strong enough for security purposes 
  55 W: The repository 'file:${APTARCHIVE} unstable 
$(basename "$FILENAME")' provides only weak security information. 
  56 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
 
  57 N
: See apt
-secure(8) manpage 
for repository creation and user configuration details.
" apt update "$@
" 
  61         msgmsg "$TYPE contains only weak hashes
, but 
source allows weak
" 
  62         sed -i 's#^deb\(-src\)\? #deb\1 [allow-weak=yes] #' rootdir/etc/apt/sources.list.d/* 
  64         testwarningmsg "W
: No Hash entry 
in Release 
file ${MANGLED} which is considered strong enough 
for security purposes
 
  65 W
: The repository 
'file:${APTARCHIVE} unstable $(basename "$FILENAME")' provides only weak security information.
 
  66 N
: Data from such a repository can
't be authenticated and is therefore potentially dangerous to use. 
  67 N: See apt-secure(8) manpage for repository creation and user configuration details." apt update "$@" 
  69         sed -i 's
#^deb\(-src\)\? \[allow-weak=yes\] #deb\1 #' rootdir/etc/apt/sources.list.d/* 
  71         msgmsg 
"$TYPE contains no hashes" 
  73         sed -i -e '/^ / d' -e '/^MD5Sum:/ d' "$APTARCHIVE/dists/unstable/Release" 
  77                 listcurrentlistsdirectory 
> lists.before
 
  78                 testfailuremsg 
"W: No Hash entry in Release file ${MANGLED} 
  79 E: The repository 'file:${APTARCHIVE} unstable $(basename "$FILENAME")' provides only weak security information. 
  80 N: Updating from such a repository can't be done securely, and is therefore disabled by default. 
  81 N: See apt-secure(8) manpage for repository creation and user configuration details." apt update
 
  82                 testfileequal lists.before 
"$(listcurrentlistsdirectory)" 
  85                 testwarningmsg 
"W: No Hash entry in Release file ${MANGLED} 
  86 W: The repository 'file:${APTARCHIVE} unstable $(basename "$FILENAME")' provides only weak security information. 
  87 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. 
  88 N: See apt-secure(8) manpage for repository creation and user configuration details." apt update 
"$@" 
  92         msgmsg 
"$TYPE contains only weak hashes for some files" 
  93         confighashes 
'MD5' 'SHA256' 
  95         sed -i '/^ [0-9a-fA-Z]\{64\} .*Sources$/d' "$APTARCHIVE/dists/unstable/Release" 
  99                 testwarningmsg 
"W: Skipping acquire of configured file 'main/source/Sources' as repository 'file:${APTARCHIVE} unstable InRelease' provides only weak security information for it" apt update
 
 102                 rm -f rootdir
/var
/lib
/apt
/lists
/partial
/* 
 103                 testsuccess apt update 
"$@" 
 104                 testnotempty apt showsrc foo
 
 106         testsuccess apt show foo
 
 110         rm -rf rootdir
/var
/lib
/apt
/lists
 
 111         mkdir -p rootdir
/var
/lib
/apt
/lists
/partial
 
 112         touch rootdir
/var
/lib
/apt
/lists
/lock
 
 113         local RELEASEGPG
="$(readlink -f ./rootdir)/var/lib/apt/lists/partial/$(echo "${APTARCHIVE}/dists/unstable/Release.gpg" | sed 's#/#_#g')" 
 115         chmod 644 "$RELEASEGPG" 
 116         local INRELEASE
="$(readlink -f ./rootdir)/var/lib/apt/lists/partial/$(echo "${APTARCHIVE}/dists/unstable/InRelease" | sed 's#/#_#g')" 
 118         chmod 644 "$INRELEASE" 
 121         rm -f "${APTARCHIVE}/dists/unstable/Release" "${APTARCHIVE}/dists/unstable/Release.gpg" 
 124 testrun 
'InRelease' "${APTARCHIVE}/dists/unstable/InRelease" 
 125 testrun 
'InRelease' "${APTARCHIVE}/dists/unstable/InRelease" --allow-weak-repositories -o APT
::Get
::List
-Cleanup=0 
 128         rm -f "${APTARCHIVE}/dists/unstable/InRelease" 
 131 testrun 
'Release+Release.gpg' "${APTARCHIVE}/dists/unstable/Release" 
 132 testrun 
'Release+Release.gpg' "${APTARCHIVE}/dists/unstable/Release" --allow-weak-repositories -o APT
::Get
::List
-Cleanup=0 
 135         rm -f "${APTARCHIVE}/dists/unstable/InRelease" "${APTARCHIVE}/dists/unstable/Release.gpg" 
 139 msgmsg 
'Moving between Release files with good and bad hashes' 
 140 rm -rf rootdir
/var
/lib
/apt
/lists
 
 142 generatereleasefiles 
'now - 7 days' 
 144 testfailure apt update
 
 146 testwarning apt update 
--allow-weak-repositories 
 149 confighashes 
'MD5' 'SHA256' 
 150 rm -rf aptarchive
/dists
 
 151 insertpackage 
'unstable' 'foo2' 'i386' '1.0' 
 152 insertsource 
'unstable' 'foo2' 'any' '1.0' 
 153 setupaptarchive 
--no-update 'now - 5 days' 
 154 testsuccess apt update
 
 156 testnotempty 
find rootdir
/var
/lib
/apt
/lists 
-maxdepth 1 -name '*InRelease' -o -name '*Release.gpg' 
 157 testnotempty apt show foo2
 
 158 testnotempty apt showsrc foo2
 
 161 rm -rf aptarchive
/dists
 
 162 insertpackage 
'unstable' 'foo3' 'i386' '1.0' 
 163 insertsource 
'unstable' 'foo3' 'any' '1.0' 
 164 setupaptarchive 
--no-update 'now - 3 days' 
 165 testfailure apt update
 
 168 testnotempty 
find rootdir
/var
/lib
/apt
/lists 
-maxdepth 1 -name '*InRelease' -o -name '*Release.gpg' 
 169 testnotempty apt show foo2
 
 170 testnotempty apt showsrc foo2
 
 171 testwarning apt update 
--allow-weak-repositories 
 175 msgmsg 
'Working with packages guarded only by weak hashes' 
 177 rm -rf aptarchive
/dists
 
 178 buildsimplenativepackage 
'foo4' 'i386' '1' 'unstable' 
 179 setupaptarchive 
--no-update 
 180 testfailure apt update
 
 181 confighashes 
'SHA256' 
 182 generatereleasefiles 
'now - 1 day' 
 184 testsuccess apt update
 
 186 testfailure apt download foo4
 
 187 cp ..
/rootdir
/tmp
/testfailure.output download.output
 
 188 testfailure 
grep 'Hash Sum mismatch' download.output
 
 189 testsuccess 
grep 'Insufficient information' download.output
 
 191 testsuccess apt 
install foo4 
-s 
 192 testfailure apt 
install foo4 
-dy 
 193 cp ..
/rootdir
/tmp
/testfailure.output 
install.output
 
 194 testfailure 
grep 'Hash Sum mismatch' install.output
 
 195 testsuccess 
grep 'Insufficient information' download.output
 
 197 testsuccess apt 
source foo4
 
 198 cp ..
/rootdir
/tmp
/testsuccess.output 
source.output
 
 199 testsuccess 
grep 'Skipping download of file' source.output
 
 200 testfailure 
test -e foo4_1.dsc
 
 201 testsuccess 
test -e foo4_1.
tar.
*