Skip to content

Commit 5797e9d

Browse files
authored
tests: fixed CI.
1 parent 5246add commit 5797e9d

File tree

5 files changed

+112
-13
lines changed

5 files changed

+112
-13
lines changed

‎.travis.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ env:
4141
- NGX_BUILD_JOBS=$JOBS
4242
- TEST_NGINX_SLEEP=0.006
4343
matrix:
44-
- NGINX_VERSION=1.29.2 OPENSSL_VER=3.5.4
44+
- NGINX_VERSION=1.29.2 OPENSSL_VER=3.5.4 OPENSSL_PATCH_VER=3.5.4
4545

4646
services:
4747
- memcache
@@ -54,8 +54,8 @@ before_install:
5454
- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends openresty-pcre2 openresty-openssl3 openresty-pcre2-dev openresty-openssl3-dev
5555

5656
install:
57-
- if [ ! -f download-cache/pcre2-$PCRE2_VER.tar.gz ]; then wget -P download-cache https://downloads.sourceforge.net/project/pcre/pcre2/${PCRE2_VER}/pcre2-${PCRE2_VER}.tar.gz; fi
58-
- if [ ! -f download-cache/openssl-$OPENSSL_VER.tar.gz ]; then wget -P download-cache https://www.openssl.org/source/openssl-$OPENSSL_VER.tar.gz; fi
57+
- if [ -n "$PCRE2_VER" ] && [ ! -f download-cache/pcre2-$PCRE2_VER.tar.gz ]; then wget -P download-cache https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE2_VER}/pcre2-${PCRE2_VER}.tar.gz; fi
58+
- if [ -n "$OPENSSL_VER" ] && [ ! -f download-cache/openssl-$OPENSSL_VER.tar.gz ]; then wget -P download-cache https://github.com/openssl/openssl/releases/download/openssl-$OPENSSL_VER/openssl-$OPENSSL_VER.tar.gz || wget -P download-cache https://www.openssl.org/source/openssl-$OPENSSL_VER.tar.gz || wget -P download-cache https://www.openssl.org/source/old/${OPENSSL_VER//[a-z]/}/openssl-$OPENSSL_VER.tar.gz; fi
5959
- git clone https://github.com/openresty/openresty-devel-utils.git
6060
- git clone https://github.com/openresty/lua-cjson.git
6161
- git clone https://github.com/openresty/openresty.git ../openresty
@@ -78,14 +78,14 @@ script:
7878
- sudo ip addr add 10.254.254.1/24 dev lo
7979
- sudo ip addr add 10.254.254.2/24 dev lo
8080
- sudo ip route add prohibit 0.0.0.1/32
81-
- tar zxf download-cache/pcre2-$PCRE2_VER.tar.gz; cd pcre2-$PCRE2_VER/; ./configure --prefix=$PCRE2_PREFIX --enable-jit --enable-utf > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1); cd ..;
81+
- if [ -n "$PCRE2_VER" ]; then tar zxf download-cache/pcre2-$PCRE2_VER.tar.gz; cd pcre2-$PCRE2_VER/; ./configure --prefix=$PCRE2_PREFIX --enable-jit --enable-utf > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1); cd ..; fi
8282
- cd luajit2
8383
- make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' > build.log 2>&1 || (cat build.log && exit 1)
8484
- sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1)
8585
- cd ../test-nginx && sudo cpanm . && cd ..
8686
- cd lua-cjson/ && make -j$JOBS && sudo make install && cd ..
8787
- cd mockeagain/ && make CC=$CC -j$JOBS && cd ..
88-
- tar zxf download-cache/openssl-$OPENSSL_VER.tar.gz; cd openssl-$OPENSSL_VER/; ./config no-threads shared enable-ssl3 enable-ssl3-method -g --prefix=$OPENSSL_PREFIX -DPURIFY > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1) ; cd ..
88+
- if [ -n "$OPENSSL_VER" ]; then tar zxf download-cache/openssl-$OPENSSL_VER.tar.gz; cd openssl-$OPENSSL_VER/; patch -p1 < ../../openresty/patches/openssl-$OPENSSL_PATCH_VER-sess_set_get_cb_yield.patch; ./config shared enable-ssl3 enable-ssl3-method -g --prefix=$OPENSSL_PREFIX --libdir=lib -DPURIFY > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1); cd ..; fi
8989
- export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
9090
- export NGX_BUILD_CC=$CC
9191
- sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1)

