Skip to content

Commit 76bf725

Browse files
authored
Apache httpd integration test (#2614)
### Description of changes: Add Apache httpd integration test to our CI. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
1 parent 698202b commit 76bf725

File tree

3 files changed

+174
-0
lines changed

3 files changed

+174
-0
lines changed

.github/workflows/integrations.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,16 @@ jobs:
100100
- name: Build AWS-LC, build python, run tests
101101
run: |
102102
./tests/ci/integration/run_python_integration.sh 3.9
103+
apache-httpd:
104+
if: github.repository_owner == 'aws'
105+
runs-on: ubuntu-latest
106+
name: Apache httpd
107+
steps:
108+
- name: Install OS Dependencies
109+
run: |
110+
sudo apt update
111+
sudo apt install -y libpcre2-dev libnghttp2-dev nghttp2-client zlib1g-dev libtool-bin libxml2-dev pebble python3-venv
112+
- uses: actions/checkout@v4
113+
- name: Build AWS-LC, build httpd, run tests
114+
run: |
115+
./tests/ci/integration/run_httpd_integration.sh '2.4.65'
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 9c0cf55628322af2e5cb440884851caedbc43e6d Mon Sep 17 00:00:00 2001
2+
From: Justin W Smith <[email protected]>
3+
Date: Fri, 1 Aug 2025 14:31:04 +0000
4+
Subject: [PATCH] Support AWS-LC
5+
6+
---
7+
modules/ssl/ssl_engine_init.c | 4 ++--
8+
1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
11+
index 94cc2772e0..df2dc44ce0 100644
12+
--- a/modules/ssl/ssl_engine_init.c
13+
+++ b/modules/ssl/ssl_engine_init.c
14+
@@ -1358,7 +1358,7 @@ static int ssl_no_passwd_prompt_cb(char *buf, int size, int rwflag,
15+
* off the OpenSSL stack and evaluates to true only for the first
16+
* case. With OpenSSL < 3 the second case is identifiable by the
17+
* function code, but function codes are not used from 3.0. */
18+
-#if OPENSSL_VERSION_NUMBER < 0x30000000L
19+
+#if OPENSSL_VERSION_NUMBER < 0x30000000L && !defined(OPENSSL_IS_AWSLC)
20+
#define CHECK_PRIVKEY_ERROR(ec) (ERR_GET_FUNC(ec) != X509_F_X509_CHECK_PRIVATE_KEY)
21+
#else
22+
#define CHECK_PRIVKEY_ERROR(ec) (ERR_GET_LIB(ec) != ERR_LIB_X509 \
23+
@@ -1751,7 +1751,7 @@ static apr_status_t ssl_init_proxy_certs(server_rec *s,
24+
25+
ap_assert(store != NULL); /* safe to assume always non-NULL? */
26+
27+
-#if OPENSSL_VERSION_NUMBER >= 0x1010100fL && !defined(LIBRESSL_VERSION_NUMBER)
28+
+#if OPENSSL_VERSION_NUMBER >= 0x1010100fL && !defined(LIBRESSL_VERSION_NUMBER) && !defined(OPENSSL_IS_AWSLC)
29+
/* For OpenSSL >=1.1.1, turn on client cert support which is
30+
* otherwise turned off by default (by design).
31+
* https://github.com/openssl/openssl/issues/6933 */
32+
--
33+
2.43.0
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/usr/bin/env bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0 OR ISC
4+
5+
set -exu
6+
7+
source tests/ci/common_posix_setup.sh
8+
9+
# Set up environment.
10+
11+
# SYS_ROOT
12+
# |
13+
# - SRC_ROOT(aws-lc)
14+
# |
15+
# - SCRATCH_FOLDER
16+
# |
17+
# - httpd
18+
# - httpd-install
19+
# - aws-lc-build
20+
# - aws-lc-install
21+
22+
# Assumes script is executed from the root of aws-lc directory
23+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
24+
HTTPD_PATCH_FOLDER="${SCRIPT_DIR}/httpd_patch"
25+
26+
SCRATCH_FOLDER=${SYS_ROOT}/"SCRATCH-httpd-integ"
27+
HTTPD_SRC_FOLDER="${SCRATCH_FOLDER}/httpd"
28+
HTTPD_INSTALL_FOLDER="${SCRATCH_FOLDER}/httpd-install"
29+
AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build"
30+
AWS_LC_INSTALL_FOLDER="${SCRATCH_FOLDER}/aws-lc-install"
31+
32+
if [ $# -eq 0 ]; then
33+
# Use tag "2.4.65" if none specified
34+
HTTPD_TAGS=("2.4.65")
35+
else
36+
HTTPD_TAGS=("$@")
37+
fi
38+
39+
mkdir -p ${SCRATCH_FOLDER}
40+
rm -rf "${SCRATCH_FOLDER:?}"/*
41+
cd ${SCRATCH_FOLDER}
42+
43+
# Dependencies: Ubuntu
44+
if [ "$(id -u)" -eq 0 ]; then
45+
apt update
46+
apt install -y libpcre2-dev libnghttp2-dev nghttp2-client zlib1g-dev libtool-bin libxml2-dev pebble python3-venv
47+
fi
48+
49+
function run_httpd_test() {
50+
local HTTPD_TAG=$1
51+
echo "Running httpd integration test for tag: ${HTTPD_TAG}"
52+
53+
# Clean up previous build
54+
rm -rf "${HTTPD_SRC_FOLDER:?}" "${HTTPD_INSTALL_FOLDER:?}"
55+
mkdir -p "${HTTPD_INSTALL_FOLDER}"
56+
57+
# Clone httpd and APR
58+
git clone https://github.com/apache/httpd.git "${HTTPD_SRC_FOLDER}" --depth 1
59+
cd "${HTTPD_SRC_FOLDER}"
60+
git fetch --tags origin
61+
git checkout -b branch-for-${HTTPD_TAG} ${HTTPD_TAG}
62+
git clone https://github.com/apache/apr.git srclib/apr --depth 1
63+
64+
# Build httpd from source
65+
pushd "${HTTPD_SRC_FOLDER}"
66+
httpd_patch
67+
httpd_build
68+
69+
# Ensure httpd is linked to AWS-LC
70+
nm --defined-only "${HTTPD_INSTALL_FOLDER}/bin/httpd" | grep -q awslc_version_string
71+
72+
# Setup Python environment and run tests
73+
setup_python_env
74+
httpd_run_tests
75+
popd
76+
77+
cd ${SCRATCH_FOLDER}
78+
}
79+
80+
function httpd_patch() {
81+
# if the directory exists
82+
if [ -d "${HTTPD_PATCH_FOLDER}/${HTTPD_TAG}" ]; then
83+
patch -p1 --quiet -i "${HTTPD_PATCH_FOLDER}/${HTTPD_TAG}"/*
84+
else
85+
echo "No patches found for httpd tag: '${HTTPD_TAG}'"
86+
fi
87+
}
88+
89+
function httpd_build() {
90+
./buildconf
91+
./configure \
92+
"CFLAGS=-I/usr/include/libxml2" \
93+
--prefix="${HTTPD_INSTALL_FOLDER}" \
94+
--with-included-apr \
95+
--with-ssl="${AWS_LC_INSTALL_FOLDER}" \
96+
--enable-mpms-shared="all" \
97+
--enable-mods-shared="most" \
98+
--with-libxml2=/usr \
99+
--enable-mods-static="access_compat actions alias asis authn_core authz_core autoindex cgi deflate dir env expires filter headers include log_config mime negotiation proxy proxy_http proxy_http2 remoteip rewrite setenvif slotmem_shm ssl status unixd version"
100+
make -j "$NUM_CPU_THREADS"
101+
make install
102+
}
103+
104+
function setup_python_env() {
105+
python3 -m venv venv
106+
source venv/bin/activate
107+
python3 -m pip install --upgrade pip
108+
python3 -m pip install pyopenssl websockets pytest filelock python-multipart
109+
}
110+
111+
function httpd_run_tests() {
112+
source venv/bin/activate
113+
# Disabled tests:
114+
# * Tests relating to TLS renegotiation -- This feature is disabled by default in AWS-LC.
115+
# * Tests relating to mod_md -- not built
116+
# * "test_h2_106_02" had intermittent failures
117+
# -- The test ignores exit status 55 (CURL_SEND_ERROR), but fails when it's 56 (CURL_RECV_ERROR). It should ignore both.
118+
# There seems to be a subtle behavioral difference here between OpenSSL and AWS-LC.
119+
python3 -m pytest test -k "not TestSslRenegotiation and not test_md_ and not test_h2_106_02"
120+
}
121+
122+
# Static build for AWS-LC
123+
aws_lc_build "$SRC_ROOT" "$AWS_LC_BUILD_FOLDER" "$AWS_LC_INSTALL_FOLDER" -DBUILD_TESTING=OFF -DBUILD_TOOL=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=0
124+
125+
# Run tests for each tag
126+
for HTTPD_TAG in "${HTTPD_TAGS[@]}"; do
127+
run_httpd_test "$HTTPD_TAG"
128+
done

0 commit comments

Comments
 (0)