Skip to content

Commit 88d2a97

Browse files
author
Stefan Eissing
committed
* Added Docker support for setting up an images based on debian sid,
build current apache 2.4.x patch, current crustls PR branch and the local mod_tls sources and have the test suite run in the image.
1 parent 54569b4 commit 88d2a97

File tree

8 files changed

+151
-3
lines changed

8 files changed

+151
-3
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DOCKER_REGISTRY=docker-registry.greenbytes.de

ChangeLog

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* Added Docker support for setting up an images based on debian sid,
2+
build current apache 2.4.x patch, current crustls PR branch and the
3+
local mod_tls sources and have the test suite run in the image.
14
* Updated documentation on protocol version/cipher configuring.
25
* Changed numerical names to include `0x`, for example `TLS_CIPHER_0xc024`,
36
to avoid ambiguities.

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ Run the usual autoconf/automake magic incantations.
5454
> make
5555
```
5656

57+
### Docker Test Image
58+
59+
There is now support for building a Docker image based on `debian sid` to run the test suite in.
60+
61+
```
62+
> cd mod_tls
63+
> docker-compose build debian-test
64+
> docker-compose run debian-test
65+
```
66+
67+
This clone the git repository from `apache` and `crustls`, switched to the necessary branches and builds a copy of the local `mod_tls` sources. If you want to setup your own build, you'll find the instructions in `docker/debian-test/bin/update.sh`.
68+
5769
## Tests
5870

5971
### Functional Tests

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515

1616
AC_PREREQ([2.69])
17-
AC_INIT([mod_md], [0.1.0], [[email protected]])
17+
AC_INIT([mod_tls], [0.1.0], [[email protected]])
1818

1919
LT_PREREQ([2.2.6])
2020
LT_INIT()

docker-compose.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3.7'
2+
services:
3+
debian-test:
4+
# build and run tests in a debian sid container
5+
image: ${DOCKER_REGISTRY}/mod-tls-debian-test:0.0.1
6+
container_name: mod-tls-debian-test
7+
build:
8+
context: .
9+
dockerfile: docker/debian-test/Dockerfile
10+
labels:
11+
- "description=mod_tls debian test server"
12+
13+
expose:
14+
- "5010"
15+
- "5011"
16+
volumes:
17+
- mod-tls-debian-test-data:/abetterinternet/data
18+
ports:
19+
- "5010"
20+
- "5011"
21+
22+
volumes:
23+
mod-tls-debian-test-data:
24+
name: mod-tls-debian-test-data
25+
labels:
26+
- "description=debian test data for mod_tls"
27+
28+

docker/debian-test/Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM debian:sid
2+
3+
RUN apt-get update; apt-get upgrade -y
4+
RUN apt-get install -y apt-listchanges \
5+
make openssl libssl-dev libcurl4 libcurl4-openssl-dev \
6+
gcc subversion git cargo python3 \
7+
libapr1-dev libaprutil1-dev libnghttp2-dev pip
8+
9+
RUN pip install pytest tqdm pycurl
10+
11+
RUN apt-get install -y autoconf libtool libtool-bin
12+
RUN apt-get install -y libpcre3-dev libjansson-dev
13+
RUN apt-get install -y curl rsync
14+
15+
RUN pip install cryptography
16+
17+
COPY docker/debian-test/bin/* /abetterinternet/bin/
18+
COPY configure.ac Makefile.am NEWS README* AUTHORS ChangeLog COPYING LICENSE /abetterinternet/mod_tls/
19+
COPY src /abetterinternet/mod_tls/src
20+
COPY test test/Makefile.am test/test.ini.in /abetterinternet/mod_tls/test
21+
COPY m4 /abetterinternet/mod_tls/m4
22+
23+
CMD ["/bin/bash", "-c", "/abetterinternet/bin/update.sh"]

docker/debian-test/bin/update.sh

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
TOP=/abetterinternet
4+
DATADIR=$TOP/data
5+
6+
fail() {
7+
echo "$@"
8+
exit 1
9+
}
10+
11+
needs_update() {
12+
local ref_file="$1"
13+
local check_dir="$2"
14+
if test ! -f "$ref_file"; then
15+
return 0
16+
fi
17+
find "$check_dir" -type f -a -newer "$ref_file" -o -type d -name .git -prune -a -false |
18+
while read fname; do
19+
return 0
20+
done
21+
return 1
22+
}
23+
24+
cd $DATADIR
25+
if test ! -f rustup.sh.run; then
26+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup.sh ||rm -f rustup.sh
27+
/bin/bash rustup.sh -y ||fail
28+
touch rustup.sh.run
29+
fi
30+
31+
if test ! -d httpd; then
32+
git clone https://github.com/icing/httpd.git httpd ||fail
33+
fi
34+
cd httpd
35+
if test ! -d srclib/apr; then
36+
svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr
37+
fi
38+
git fetch origin icing/2.4.x-ap_ssl_things ||fail
39+
git checkout icing/2.4.x-ap_ssl_things ||fail
40+
if needs_update $DATADIR/apache2/.installed .; then
41+
rm -f $DATADIR/apache2/.installed
42+
./buildconf ||fail
43+
./configure --prefix=$DATADIR/apache2 --with-included-apr \
44+
--enable-mpms-shared=event --enable-ssl --enable-http2 \
45+
--enable-cgi --enable-md ||fail
46+
make install ||fail
47+
touch $DATADIR/apache2/.installed
48+
fi
49+
50+
51+
cd $DATADIR
52+
if test ! -d crustls; then
53+
git clone https://github.com/abetterinternet/crustls.git crustls
54+
fi
55+
cd crustls
56+
git fetch origin list-ciphersuites
57+
git checkout list-ciphersuites
58+
if needs_update $DATADIR/apache2/.crustls-installed .; then
59+
rm -f $DATADIR/apache2/.crustls-installed
60+
touch src/crustls.h ||fail "missing src/crustls.h"
61+
make install DESTDIR=$DATADIR/apache2 ||fail
62+
touch $DATADIR/apache2/.crustls-installed
63+
fi
64+
65+
cd "$TOP/mod_tls" ||fail
66+
if needs_update .installed .; then
67+
rm -f .installed
68+
if test ! -f configure -o configure.ac -nt configure; then
69+
autoreconf -i ||fail
70+
fi
71+
if test ! -d Makefile -o ./configure -nt Makefile; then
72+
./configure --with-apxs=$DATADIR/apache2/bin/apxs ||fail
73+
touch ./configure
74+
fi
75+
make clean||fail
76+
make ||fail
77+
find .
78+
make install ||fail
79+
touch .installed
80+
fi
81+
make test

test/test_env.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ def __init__(self):
148148
self._http_port = int(config.get('global', 'http_port'))
149149
self._https_port = int(config.get('global', 'https_port'))
150150

151-
self._http_base = "http://localhost:{port}".format(port=self._http_port)
151+
self._http_base = "http://127.0.0.1:{port}".format(port=self._http_port)
152152
self._httpd_check_url = self._http_base
153-
self._https_base = "https://localhost:{port}".format(port=self._https_port)
153+
self._https_base = "https://127.0.0.1:{port}".format(port=self._https_port)
154154

155155
self._curl = config.get('global', 'curl_bin')
156156
if self._curl is None or len(self._curl) == 0:

0 commit comments

Comments
 (0)