]>
Commit | Line | Data |
---|---|---|
9082a1fc DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
9082a1fc DK |
6 | |
7 | setupenvironment | |
8 | configarchitecture "i386" | |
9 | ||
10 | buildsimplenativepackage 'apt' 'all' '1.0' 'stable' | |
11 | ||
12 | # setup http redirecting to https | |
d56e2917 | 13 | getlabelfromsuite() { echo 'Testcases'; } |
9082a1fc | 14 | setupaptarchive --no-update |
6c0765c0 DK |
15 | changetohttpswebserver -o 'aptwebserver::support::http=false' |
16 | webserverconfig 'aptwebserver::redirect::replace::/downgrademe/' "http://localhost:${APTHTTPPORT}/" | |
17 | webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "https://localhost:${APTHTTPSPORT}/" | |
18 | sed -i -e "s#:${APTHTTPSPORT}/#:${APTHTTPPORT}/redirectme#" -e 's# https:# http:#' rootdir/etc/apt/sources.list.d/* | |
9082a1fc DK |
19 | |
20 | testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1 | |
21 | ||
22 | msgtest 'Test that the webserver does not answer' 'http requests' | |
6c0765c0 | 23 | downloadfile "http://localhost:${APTHTTPPORT}/pool/main/a/apt/apt_1.0/changelog" changelog >/dev/null 2>&1 && msgfail || msgpass |
9082a1fc | 24 | |
430481e7 | 25 | echo "Acquire::Changelogs::URI::Label::Testcases \"http://localhost:${APTHTTPPORT}/redirectme/pool/@CHANGEPATH@/changelog\";" > rootdir/etc/apt/apt.conf.d/changelog.conf |
6c0765c0 | 26 | testsuccessequal "'http://localhost:${APTHTTPPORT}/redirectme/pool/main/a/apt/apt_1.0/changelog' apt.changelog" aptget changelog apt --print-uris |
9082a1fc | 27 | |
03aa0847 | 28 | cd downloaded |
9082a1fc DK |
29 | testsuccess aptget changelog apt -d |
30 | testsuccess test -s apt.changelog | |
31 | rm -f apt.changelog | |
32 | ||
33 | testsuccess aptget download apt | |
34 | testsuccess test -s apt_1.0_all.deb | |
35 | rm apt_1.0_all.deb | |
03aa0847 | 36 | cd - >/dev/null |
9082a1fc DK |
37 | |
38 | testsuccess aptget install apt -y | |
39 | testdpkginstalled 'apt' | |
40 | ||
03aa0847 | 41 | cd downloaded |
c9c91069 DK |
42 | testfailureequal "E: The method 'https' is explicitly disabled via configuration. |
43 | N: If you meant to use Tor remember to use tor+https instead of https." aptget download apt -o Dir::Bin::Methods::https=false | |
e52aad52 | 44 | testfailure test -e apt_1.0_all.deb |
03aa0847 | 45 | cd - >/dev/null |
889b0072 | 46 | |
889b0072 DK |
47 | # check that downgrades from https to http are not allowed |
48 | webserverconfig 'aptwebserver::support::http' 'true' | |
6c0765c0 | 49 | sed -i -e "s#:${APTHTTPPORT}/redirectme#:${APTHTTPSPORT}/downgrademe#" -e 's# http:# https:#' rootdir/etc/apt/sources.list.d/* |
30060442 | 50 | testfailure aptget update --allow-insecure-repositories -o Acquire::https::Timeout=1 |