]>
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
13 changetohttpswebserver --authorization="$(printf '%s' 'star@irc:hunter2' | base64 )"
15 echo 'See, when YOU type hunter2, it shows to us as *******' > aptarchive/bash
18 testfailure apthelper download-file "${1}/bash
" ./downloaded/bash
19 # crappy test, but http and https output are wastely different…
20 testsuccess grep 401 rootdir/tmp/testfailure.output
21 testfailure test -s ./downloaded/bash
25 testsuccess apthelper download-file "${1}/bash
" ./downloaded/bash
26 testfileequal ./downloaded/bash "$(cat aptarchive/bash)"
27 testfilestats ./downloaded/bash '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
28 rm -f ./downloaded/bash
30 # lets see if got/retains acceptable permissions
31 if [ -n "$AUTHCONF" ]; then
32 if [ "$(id -u)" = '0' ]; then
33 testfilestats "$AUTHCONF" '%U:%G:%a' '=' "_apt
:$(id -gn):600"
35 testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:600"
39 rm -rf rootdir/var/lib/apt/lists
40 testsuccess aptget update
41 testsuccessequal 'Reading package lists...
42 Building dependency tree...
43 The following NEW packages will be installed:
45 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
46 Inst foo (1 unstable [all])
47 Conf foo (1 unstable [all])' aptget install foo -s
51 local AUTHCONF='rootdir/etc/apt/auth.conf'
53 printf '%s' "$1" > "$AUTHCONF"
63 authfile 'machine localhost
69 authfile 'machine localhost
74 # 2 stanzas: unmatching + good auth
75 authfile 'machine debian.org
85 msgmsg 'server basic auth'
86 rewritesourceslist "http
://localhost
:${APTHTTPPORT}"
87 runtest "http
://localhost
:${APTHTTPPORT}"
88 rewritesourceslist "http
://star
%40irc
:hunter2@localhost
:${APTHTTPPORT}"
90 testauthsuccess "http
://star
%40irc
:hunter2@localhost
:${APTHTTPPORT}"
91 rewritesourceslist "https
://localhost
:${APTHTTPSPORT}"
92 runtest "https
://localhost
:${APTHTTPSPORT}"
93 rewritesourceslist "http
://localhost
:${APTHTTPPORT}"
95 msgmsg 'proxy to server basic auth'
96 webserverconfig 'aptwebserver::request::absolute' 'uri'
97 export http_proxy="http
://localhost
:${APTHTTPPORT}"
98 runtest "http
://localhost
:${APTHTTPPORT}"
101 msgmsg 'proxy basic auth to server basic auth'
102 webserverconfig 'aptwebserver::proxy-authorization' "$(printf 'moon:deer2' | base64)"
103 export http_proxy="http
://moon
:deer2@localhost
:${APTHTTPPORT}"
104 runtest "http
://localhost
:${APTHTTPPORT}"
106 msgmsg 'proxy basic auth to server'
108 webserverconfig 'aptwebserver::authorization' ''
109 testauthsuccess "http
://localhost
:${APTHTTPPORT}"