‎src/ngx_stream_lua_proxy_ssl_verifyby.c‎

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,20 @@ ngx_int_t
3232
ngx_stream_lua_proxy_ssl_verify_set_callback(ngx_conf_t *cf)
3333
{
3434

35-
#ifdef LIBRESSL_VERSION_NUMBER
35+
#if defined(LIBRESSL_VERSION_NUMBER)
3636

3737
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
3838
"LibreSSL does not support by proxy_ssl_verify_by_lua*");
3939

4040
return NGX_ERROR;
4141

42+
#elif defined(OPENSSL_IS_BORINGSSL)
43+
44+
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
45+
"BoringSSL does not support by proxy_ssl_verify_by_lua*");
46+
47+
return NGX_ERROR;
48+
4249
#else
4350

4451
ngx_flag_t proxy_ssl = 0;
@@ -161,6 +168,22 @@ char *
161168
ngx_stream_lua_proxy_ssl_verify_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,
162169
void *conf)
163170
{
171+
#if defined(LIBRESSL_VERSION_NUMBER)
172+
173+
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
174+
"LibreSSL does not support by proxy_ssl_verify_by_lua*");
175+
176+
return NGX_CONF_ERROR;
177+
178+
#elif defined(OPENSSL_IS_BORINGSSL)
179+
180+
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
181+
"BoringSSL does not support by proxy_ssl_verify_by_lua*");
182+
183+
return NGX_CONF_ERROR;
184+
185+
#else
186+
164187
#if (!defined SSL_ERROR_WANT_RETRY_VERIFY \
165188
|| OPENSSL_VERSION_NUMBER < 0x30000020L)
166189

@@ -244,12 +267,30 @@ ngx_stream_lua_proxy_ssl_verify_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,
244267
return NGX_CONF_OK;
245268

246269
#endif /* SSL_ERROR_WANT_RETRY_VERIFY */
270+
271+
#endif
247272
}
248273

249274

250275
int
251276
ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg)
252277
{
278+
#if defined(LIBRESSL_VERSION_NUMBER)
279+
280+
ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0,
281+
"LibreSSL does not support by proxy_ssl_verify_by_lua*");
282+
283+
return 1;
284+
285+
#elif defined(OPENSSL_IS_BORINGSSL)
286+
287+
ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0,
288+
"BoringSSL does not support by proxy_ssl_verify_by_lua*");
289+
290+
return 1;
291+
292+
#else
293+
253294
lua_State *L;
254295
ngx_int_t rc;
255296
ngx_connection_t *c;
@@ -395,6 +436,8 @@ ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg)
395436

396437
return 0; /* verify failure or error */
397438
#endif
439+
440+
#endif
398441
}
399442

400443

