]>
git.saurik.com Git - apt.git/blob - test/integration/test-authentication-basic
4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 configarchitecture 'i386'
10 insertpackage 'unstable' 'foo' 'all' '1'
11 setupaptarchive --no-update
14 changetohttpswebserver --authorization="$(printf '%s' 'star:hunter2' | base64 )"
16 echo 'See, when YOU type hunter2, it shows to us as *******' > aptarchive/bash
19 testfailure apthelper download-file "${1}/bash
" ./downloaded/bash
20 # crappy test, but http and https output are wastely different…
21 testsuccess grep 401 rootdir/tmp/testfailure.output
22 testfailure test -s ./downloaded/bash
26 testsuccess apthelper download-file "${1}/bash
" ./downloaded/bash
27 testfileequal ./downloaded/bash "$(cat aptarchive/bash)"
28 testfilestats ./downloaded/bash '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
29 rm -f ./downloaded/bash
31 # lets see if got/retains acceptable permissions
32 if [ -n "$AUTHCONF" ]; then
33 if [ "$(id -u)" = '0' ]; then
34 testfilestats "$AUTHCONF" '%U:%G:%a' '=' "_apt
:root
:600"
36 testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:600"
40 rm -rf rootdir/var/lib/apt/lists
41 testsuccess aptget update
42 testsuccessequal 'Reading package lists...
43 Building dependency tree...
44 The following NEW packages will be installed:
46 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
47 Inst foo (1 unstable [all])
48 Conf foo (1 unstable [all])' aptget install foo -s
52 local AUTHCONF='rootdir/etc/apt/auth.conf'
54 printf '%s' "$1" > "$AUTHCONF"
64 authfile 'machine localhost
70 authfile 'machine localhost
75 # 2 stanzas: unmatching + good auth
76 authfile 'machine debian.org
86 msgmsg 'server basic auth'
87 rewritesourceslist "http
://localhost
:${APTHTTPPORT}"
88 runtest "http
://localhost
:${APTHTTPPORT}"
89 rewritesourceslist "https
://localhost
:${APTHTTPSPORT}"
90 runtest "https
://localhost
:${APTHTTPSPORT}"
91 rewritesourceslist "http
://localhost
:${APTHTTPPORT}"
93 msgmsg 'proxy to server basic auth'
94 webserverconfig 'aptwebserver::request::absolute' 'uri'
95 export http_proxy="http
://localhost
:${APTHTTPPORT}"
96 runtest "http
://localhost
:${APTHTTPPORT}"
99 msgmsg 'proxy basic auth to server basic auth'
100 webserverconfig 'aptwebserver::proxy-authorization' "$(printf 'moon:deer2' | base64)"
101 export http_proxy="http
://moon
:deer2@localhost
:${APTHTTPPORT}"
102 runtest "http
://localhost
:${APTHTTPPORT}"
104 msgmsg 'proxy basic auth to server'
106 webserverconfig 'aptwebserver::authorization' ''
107 testauthsuccess "http
://localhost
:${APTHTTPPORT}"