Skip to content

Commit 68c2219

Browse files
committed
fix: ship stream upstream mTLS patch for all supported nginx versions
The set_upstream_ssl injection that actually presents the client cert during the upstream TLS handshake lived only in patch/1.29.2.4/. Every other runtime that has nginx-tcp_over_tls.patch (1.19.9, 1.21.4, 1.21.4.1, 1.25.3.1, 1.27.1.1) was missing it, so on those builds set_cert_and_key stored the cert but it was never applied -- the upstream rejected the handshake with "400 No required SSL certificate was sent". This was invisible until t/stream/upstream_mtls.t was added; it surfaced on the api7ee-runtime build (nginx 1.21.4). The injection point (before ngx_ssl_handshake in ngx_stream_proxy_ssl_init_connection) is identical across these versions, so the patch body is shared; patch -p0 applies it by context.
1 parent 150af10 commit 68c2219

5 files changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git src/stream/ngx_stream_proxy_module.c src/stream/ngx_stream_proxy_module.c
2+
--- src/stream/ngx_stream_proxy_module.c
3+
+++ src/stream/ngx_stream_proxy_module.c
4+
@@ -1219,7 +1219,11 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
5+
}
6+
7+
s->connection->log->action = "SSL handshaking to upstream";
8+
9+
+#if (NGX_STREAM_APISIX)
10+
+ ngx_stream_apisix_set_upstream_ssl(s, pc);
11+
+#endif
12+
+
13+
rc = ngx_ssl_handshake(pc);
14+
15+
if (rc == NGX_AGAIN) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git src/stream/ngx_stream_proxy_module.c src/stream/ngx_stream_proxy_module.c
2+
--- src/stream/ngx_stream_proxy_module.c
3+
+++ src/stream/ngx_stream_proxy_module.c
4+
@@ -1219,7 +1219,11 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
5+
}
6+
7+
s->connection->log->action = "SSL handshaking to upstream";
8+
9+
+#if (NGX_STREAM_APISIX)
10+
+ ngx_stream_apisix_set_upstream_ssl(s, pc);
11+
+#endif
12+
+
13+
rc = ngx_ssl_handshake(pc);
14+
15+
if (rc == NGX_AGAIN) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git src/stream/ngx_stream_proxy_module.c src/stream/ngx_stream_proxy_module.c
2+
--- src/stream/ngx_stream_proxy_module.c
3+
+++ src/stream/ngx_stream_proxy_module.c
4+
@@ -1219,7 +1219,11 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
5+
}
6+
7+
s->connection->log->action = "SSL handshaking to upstream";
8+
9+
+#if (NGX_STREAM_APISIX)
10+
+ ngx_stream_apisix_set_upstream_ssl(s, pc);
11+
+#endif
12+
+
13+
rc = ngx_ssl_handshake(pc);
14+
15+
if (rc == NGX_AGAIN) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git src/stream/ngx_stream_proxy_module.c src/stream/ngx_stream_proxy_module.c
2+
--- src/stream/ngx_stream_proxy_module.c
3+
+++ src/stream/ngx_stream_proxy_module.c
4+
@@ -1219,7 +1219,11 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
5+
}
6+
7+
s->connection->log->action = "SSL handshaking to upstream";
8+
9+
+#if (NGX_STREAM_APISIX)
10+
+ ngx_stream_apisix_set_upstream_ssl(s, pc);
11+
+#endif
12+
+
13+
rc = ngx_ssl_handshake(pc);
14+
15+
if (rc == NGX_AGAIN) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git src/stream/ngx_stream_proxy_module.c src/stream/ngx_stream_proxy_module.c
2+
--- src/stream/ngx_stream_proxy_module.c
3+
+++ src/stream/ngx_stream_proxy_module.c
4+
@@ -1219,7 +1219,11 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s)
5+
}
6+
7+
s->connection->log->action = "SSL handshaking to upstream";
8+
9+
+#if (NGX_STREAM_APISIX)
10+
+ ngx_stream_apisix_set_upstream_ssl(s, pc);
11+
+#endif
12+
+
13+
rc = ngx_ssl_handshake(pc);
14+
15+
if (rc == NGX_AGAIN) {

0 commit comments

Comments
 (0)