source: mod_gnutls/test/test-19_TLS_reverse_proxy.bash @ 6e6a4e4

debian/masterdebian/stretch-backportsjessie-backportsupstream
Last change on this file since 6e6a4e4 was 6e6a4e4, checked in by Thomas Klute <thomas2.klute@…>, 4 years ago

Test case for TLS reverse proxy

This commit adds a simple test for a reverse proxy with TLS on both front end and
back end connections, with both Apache instances using mod_gnutls. The proxy
server checks the back end server's certificate.

A small whitespace issue in base_apache.conf has been found and fixed in the
process of writing the test case.

  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/bash
2
3set -e
4
5if [ -z "${BACKEND_HOST}" ]; then
6    export BACKEND_HOST="localhost"
7fi
8if [ -z "${BACKEND_IP}" ]; then
9    export BACKEND_IP="::1"
10fi
11if [ -z "${BACKEND_PORT}" ]; then
12    export BACKEND_PORT="9934"
13fi
14
15function backend_apache
16{
17    dir="${1}"
18    conf="${2}"
19    action="${3}"
20    lockfile="${4}"
21
22    if [ -n "${lockfile}" ]; then
23        flock_cmd="flock -w 10 ${lockfile}"
24    fi
25
26    TEST_NAME="$(basename "${dir}")"
27    (
28        export TEST_NAME
29        export TEST_IP="${BACKEND_IP}"
30        export TEST_PORT="${BACKEND_PORT}"
31        case $action in
32            start)
33                cd "${dir}"
34                ${flock_cmd} \
35                    /usr/sbin/apache2 -f "$(pwd)/${conf}" -k start || return 1
36                ;;
37            stop)
38                cd "${dir}"
39                /usr/sbin/apache2 -f "$(pwd)/${conf}" -k stop || return 1
40                ;;
41        esac
42    )
43}
44
45testdir="./tests/19_TLS_reverse_proxy"
46BACKEND_LOCK="$(realpath ${testdir}/backend.lock)"
47
48function stop_backend
49{
50    backend_apache "${dir}" "backend.conf" stop
51}
52backend_apache "${testdir}" "backend.conf" start "${BACKEND_LOCK}"
53trap stop_backend EXIT
54
55make -f TestMakefile t-19
56
57backend_apache "${testdir}" "backend.conf" stop
58trap - EXIT
Note: See TracBrowser for help on using the repository browser.