Skip to content

feat: add tlshandshake support#50

Open
laz-xyr wants to merge 5 commits intoapi7:masterfrom
laz-xyr:feat/tlshandshake
Open

feat: add tlshandshake support#50
laz-xyr wants to merge 5 commits intoapi7:masterfrom
laz-xyr:feat/tlshandshake

Conversation

@laz-xyr
Copy link
Copy Markdown

@laz-xyr laz-xyr commented Jan 7, 2026

the apisix-nginx-module library add tcpsock:tlshandshake function And made sslhandshake point to its custom tlshandshake function. healthcheck client certificates need to be invoked differently
https://github.com/api7/apisix-nginx-module/blob/0327bd759eeab36f2fa20b1f8b80eaf1239c1298/patch/1.27.1.1/lua-resty-core-tlshandshake.patch#L299-L335

There has been discussion:apache/apisix#12641 (comment)

We need to be compatible with changes

@laz-xyr
Copy link
Copy Markdown
Author

laz-xyr commented Jan 9, 2026

@nic-6443 Please review

@Baoyuantop
Copy link
Copy Markdown

cc @membphis

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jan 27, 2026

CLA assistant check
All committers have signed the CLA.

@laz-xyr
Copy link
Copy Markdown
Author

laz-xyr commented Feb 10, 2026

@Baoyuantop @nic-6443 @membphis
the local repository CI all runs pass
image

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds compatibility for APISIX’s patched cosocket TLS APIs by switching health checks to use tcpsock:tlshandshake() when available, and adds APISIX-only CI + test coverage for TLS/mTLS scenarios.

Changes:

  • Update resty.healthcheck to perform TLS handshakes via tlshandshake (including mTLS cert/key passing) when supported, otherwise fall back to sslhandshake.
  • Add APISIX-environment TLS and mTLS regression tests for both lua-resty-worker-events and lua-resty-events, plus test certificate fixtures.
  • Add a GitHub Actions workflow to run the APISIX-specific test suites and ignore .devcontainer/.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
lib/resty/healthcheck.lua Adds tlshandshake support path and adjusts mTLS cert/key handling accordingly.
t/apisix/lua-resty-worker-events/14-tls_by_tlshandshake.t APISIX-only TLS probe tests validating tlshandshake usage.
t/apisix/lua-resty-worker-events/17-mtls_by_tlshandshake.t APISIX-only mTLS probe tests (string PEM vs parsed objects, missing cert behavior).
t/apisix/lua-resty-events/14-tls_by_tlshandshake.t APISIX-only TLS tests for the lua-resty-events backend.
t/apisix/lua-resty-events/17-mtls_by_tlshandshake.t APISIX-only mTLS tests for the lua-resty-events backend.
t/apisix/certs/mtls_ca.crt Test CA certificate for APISIX mTLS suite.
t/apisix/certs/mtls_ca.key Test CA private key for APISIX mTLS suite.
t/apisix/certs/mtls_client.crt Test client certificate for APISIX mTLS suite.
t/apisix/certs/mtls_client.key Test client private key for APISIX mTLS suite.
t/apisix/certs/mtls_server.crt Test server certificate for APISIX mTLS suite.
t/apisix/certs/mtls_server.key Test server private key for APISIX mTLS suite.
.github/workflows/build_and_test_in_apisix.yml Adds CI job to run APISIX-only tests against an APISIX runtime environment.
.gitignore Ignores .devcontainer/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/build_and_test_in_apisix.yml Outdated
Comment thread .github/workflows/build_and_test_in_apisix.yml
Comment thread t/apisix/lua-resty-worker-events/17-mtls_by_tlshandshake.t Outdated
Comment thread t/apisix/lua-resty-events/17-mtls_by_tlshandshake.t Outdated
Comment thread lib/resty/healthcheck.lua
Comment thread lib/resty/healthcheck.lua
Comment thread lib/resty/healthcheck.lua
@laz-xyr
Copy link
Copy Markdown
Author

laz-xyr commented Mar 10, 2026

@Baoyuantop @nic-6443 @membphis Who can review the code? If external PR support is not supported, please implement the functionality of this PR within the team. resty-http had implementation of client certificates, https://github.com/api7/lua-resty-http/pull/1/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants