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

consul-template as configured by webhook is unable to read vault token file #307

Open
3 tasks done
forsberg opened this issue Jan 19, 2024 · 4 comments
Open
3 tasks done
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/keep Denotes an issue or PR that should be preserved from going stale. priority/low Issue that might be added to backlog or be rejected.

Comments

@forsberg
Copy link

Preflight Checklist

  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I am not looking for support or already pursued the available support channels without success.
  • I agree to follow the Code of Conduct.

Vault Secrets Webhook Version

1.21.0

Installation Type

Official Helm chart

Bank-Vaults Version

No response

Kubernetes Version

1.23

Kubernetes Distribution/Provisioner

EKS

Expected Behavior

Deployment where annotations to enable consul-template were added should run consul template and retrieve secrets from vault, as it did on vault-secrets-webhook 0.17.0.

In 1.17.0, we saw the following two injected containers:

consul-template: hashicorp/consul-template:0.24.1-alpine
vault-agent: vault:1.6.2

Actual Behavior

gitlab-agent ran flawlessly, but consul-template only got 403 back from vault. On closer inspection, it turns out that /vault/.vault-token was owned by root, and could only be read by root.

As the new consul-template container used ran as uid 100, this made things not work.

On 1.21.0 we see the following two injected containers:

consul-template: hashicorp/consul-template:0.32.0
vault-agent: hashicorp/vault:1.14.1

Manual inspection shows that the consul-template container now runs as uid 100.

Steps To Reproduce

No response

Configuration

No response

Logs

│ consul-template 2024-01-19T15:51:27.589Z [WARN] (view) vault.read(database/creds/energycounter-timeperiod-review): vault.read(database/creds/energycounter- │
│ consul-template                                                                                                                                             │
│ consul-template URL: GET https://ext-vault.vault:8200/v1/database/creds/energycounter-timeperiod-review                                                     │
│ consul-template Code: 403. Errors:                                                                                                                          │
│ consul-template                                                                                                                                             │
│ consul-template * permission denied (retry attempt 10 after "1m0s")

Additional Information

Adding annotation:

vault.security.banzaicloud.io/run-as-user: "100"

Fixes the problem.

This should preferrably be part of the default configuration pushed by the webhook.

@forsberg forsberg added the kind/bug Categorizes issue or PR as related to a bug. label Jan 19, 2024
@ramizpolic
Copy link
Member

Thanks for sharing this, but adding a default annotation for a specific use case could potentially block other users. I think if you could summarise these notes, we could add them to our docs page. @fekete-robert can assist here

@forsberg
Copy link
Author

I understand the concern regarding changing defaults, but just to make things clear, with vault secrets webhook 1.21.0 and forward, due to changes in how the consul-template container runs (specifically, which USER the container is running under by default), using consul-template with vault secrets webhook is now broken out of the box, and requires setting that annotation in order to work at all.

I would lean towards the default settings for a functionality be such that it makes the functionality work.

@ramizpolic ramizpolic self-assigned this Feb 5, 2024
@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Apr 7, 2024
@ramizpolic ramizpolic removed the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Apr 7, 2024
@forsberg
Copy link
Author

forsberg commented Apr 7, 2024

Still an issue.

@ramizpolic
Copy link
Member

We currently dont have too much capacity due to work on this and other projects, but we will address it in the upcoming weeks. Thanks for your patience @forsberg!

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Jun 9, 2024
@csatib02 csatib02 removed the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Jun 9, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Jun 9, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Jun 9, 2024
@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Aug 11, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Aug 11, 2024
@csatib02 csatib02 removed the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Aug 11, 2024
@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. label Oct 13, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2024
@ramizpolic ramizpolic removed their assignment Nov 4, 2024
@ramizpolic ramizpolic added lifecycle/keep Denotes an issue or PR that should be preserved from going stale. priority/low Issue that might be added to backlog or be rejected. and removed lifecycle/stale Denotes an issue or PR that has become stale and will be auto-closed. labels Nov 4, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Nov 4, 2024
@bank-vaults bank-vaults deleted a comment from github-actions bot Nov 4, 2024
@ramizpolic ramizpolic reopened this Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/keep Denotes an issue or PR that should be preserved from going stale. priority/low Issue that might be added to backlog or be rejected.
Projects
None yet
Development

No branches or pull requests

3 participants