Skip to content
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

feat(vault): vault lua module, integration with jwt-auth authentication plugin #5745

Merged
merged 28 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b2788ff
vault-auth init
bisakhmondal Dec 3, 2021
a88c615
vault storage kv engine integration
bisakhmondal Dec 6, 2021
17b3c23
not required file
bisakhmondal Dec 6, 2021
7605c38
integrating vault storage backend with jwt-auth authentication plugin
bisakhmondal Dec 8, 2021
ae240ed
Merge branch 'master' into vault-jwt
bisakhmondal Dec 9, 2021
876cce3
Merge branch 'master' into vault-jwt
bisakhmondal Dec 9, 2021
c3a7d4a
openssl rsa-2048 pem public private keypairs
bisakhmondal Dec 9, 2021
ed628b2
vault integration tests with corner cases
bisakhmondal Dec 9, 2021
9ec682a
minor updates
bisakhmondal Dec 9, 2021
36f0141
adding real vault server into CIs
bisakhmondal Dec 9, 2021
c3aaf8f
lint fix
bisakhmondal Dec 9, 2021
80358b9
suggestions
bisakhmondal Dec 9, 2021
e4d10da
now get doesnot returns vault data
bisakhmondal Dec 9, 2021
f927fb9
update exposed port address
bisakhmondal Dec 9, 2021
ee251aa
documentation
bisakhmondal Dec 9, 2021
6158837
blank commit
bisakhmondal Dec 9, 2021
f9cdc4e
remove custom path support from mvp
bisakhmondal Dec 10, 2021
6729106
trimming down validation and key generation if vault config is enabled
bisakhmondal Dec 10, 2021
83b3fe0
remove redundant codes
bisakhmondal Dec 10, 2021
58292d2
Ci fix
bisakhmondal Dec 10, 2021
55c105d
changing vault kv suffix to /consumer/<username>/jwt-auth
bisakhmondal Dec 10, 2021
1f2ff22
update tests and modify the way http status code were sent
bisakhmondal Dec 10, 2021
cac28d1
fix doc broken link
bisakhmondal Dec 10, 2021
f78cf89
comment out vault config in yaml and update tests accordingly
bisakhmondal Dec 12, 2021
6a28225
Merge branch 'master' into vault-jwt
bisakhmondal Dec 13, 2021
2d44654
change yaml_config to extra_yaml_config
bisakhmondal Dec 13, 2021
66ee305
single extra yaml config
bisakhmondal Dec 13, 2021
a56ed8e
suggestion
bisakhmondal Dec 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions conf/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,15 @@ etcd:
# HashiCorp Vault storage backend for sensitive data retrieval. The config shows an example of what APISIX expects if you
# wish to integrate Vault for secret (sensetive string, public private keys etc.) retrieval. APISIX communicates with Vault
# server HTTP APIs. By default, APISIX doesn't need this configuration.
vault:
host: "http://0.0.0.0:8200" # The host address where the vault server is running.
timeout: 10 # request timeout 30 seconds
prefix: kv/apisix # APISIX supports vault kv engine v1, where sensitive data are being stored
# and retrieved through vault HTTP APIs. enabling a prefix allows you to better enforcement of
# policies, generate limited scoped tokens and tightly control the data that can be accessed
# from APISIX.
# vault:
# host: "http://0.0.0.0:8200" # The host address where the vault server is running.
# timeout: 10 # request timeout 30 seconds
# token: root # Authentication token to access Vault HTTP APIs
# prefix: kv/apisix # APISIX supports vault kv engine v1, where sensitive data are being stored
# and retrieved through vault HTTP APIs. enabling a prefix allows you to better enforcement of
# policies, generate limited scoped tokens and tightly control the data that can be accessed
# from APISIX.

token: root # Authentication token to access Vault HTTP APIs

#discovery: # service discovery center
# dns:
Expand Down
45 changes: 29 additions & 16 deletions t/plugin/jwt-auth-vault.t
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,8 @@ ok
"vault":{}
}
}
}]],
[[{
"node": {
"value": {
"username": "jack",
"plugins": {
"jwt-auth": {
"key": "key-hs256",
"algorithm": "HS256",
"vault":{}
}
}
}
},
"action": "set"
}]]
)
)

if code >= 300 then
ngx.status = code
Expand Down Expand Up @@ -163,6 +148,13 @@ passed


=== TEST 4: sign a jwt and access/verify /secure-endpoint, fails as no secret entry into vault
--- yaml_config
bisakhmondal marked this conversation as resolved.
Show resolved Hide resolved
vault:
host: "http://0.0.0.0:8200"
timeout: 10
prefix: kv/apisix
token: root
#END
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -206,6 +198,13 @@ Success! Data written to: kv/apisix/consumer/jack/jwt-auth


=== TEST 6: sign a HS256 jwt and access/verify /secure-endpoint
--- yaml_config
vault:
host: "http://0.0.0.0:8200"
timeout: 10
prefix: kv/apisix
token: root
#END
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -273,6 +272,13 @@ passed


=== TEST 9: sign a jwt with with rsa keypair and access /secure-endpoint
--- yaml_config
vault:
host: "http://0.0.0.0:8200"
timeout: 10
prefix: kv/apisix
token: root
#END
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -341,6 +347,13 @@ passed


=== TEST 12: sign a jwt with with rsa keypair and access /secure-endpoint
--- yaml_config
vault:
host: "http://0.0.0.0:8200"
timeout: 10
prefix: kv/apisix
token: root
#END
--- config
location /t {
content_by_lua_block {
Expand Down