Skip to content

Commit 5f65a43

Browse files
committed
Merging PR 4, github workflow on linux
Add a workflow testing mod_tls with rustls-ffi v0.14.1 and the main branch. Use crypt provider ring only, until we get the aws-lc-rs provider also working here. Adjusted test code to work with apache2 on ubuntu-latest.
1 parent e9a7849 commit 5f65a43

File tree

11 files changed

+327
-84
lines changed

11 files changed

+327
-84
lines changed

.github/workflows/linux.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Copyright 2025 Stefan Eissing (https://dev-icing.de)
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
name: Linux
17+
18+
'on':
19+
push:
20+
branches:
21+
- master
22+
- '*/ci'
23+
paths-ignore:
24+
- '**/*.md'
25+
pull_request:
26+
branches:
27+
- master
28+
paths-ignore:
29+
- '**/*.md'
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
33+
cancel-in-progress: true
34+
35+
permissions: {}
36+
37+
env:
38+
MARGS: "-j5"
39+
CFLAGS: "-g"
40+
41+
jobs:
42+
linux:
43+
name: ${{ matrix.build.name }} (rustls-ffi ${{matrix.rustls-version}} ${{ matrix.crypto }} ${{matrix.rust}})
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 30
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
rust:
50+
- stable
51+
- nightly
52+
crypto:
53+
- ring
54+
# aws-lc-sys v0.21.1 is not building due to compiler warnings
55+
# - aws-lc-rs
56+
rustls-version:
57+
- v0.14.1
58+
- main
59+
build:
60+
- name: mod_tls
61+
install_packages:
62+
63+
steps:
64+
- name: 'install prereqs'
65+
run: |
66+
sudo apt-get update -y
67+
sudo apt-get install -y --no-install-suggests --no-install-recommends \
68+
libtool autoconf automake pkgconf cmake apache2 apache2-dev openssl \
69+
curl nghttp2-client libssl-dev \
70+
${{ matrix.build.install_packages }}
71+
python3 -m venv $HOME/venv
72+
73+
- uses: actions/checkout@v4
74+
75+
- name: Install ${{ matrix.rust }} toolchain
76+
uses: dtolnay/rust-toolchain@master
77+
with:
78+
toolchain: ${{ matrix.rust }}
79+
80+
- name: 'checkout rustls-ffi'
81+
run: |
82+
cd $HOME/
83+
git clone --quiet --depth=1 -b ${{ matrix.rustls-version }} --recursive https://github.com/rustls/rustls-ffi.git
84+
85+
- name: 'build rustls-ffi (Makefile)'
86+
if: matrix.rustls-version != 'main'
87+
run: |
88+
cd $HOME/rustls-ffi
89+
make DESTDIR=$HOME/rustls-ffi/build/rust CRYPTO_PROVIDER=${{ matrix.crypto }} install
90+
91+
- name: Install cargo-c
92+
if: matrix.rustls-version == 'main'
93+
env:
94+
# Version picked for MSRV compat.
95+
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download/
96+
CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz
97+
run: |
98+
curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin
99+
100+
- name: 'build rustls-ffi (cmake)'
101+
if: matrix.rustls-version == 'main'
102+
run: |
103+
cd $HOME/rustls-ffi
104+
cmake \
105+
-DCRYPTO_PROVIDER=${{matrix.crypto}} \
106+
-DDYN_LINK=on \
107+
-DCMAKE_BUILD_TYPE=Release \
108+
-S librustls -B build
109+
cmake --build build --config "Release"
110+
111+
- name: 'install test prereqs'
112+
run: |
113+
[ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
114+
python3 -m pip install -r test/requirements.txt
115+
116+
- name: 'configure'
117+
run: |
118+
autoreconf -fi
119+
./configure --enable-werror --with-rustls=$HOME/rustls-ffi/build/rust
120+
121+
- name: 'build'
122+
run: make V=1
123+
124+
- name: pytest
125+
env:
126+
PYTEST_ADDOPTS: "--color=yes"
127+
run: |
128+
[ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
129+
pytest -v

configure.ac

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -181,24 +181,43 @@ CPPFLAGS="-I$($APXS -q includedir) -I$($APXS -q APR_INCLUDEDIR) $($APXS -q EXTRA
181181
HTTPD_VERSION="$($APXS -q HTTPD_VERSION)"
182182
AC_SUBST(HTTPD_VERSION)
183183

184-
APACHECTL="$sbindir/apachectl"
185-
if test ! -x "$APACHECTL"; then
186-
# rogue distros rename things! =)
187-
APACHECTL="$sbindir/apache2ctl"
184+
HTTPD="$sbindir/httpd"
185+
if test -x "$HTTPD"; then
186+
: # all fine
187+
else
188+
HTTPD="$sbindir/apache2"
189+
if test -x "$HTTPD"; then
190+
: # all fine
191+
else
192+
HTTPD=""
193+
AC_PATH_PROG([HTTPD], [httpd])
194+
if test -x "$HTTPD"; then
195+
: # ok
196+
else
197+
HTTPD=""
198+
AC_PATH_PROG([HTTPD], [apache2])
199+
if test -x "$HTTPD"; then
200+
: # ok
201+
else
202+
AC_MSG_ERROR([httpd/apache2 not in PATH])
203+
fi
204+
fi
205+
fi
188206
fi
189-
AC_SUBST(APACHECTL)
190207

191-
if test -x "$APACHECTL"; then
192-
DSO_MODULES="$($APACHECTL -t -D DUMP_MODULES | fgrep '(shared)'| sed 's/_module.*//g'|tr -d \\n)"
208+
if test -x "$HTTPD"; then
209+
DSO_MODULES="$($HTTPD -t -D DUMP_MODULES | fgrep '(shared)'| sed 's/_module.*//g'|tr -d \\n)"
193210
AC_SUBST(DSO_MODULES)
194-
STATIC_MODULES="$($APACHECTL -t -D DUMP_MODULES | fgrep '(static)'| sed 's/_module.*//g'|tr -d \\n)"
211+
STATIC_MODULES="$($HTTPD -t -D DUMP_MODULES | fgrep '(static)'| sed 's/_module.*//g'|tr -d \\n)"
195212
AC_SUBST(STATIC_MODULES)
196213
MPM_MODULES="mpm_event mpm_worker"
197214
AC_SUBST(MPM_MODULES)
198215
else
199-
AC_MSG_WARN("apachectl not found in '$BINDIR', test suite will not work!")
200-
APACHECTL=""
216+
AC_MSG_WARN("httpd/apache2 not found, test suite will not work!")
217+
HTTPD=""
201218
fi
219+
AC_SUBST(HTTPD)
220+
202221
AC_SUBST(LOAD_LOG_CONFIG)
203222
AC_SUBST(LOAD_LOGIO)
204223
AC_SUBST(LOAD_UNIXD)
@@ -208,18 +227,18 @@ AC_SUBST(LOAD_WATCHDOG)
208227
export BUILD_SUBDIRS="src"
209228

210229
if test x"$request_rustls" != "xcheck"; then
211-
LDFLAGS="$LDFLAGS -L$request_rustls/lib";
230+
LDFLAGS="$LDFLAGS -L$request_rustls/lib -Wl,-rpath,$request_rustls/lib";
212231
CFLAGS="$CFLAGS -I$request_rustls/include";
213232
CPPFLAGS="$CPPFLAGS -I$request_rustls/include";
214233
fi
215234

216235
# Need some additional things for rustls linkage. This seems platform specific.
217236
if test $(uname) = "Darwin"; then
218-
CRUSTLS_LDFLAGS="-Wl,-dead_strip -framework Security -framework Foundation"
237+
RUSTLS_LDFLAGS="-Wl,-dead_strip -framework Security -framework Foundation"
219238
else
220-
CRUSTLS_LDFLAGS="-Wl,--gc-sections -lpthread -ldl"
239+
RUSTLS_LDFLAGS="-Wl,--gc-sections -lpthread -ldl"
221240
fi
222-
LDFLAGS="$LDFLAGS $CRUSTLS_LDFLAGS"
241+
LDFLAGS="$LDFLAGS $RUSTLS_LDFLAGS"
223242

224243
# verify that we can link rustls now
225244
# commented: problem running on debian
@@ -296,6 +315,7 @@ AC_MSG_NOTICE([summary of build options:
296315
Install prefix: ${prefix}
297316
APXS: ${APXS}
298317
HTTPD-VERSION: ${HTTPD_VERSION}
318+
HTTPD: ${HTTPD}
299319
C compiler: ${CC} ${COMPILER_VERSION}
300320
CFLAGS: ${CFLAGS}
301321
WARNCFLAGS: ${WERROR_CFLAGS}

test/modules/tls/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
from .env import TlsTestEnv
99

1010

11-
def pytest_report_header(config, startdir):
11+
def pytest_report_header(config):
1212
_x = config
13-
_x = startdir
1413
env = TlsTestEnv()
1514
return "mod_tls [apache: {aversion}({prefix})]".format(
1615
prefix=env.prefix,

test/modules/tls/env.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,8 @@ def __init__(self, env: 'HttpdTestEnv'):
2020
super().__init__(env=env)
2121
self.add_source_dir(os.path.dirname(inspect.getfile(TlsTestSetup)))
2222
self.add_modules(["http2", "cgid", "watchdog", "proxy_http2", "ssl"])
23+
self.add_local_module("tls", "src/.libs/mod_tls.so")
2324

24-
def make(self):
25-
super().make()
26-
self._add_mod_tls()
27-
28-
def _add_mod_tls(self):
29-
modules_conf = os.path.join(self.env.server_dir, 'conf/modules.conf')
30-
with open(modules_conf, 'a') as fd:
31-
# load our test module which is not installed
32-
fd.write(f"LoadModule tls_module \"{self.env.src_dir}/.libs/mod_tls.so\"\n")
3325

3426
class TlsCipher:
3527

0 commit comments

Comments
 (0)