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

custom CA for external vault server #83

Closed
dontreboot opened this issue Feb 20, 2020 · 3 comments
Closed

custom CA for external vault server #83

dontreboot opened this issue Feb 20, 2020 · 3 comments
Labels
injector Area: mutating webhook service question A general question about usage

Comments

@dontreboot
Copy link

AGENT_INJECT_VAULT_ADDR allows us to specify an external vault server address; however, I'd like also to add a custom CA to validate the vault server TLS. How do I specify that for vault injector?

@jkaosw
Copy link

jkaosw commented Feb 27, 2020

Discovered this today. This can be done via a Secret in Kubernetes and some annotations. In the namespace you're spawning applications that consume the injector, there should be a Secret with the CA cert in it:

kubectl create secret generic tls-ca --from-file=ca.pem

And then for the annotation:

...
vault.hashicorp.com/tls-secret: "tls-ca"
vault.hashicorp.com/ca-cert: "/vault/tls/ca.pem"
...

How it works is that the annotation vault.hashicorp.com/tls-secret will mount the Kubernetes secret (e.g. tls-ca) to /vault/tls and then you reference it in the vault.hashicorp/ca-cert annotation.

This is hidden away in the documentation under vault.hashicorp.com/tls-secret. Hope that's what you're looking for.

@tvoran tvoran added injector Area: mutating webhook service question A general question about usage labels Feb 29, 2020
@snordmann
Copy link

For me @jkaosw's solution only worked when I provided the complete certificate chain for my vault server. Using just the CA did not work.

So the secret was created with a file with this format:

-----BEGIN CERTIFICATE-----
Vault certificate
...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
Intermediate certificate
...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
Root certificate
...
-----END CERTIFICATE-----

@tomhjp
Copy link
Contributor

tomhjp commented Oct 24, 2023

Closed in #507, which adds the complementary AGENT_INJECT_VAULT_CACERT_BYTES.

@tomhjp tomhjp closed this as completed Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
injector Area: mutating webhook service question A general question about usage
Projects
None yet
Development

No branches or pull requests

5 participants