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 no hashes
"
63 sed -i -e '/^ / d' -e '/^MD5Sum:/ d' "$APTARCHIVE/dists
/unstable
/Release
"
67 listcurrentlistsdirectory > lists.before
68 testfailuremsg "W
: No Hash entry
in Release
file ${MANGLED}
69 E
: The repository
'file:${APTARCHIVE} unstable $(basename "$FILENAME")' provides only weak security information.
70 N
: Updating from such a repository can
't be done securely, and is therefore disabled by default.
71 N: See apt-secure(8) manpage for repository creation and user configuration details." apt update
72 testfileequal lists.before "$(listcurrentlistsdirectory)"
75 testwarningmsg "W: No Hash entry in Release file ${MANGLED}
76 W: The repository 'file:${APTARCHIVE} unstable
$(basename "$FILENAME")' provides only weak security information.
77 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
78 N
: See apt
-secure(8) manpage
for repository creation and user configuration details.
" apt update "$@
"
82 msgmsg "$TYPE contains only weak hashes
for some files
"
83 confighashes 'MD5' 'SHA256'
85 sed -i '/^ [0-9a-fA-Z]\{64\} .*Sources$/d' "$APTARCHIVE/dists
/unstable
/Release
"
88 # trust is a repository property, so individual files can't be insecure
89 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 "$@
"
90 testsuccess apt show foo
95 rm -rf rootdir/var/lib/apt/lists
96 mkdir -p rootdir/var/lib/apt/lists/partial
97 touch rootdir/var/lib/apt/lists/lock
98 local RELEASEGPG="$(readlink -f ./rootdir)/var
/lib
/apt
/lists
/partial
/$(echo "${APTARCHIVE}/dists/unstable/Release.gpg" | sed 's#/#_#g')"
100 chmod 644 "$RELEASEGPG"
101 local INRELEASE="$(readlink -f ./rootdir)/var
/lib
/apt
/lists
/partial
/$(echo "${APTARCHIVE}/dists/unstable/InRelease" | sed 's#/#_#g')"
103 chmod 644 "$INRELEASE"
106 rm -f "${APTARCHIVE}/dists
/unstable
/Release
" "${APTARCHIVE}/dists
/unstable
/Release.gpg
"
109 testrun 'InRelease' "${APTARCHIVE}/dists
/unstable
/InRelease
"
110 testrun 'InRelease' "${APTARCHIVE}/dists
/unstable
/InRelease
" --allow-insecure-repositories -o APT::Get::List-Cleanup=0
113 rm -f "${APTARCHIVE}/dists
/unstable
/InRelease
"
116 testrun 'Release+Release.gpg' "${APTARCHIVE}/dists
/unstable
/Release
"
117 testrun 'Release+Release.gpg' "${APTARCHIVE}/dists
/unstable
/Release
" --allow-insecure-repositories -o APT::Get::List-Cleanup=0
120 rm -f "${APTARCHIVE}/dists
/unstable
/InRelease
" "${APTARCHIVE}/dists
/unstable
/Release.gpg
"
124 msgmsg 'Moving between Release files with good and bad hashes'
125 rm -rf rootdir/var/lib/apt/lists
127 generatereleasefiles 'now - 1 day'
129 testfailure apt update
131 testwarning apt update --allow-insecure-repositories
134 confighashes 'MD5' 'SHA256'
135 rm -rf aptarchive/dists
136 insertpackage 'unstable' 'foo2' 'i386' '1.0'
137 insertsource 'unstable' 'foo2' 'any' '1.0'
138 setupaptarchive --no-update 'now - 12 hours'
139 testsuccess apt update
141 testnotempty find rootdir/var/lib/apt/lists -maxdepth 1 -name '*InRelease' -o -name '*Release.gpg'
142 testnotempty apt show foo2
143 testnotempty apt showsrc foo2
146 rm -rf aptarchive/dists
147 insertpackage 'unstable' 'foo3' 'i386' '1.0'
148 insertsource 'unstable' 'foo3' 'any' '1.0'
149 setupaptarchive --no-update
150 testfailure apt update
153 testnotempty find rootdir/var/lib/apt/lists -maxdepth 1 -name '*InRelease' -o -name '*Release.gpg'
154 testnotempty apt show foo2
155 testnotempty apt showsrc foo2
156 testwarning apt update --allow-insecure-repositories