@@ -573,6 +616,20 @@ int
573616
ngx_stream_lua_ffi_proxy_ssl_set_verify_result(ngx_stream_lua_request_t *r,
574617
int verify_result, char **err)
575618
{
619+
#if defined(LIBRESSL_VERSION_NUMBER)
620+
621+
*err = "LibreSSL does not support this function";
622+
623+
return NGX_ERROR;
624+
625+
#elif defined(OPENSSL_IS_BORINGSSL)
626+
627+
*err = "BoringSSL does not support this function";
628+
629+
return NGX_ERROR;
630+
631+
#else
632+
576633
#ifdef SSL_ERROR_WANT_RETRY_VERIFY
577634
ngx_stream_upstream_t *u;
578635
ngx_ssl_conn_t *ssl_conn;
@@ -618,13 +675,29 @@ ngx_stream_lua_ffi_proxy_ssl_set_verify_result(ngx_stream_lua_request_t *r,
618675

619676
return NGX_ERROR;
620677
#endif
678+
679+
#endif
621680
}
622681

623682

624683
int
625684
ngx_stream_lua_ffi_proxy_ssl_get_verify_result(ngx_stream_lua_request_t *r,
626685
char **err)
627686
{
687+
#if defined(LIBRESSL_VERSION_NUMBER)
688+
689+
*err = "LibreSSL does not support this function";
690+
691+
return NGX_ERROR;
692+
693+
#elif defined(OPENSSL_IS_BORINGSSL)
694+
695+
*err = "BoringSSL does not support this function";
696+
697+
return NGX_ERROR;
698+
699+
#else
700+
628701
#ifdef SSL_ERROR_WANT_RETRY_VERIFY
629702
ngx_stream_upstream_t *u;
630703
ngx_ssl_conn_t *ssl_conn;
@@ -668,6 +741,8 @@ ngx_stream_lua_ffi_proxy_ssl_get_verify_result(ngx_stream_lua_request_t *r,
668741

669742
return NGX_ERROR;
670743
#endif
744+
745+
#endif
671746
}
672747

673748

@@ -684,6 +759,20 @@ void *
684759
ngx_stream_lua_ffi_proxy_ssl_get_verify_cert(ngx_stream_lua_request_t *r,
685760
char **err)
686761
{
762+
#if defined(LIBRESSL_VERSION_NUMBER)
763+
764+
*err = "LibreSSL does not support this function";
765+
766+
return NGX_ERROR;
767+
768+
#elif defined(OPENSSL_IS_BORINGSSL)
769+
770+
*err = "BoringSSL does not support this function";
771+
772+
return NGX_ERROR;
773+
774+
#else
775+
687776
#ifdef SSL_ERROR_WANT_RETRY_VERIFY
688777
ngx_stream_upstream_t *u;
689778
ngx_ssl_conn_t *ssl_conn;
@@ -735,6 +824,8 @@ ngx_stream_lua_ffi_proxy_ssl_get_verify_cert(ngx_stream_lua_request_t *r,
735824

736825
return NULL;
737826
#endif
827+
828+
#endif
738829
}
739830

740831

‎src/ngx_stream_lua_ssl_client_helloby.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ ngx_stream_lua_ssl_client_hello_handler(ngx_ssl_conn_t *ssl_conn,
218218
return -1;
219219
}
220220

221-
#if (nginx_version > 1029000)
221+
#if (nginx_version > 1029001)
222222
/* see commit 0373fe5d98c1515640 for more details */
223223
rc = ngx_ssl_client_hello_callback(ssl_conn, al, arg);
224224

‎t/138-balancer.t‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ retry counter: 5
237237
238238
--- error_log
239239
set more tries: reduced tries due to limit
240-
--- ONLY
241240
242241
243242

‎t/164-proxy-ssl-verify-by.t‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ repeat_each(3);
77
my $NginxBinary = $ENV{'TEST_NGINX_BINARY'} || 'nginx';
88
my $openssl_version = eval { `$NginxBinary -V 2>&1` };
99

10-
if ($openssl_version =~ m/built with OpenSSL (0\S*|1\.0\S*|1\.1\.0\S*)/) {
11-
plan(skip_all => "too old OpenSSL, need 1.1.1, was $1");
10+
if ($openssl_version =~ m/built with OpenSSL (\d+)\.(\d+)\.(\d+)/) {
11+
my ($major, $minor, $patch) = ($1, $2, $3);
12+
13+
if ($major < 3 || ($major == 3 && $minor == 0 && $patch < 2)) {
14+
plan(skip_all => "too old OpenSSL, need >= 3.0.2, was " .
15+
"$major.$minor.$patch");
16+
} else {
17+
plan tests => repeat_each() * (blocks() * 6 + 3);
18+
}
19+
} elsif ($openssl_version =~ m/running with BoringSSL/) {
20+
plan(skip_all => "does not support BoringSSL");
1221
} else {
13-
plan tests => repeat_each() * (blocks() * 6 + 5);
22+
die "unknown SSL";
1423
}
1524

1625
$ENV{TEST_NGINX_HTML_DIR} ||= html_dir();
@@ -908,7 +917,7 @@ proxy_ssl_verify_by_lua: cert verify callback aborted
908917
=== TEST 23: cosocket
909918
--- stream_config
910919
server {
911-
listen *:80;
920+
listen 127.0.0.1:$TEST_NGINX_RAND_PORT_1;
912921
913922
return "it works!\n";
914923
}
@@ -936,7 +945,7 @@ proxy_ssl_verify_by_lua: cert verify callback aborted
936945
local sock = ngx.socket.tcp()
937946
sock:settimeout(2000)
938947
939-
local ok, err = sock:connect("127.0.0.1", "80")
948+
local ok, err = sock:connect("127.0.0.1", $TEST_NGINX_RAND_PORT_1)
940949
if not ok then
941950
ngx.log(ngx.ERR, "failed to connect: ", err)
942951
return

0 commit comments

Comments
 (0)