You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
2.2 KiB

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