-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: Support secrets for client ca #13061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,7 @@ BEGIN { | |||||||||||||||||
| set_env_from_file('TEST_KEY', 't/certs/apisix.key'); | ||||||||||||||||||
| set_env_from_file('TEST2_CERT', 't/certs/test2.crt'); | ||||||||||||||||||
| set_env_from_file('TEST2_KEY', 't/certs/test2.key'); | ||||||||||||||||||
| set_env_from_file('TEST_CA_CERT', 't/certs/mtls_ca.crt'); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| use t::APISIX 'no_plan'; | ||||||||||||||||||
|
|
@@ -67,7 +68,8 @@ VAULT_TOKEN='root' VAULT_ADDR='http://0.0.0.0:8200' vault kv put kv/apisix/ssl \ | |||||||||||||||||
| test.com.crt=@t/certs/apisix.crt \ | ||||||||||||||||||
| test.com.key=@t/certs/apisix.key \ | ||||||||||||||||||
| test.com.2.crt=@t/certs/test2.crt \ | ||||||||||||||||||
| test.com.2.key=@t/certs/test2.key | ||||||||||||||||||
| test.com.2.key=@t/certs/test2.key \ | ||||||||||||||||||
| test.com.3.client-ca.crt=@t/certs/mtls_ca.crt | ||||||||||||||||||
| --- response_body | ||||||||||||||||||
| Success! Data written to: kv/apisix/ssl | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -241,3 +243,112 @@ fetching data from env uri | |||||||||||||||||
| fetching data from env uri | ||||||||||||||||||
| fetching data from env uri | ||||||||||||||||||
| fetching data from env uri | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| === TEST 8: set ssl with cert, key and client ca in vault | ||||||||||||||||||
| --- config | ||||||||||||||||||
| location /t { | ||||||||||||||||||
| content_by_lua_block { | ||||||||||||||||||
| local core = require("apisix.core") | ||||||||||||||||||
| local t = require("lib.test_admin") | ||||||||||||||||||
|
|
||||||||||||||||||
| local data = { | ||||||||||||||||||
| snis = {"test.com"}, | ||||||||||||||||||
| key = "$secret://vault/test/ssl/test.com.key", | ||||||||||||||||||
| cert = "$secret://vault/test/ssl/test.com.crt", | ||||||||||||||||||
| client = { | ||||||||||||||||||
| ca = "$secret://vault/test/ssl/test.com.3.client-ca.key" | ||||||||||||||||||
|
||||||||||||||||||
| ca = "$secret://vault/test/ssl/test.com.3.client-ca.key" | |
| ca = "$secret://vault/test/ssl/test.com.3.client-ca.crt" |
Copilot
AI
Mar 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TEST 9 uses vault-based SSL configuration (cert, key, and client CA are all $secret://vault/... URIs from TEST 8), but the --- error_log section expects fetching data from env uri (which is the log message emitted when fetching $env:// URIs). Since the configuration uses vault secret URIs, the actual log message would be fetching data from secret uri (emitted by fetch_by_uri_secret in apisix/secret.lua). This mismatch will cause the test to fail. Compare with TEST 5, which also uses vault secrets and correctly expects fetching data from secret uri.
| fetching data from env uri | |
| fetching data from env uri | |
| fetching data from env uri | |
| fetching data from env uri | |
| fetching data from secret uri | |
| fetching data from secret uri | |
| fetching data from secret uri | |
| fetching data from secret uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can move the test case to
client-mtls.thttps://github.com/apache/apisix/blob/16b9d7e5b611a729c6eb99d3fbca6c8bce71f494/t/node/client-mtls.t, since the test cases involve mTLS (client side verification)