8000 feat: add support for `disable_local_ca_jwt` in the Kubernetes auth method by fad3t · Pull Request #997 · hvac/hvac · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add support for disable_local_ca_jwt in the Kubernetes auth method #997

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

Merged
merged 1 commit into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions hvac/api/auth_methods/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def configure(
pem_keys=None,
issuer=None,
mount_point=DEFAULT_MOUNT_POINT,
disable_local_ca_jwt=False,
):
"""Configure the connection parameters for Kubernetes.

Expand All @@ -50,6 +51,8 @@ def configure(
:type token_reviewer_jwt: str | unicode
:param mount_point: The "path" the method/backend was mounted on.
:type mount_point: str | unicode
:param disable_local_ca_jwt: Disable defaulting to the local CA cert and service account JWT
:type disable_local_ca_jwt: bool
:return: The response of the configure_method request.
:rtype: requests.Response
"""
Expand All @@ -66,6 +69,7 @@ def configure(

params = {
"kubernetes_host": kubernetes_host,
"disable_local_ca_jwt": disable_local_ca_jwt,
}
params.update(
utils.remove_nones(
Expand Down
11 changes: 11 additions & 0 deletions tests/integration_tests/api/auth_methods/test_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ def tearDown(self):
if utils.vault_version_lt("1.11.0")
else "compact JWS format must have three parts",
),
param(
"missing kubernetes_ca_cert",
disable_local_ca_jwt=True,
raises=exceptions.InvalidRequest,
exception_message="one of pem_keys or kubernetes_ca_cert must be set"
if utils.vault_version_lt("1.10.0")
else "kubernetes_ca_cert must be given",
),
]
)
def test_configure(
Expand All @@ -68,6 +76,7 @@ def test_configure(
token_reviewer_jwt=None,
pem_keys=None,
issuer=None,
disable_local_ca_jwt=False,
raises=None,
exception_message="",
):
Expand All @@ -80,6 +89,7 @@ def test_configure(
token_reviewer_jwt=token_reviewer_jwt,
pem_keys=pem_keys,
mount_point=self.TEST_MOUNT_POINT,
disable_local_ca_jwt=disable_local_ca_jwt,
)
self.assertIn(member=exception_message, container=str(cm.exception))
else:
Expand All @@ -88,6 +98,7 @@ def test_configure(
kubernetes_ca_cert="-----BEGIN CERTIFICATE-----\\n.....\\n-----END CERTIFICATE-----",
mount_point=self.TEST_MOUNT_POINT,
issuer="bob",
disable_local_ca_jwt=disable_local_ca_jwt,
)
logging.debug("configure_response: %s" % configure_response)
self.assertEqual(
Expand Down
0