5 # Copyright (C) 2013 Simon Ruderich
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 test "x$srcdir" = x && srcdir=.
25 # Create necessary files.
29 echo 'dXNlcm5hbWU6cGFzc3dvcmQ=' > digest-authentication
30 tlsproxy -a digest-authentication 4711
31 server --x509certfile "$srcdir/server.pem" \
32 --x509keyfile "$srcdir/server-key.pem"
33 wait_for_ports 4711 4712
34 rm -f digest-authentication
36 echo missing authentication 1
37 client localhost 4712 invalid \
38 && abort 'client localhost 4712 invalid'
39 test_proxy_authentication_failure
41 # Create the proxy certificate.
42 tlsproxy_add localhost server.pem
44 echo missing authentication 2
45 client localhost 4712 localhost \
46 && abort 'client localhost 4712 localhost'
47 test_proxy_authentication_failure
49 echo invalid authentication 1
50 client localhost 4712 localhost 'username:password' \
51 && abort 'client localhost 4712 localhost username:password'
52 test_proxy_authentication_failure
54 echo invalid authentication 2
55 client localhost 4712 localhost 'dXNlcm5hbWU6cGFzc3dvcmQ' \
56 && abort 'client localhost 4712 localhost dXNlcm5hbWU6cGFzc3dvcmQ'
57 test_proxy_authentication_failure
59 echo invalid authentication 3
60 client localhost 4712 localhost 'dXNlcm5hbWU6cGFzc3dvcmQ=X' \
61 && abort 'client localhost 4712 localhost dXNlcm5hbWU6cGFzc3dvcmQ=X'
62 test_proxy_authentication_failure
64 echo valid authentication
65 client localhost 4712 localhost 'dXNlcm5hbWU6cGFzc3dvcmQ=' \
66 || abort 'client localhost 4712 localhost dXNlcm5hbWU6cGFzc3dvcmQ='
69 echo valid authentication with invalid certificate
70 tlsproxy_add localhost server-bad.pem
71 client localhost 4712 localhost 'dXNlcm5hbWU6cGFzc3dvcmQ=' \
72 && abort 'client localhost 4712 invalid dXNlcm5hbWU6cGFzc3dvcmQ='
74 test_invalid_certificate
77 # stop_servers in trap-handler