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

config endpoint implementation #2

Merged
merged 11 commits into from
Apr 19, 2022
Merged

config endpoint implementation #2

merged 11 commits into from
Apr 19, 2022

Conversation

tvoran
Copy link
Member

@tvoran tvoran commented Apr 14, 2022

Overview

Implements the config endpoint for the secrets engine.

Design of Change

Adds config parameters to the backend:

  • kubernetes_host (string: ""): Kubernetes API URL to connect to. Defaults to https://$KUBERNETES_SERVICE_HOST:KUBERNETES_SERVICE_PORT_HTTPS if those environment variables are set.
  • service_account_jwt (string: ""): The JSON web token of the service account used by the secret engine to manage Kubernetes roles. Defaults to the local pod’s JWT if found.
  • kubernetes_ca_cert (string: ""): PEM encoded CA certificate to use by the secret engine to verify the Kubernetes API server certificate. Defaults to the local pod’s CA if found.
  • disable_local_ca_jwt (bool: false): Disable defaulting to the local CA certificate and service account JWT when running in a Kubernetes pod.

Uses the caching file reader introduced in https://github.com/hashicorp/vault-plugin-auth-kubernetes for reading the local pod's JWT and CA.

Related Issues/Pull Requests

Depends on:

Contributor Checklist

TODO:

  • pathRead
  • pathWrite create
  • pathWrite update
  • pathDelete

@tvoran tvoran requested review from tomhjp, imthaghost and swenson April 14, 2022 16:49
Copy link
Contributor

@tomhjp tomhjp left a comment

Choose a reason for hiding this comment

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

Awesome, and nice tests! Just a few minor suggestions

path_config.go Outdated Show resolved Hide resolved
path_config.go Outdated Show resolved Hide resolved
path_config.go Show resolved Hide resolved
path_config.go Outdated
Comment on lines 139 to 141
if config.DisableLocalCAJwt && config.CACert == "" {
return logical.ErrorResponse("kubernetes_ca_cert must be given when disable_local_ca_jwt is true"), nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a fairly popular issue in the auth repo to get rid of this requirement: hashicorp/vault-plugin-auth-kubernetes#62

I think it should be ok to just skip it, and assume that the API is either safely exposed over HTTP (some kind of lower layer network encryption/authentication via VPN/proxy), or uses a publicly trusted CA like for AWS ELBs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense to me, removed in 7cbb6b3.

path_config.go Outdated Show resolved Hide resolved
@tvoran tvoran merged commit 4a1591f into main Apr 19, 2022
@tvoran tvoran deleted the VAULT-5669/config branch April 19, 2022 15:03
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.

2 participants