Commit Graph

22 Commits

Author SHA1 Message Date
Bruno Oliveira de Souza
0b9157156f
VAULT-32657 deprecate duplicate attributes in HCL configs and policies (#30386)
* upgrade hcl dependency on api pkg

This upgrades the hcl dependency for the API pkg,
and adapts its usage so users of our API pkg are
not affected. There's no good way of communicating
a warning via a library call so we don't.

The tokenHelper which is used by all Vault CLI
commands in order to create the Vault client, as
well as directly used by the login and server
commands, is implemented on the api pkg, so this
upgrade also affects all of those commands. Seems
like this was only moved to the api pkg because
the Terraform provider uses it, and I thought
creating a full copy of all those files back under
command would be too much spaghetti.

Also leaving some TODOs to make next deprecation
steps easier.

* upgrade hcl dependency in vault and sdk pkgs

* upgrade hcl dependency in vault and sdk pkgs

* add CLI warnings to commands that take a config

- vault agent (unit test on CMD warning)
- vault proxy (unit test on CMD warning)
- vault server (no test for the warning)
- vault operator diagnose (no tests at all, uses the
same function as vault server

* ignore duplicates on ParseKMSes function

* Extend policy parsing functions and warn on policy store

* Add warning on policy fmt with duplicate attributes

* Add warnings when creating/updating policy with duplicate HCL attrs

* Add log warning when switchedGetPolicy finds duplicate attrs

Following operations can trigger this warning when they run into a policy
with duplicate attributes:
* replication filtered path namespaces invalidation
* policy read API
* building an ACL (for many different purposes like most authZ operations)
* looking up DR token policies
* creating a token with named policies
* when caching the policies for all namespaces during unseal

* Print log warnings when token inline policy has duplicate attrs

No unit tests on these as new test infra would have to be built on all.
Operations affected, which will now print a log warning when the retrieved
token has an inline policy with duplicate attributes:
* capabilities endpoints in sys mount
* handing events under a subscription with a token with duplicate
attrs in inline policies
* token used to create another token has duplicate attrs in inline
policies (sudo check)
* all uses of fetchACLTokenEntryAndEntity when the request uses a
token with inline policies with duplicate attrs. Almost all reqs
are subject to this
* when tokens are created with inline policies (unclear exactly how that
can happen)

* add changelog and deprecation notice

* add missing copywrite notice

* fix copy-paste mistake

good thing it was covered by unit tests

* Fix manual parsing of telemetry field in SharedConfig

This commit in the hcl library was not in the
v1.0.1-vault-5 version we're using but is
included in v1.0.1-vault-7:
e80118accb

This thing of reusing when parsing means that
our approach of manually re-parsing fields
on top of fields that have already been parsed
by the hcl annotation causes strings (maybe
more?) to concatenate.

Fix that by removing annotation. There's
actually more occurrences of this thing of
automatically parsing something that is also
manually parsing. In some places we could
just remove the boilerplate manual parsing, in
others we better remove the auto parsing, but
I don't wanna pull at that thread right now. I
just checked that all places at least fully
overwrite the automatically parsed field
instead of reusing it as the target of the
decode call. The only exception is the AOP
field on ent but that doesn't have maps or
slices, so I think it's fine.

An alternative approach would be to ensure
that the auto-parsed value is discarded,
like the current parseCache function does

note how it's template not templates

* Fix linter complaints

* Update command/base_predict.go

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>

* address review

* remove copywrite headers

* re-add copywrite headers

* make fmt

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/partials/deprecation/duplicate-hcl-attributes.mdx

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* undo changes to deprecation.mdx

* remove deprecation doc

* fix conflict with changes from main

---------

Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
2025-05-23 16:02:07 -03:00
Ryan Cragun
58a49e6ce0
VAULT-33758: IPv6 address conformance for proxy and agent (#29517)
This is a follow-up to our initial work[0] to address RFC-5952 §4 conformance for IPv6 addresses in Vault. The initial pass focused on the vault server configuration and start-up routines. This follow-up focuses on Agent and Proxy, with a few minor improvements for server.

The approach generally mirrors the server implementation but also adds support for normalization with CLI configuration overrides.

One aspect we do not normalize currently is Agent/Proxy client creation to the Vault server with credentials taken from environment variables, as it would require larger changes to the `api` module. In practice this ought to be fine for the majority of cases.

[0]: https://github.com/hashicorp/vault/pull/29228
2025-02-27 15:57:46 -07:00
Jason O'Donnell
fe1f36a1dc
Add SIGUSR2 pprof to agent and proxy (#27510)
* Add SIGUSR2 pprof to agent

* changelog

* Update command/agent.go

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>

* Update command/agent.go

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>

* Add to proxy, update tests

* Fix path

* Changelog

* dry

* choose one error style

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-06-17 17:10:00 +00:00
Violet Hynes
f2b4ca4def
VAULT-24736 CE changes for static secret capability behaviour toggle (#26744) 2024-05-03 14:12:19 -04:00
Violet Hynes
204c748ce7
VAULT-23742 Fix issue with use_auto_auth_token being always on (#26391)
* VAULT-23742 Fix issue with use_auto_auth_token being always on

* Test improvements from review
2024-04-12 13:51:53 -04:00
divyaac
e5fc11227d
Fix TestProxy_Cache_EventSystemUpdatesCacheKVV2 (#26352)
* Fix TestProxy_Cache_EventSystemUpdatesCacheKVV2

* Edited tests, and added a new bool

* Edited tests

* Edited comment

* Rename argument in handler method

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
2024-04-11 10:17:04 -04:00
divyaac
fcef8adfb0
Auto Auth Healing for Proxy (#26307)
* Auto Auth Healing for Proxy

* Edited changelog

* Fix failing tests and small comment change

* Readded check because proxy cache is initialized with inmem sink
2024-04-09 12:35:39 -07:00
divyaac
6cac3b3bf5
Agent Auto Auth Self Healing for Templates (#26172)
* Agent Auto Auth Self Healing for Templates

* Added changelog

* Edited go.sum

* Edit changelog wording
2024-03-27 10:06:45 -07:00
Violet Hynes
1c0d71a58e
Fix lock issue for Agent and Proxy (#25771) 2024-03-04 19:48:46 +00:00
Violet Hynes
9e62680e10
Fix Agent and Proxy env var handling (#24790)
* Fix Agent and Proxy env var handling

* Changelog

* Review suggestions
2024-01-11 08:56:50 -05:00
Violet Hynes
a649d2b9a9
VAULT-17292 CE portion of changes (#24667)
* VAULT-17292 CE portion of changes

* VAULT-17292 docs

* VAULT-17292 changelog
2024-01-04 13:01:38 -05:00
Hamid Ghaf
57b6b74283
release log gate if disable-gated-logs flag is set (#24280)
* release log gate if disable-gated-logs flag is set

* CL

* Update changelog/24280.txt

Co-authored-by: Josh Black <raskchanky@gmail.com>

---------

Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>
Co-authored-by: Josh Black <raskchanky@gmail.com>
2023-12-11 08:08:48 -08:00
Christopher Swenson
6ed8b88f5f
Switch from mitchellh/cli to hashicorp/cli (#24239)
@mitchellh suggested we fork `cli` and switch to that.

Since we primarily use the interfaces in `cli`, and the new
fork has not changed those, this is (mostly) a drop-in replacement.

A small fix will be necessary for Vault Enterprise, I believe.
2023-12-04 11:05:02 -08:00
Peter Wilson
06b9325bb9
fix -log-file so that it uses the correct name and only adds timestamps on rotation (#24297)
* fix -log-file so that it uses the correct name and only adds timestamps on rotation

* added some tests for naming/rotation

* changelog

* revert to previous way of getting created time

* remove unused stat

* comment shuffle

* Update changelog/24297.txt

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>

* Update website/content/docs/agent-and-proxy/agent/index.mdx

Update 'agent' docs page

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/agent-and-proxy/proxy/index.mdx

Update 'proxy' docs page

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* Update website/content/docs/commands/server.mdx

Update 'server' docs page

Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>

* fix typos

---------

Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
2023-12-01 11:30:34 +00:00
Violet Hynes
3e054cbd4c
VAULT-19239 Add capability to disable dynamic secret caching for Vault Proxy (#23801)
* VAULT-19239 create disable static secret caching config

* VAULT-19239 missed file

* VAULT-19239 didn't finish a log line

* VAULT-19239 adjust test to use new option

* Fix typo

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-11-15 09:11:10 -05:00
Violet Hynes
fd2c737c51
Fix lifetime watcher user agent reporting Vault Agent for Vault Proxy requests (#23944) 2023-11-03 10:24:43 -04:00
Violet Hynes
363557d045
VAULT-19232 Add static secret capability manager to Vault Proxy (#23677)
* VAULT-19232 static secret capability manager so far

* VAULT-19232 mostly finish renewal job logic

* VAULT-19232 some clean up, tests, etc

* VAULT-19232 integrate capability manager with proxy, add E2E test

* VAULT-19232 boltdb stuff

* VAULT-19232 finishing touches

* VAULT-19232 typo

* VAULT-19232 add capabilities index cachememdb tests

* Remove erroneous "the"

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2023-10-25 16:43:24 -04:00
Violet Hynes
d88c06ecaa
VAULT-19255 - Add event based static secret cache updater to Vault Proxy (#23560)
* VAULT-19255 first pass at structure for event updater

* VAULT-19255 some more work, committign before rebase

* VAULT-19255 Mostly finish event updating scaffolding

* VAULT-19255 some additional coverage, clean-up, etc

* VAULT-19255 some clean-up

* VAULT-19255 fix tests

* VAULT-19255 more WIP event system integration

* VAULT-19255 More WIP

* VAULT-19255 more discovery

* VAULT-19255 add new test, some clean up

* VAULT-19255 fix bug, extra clean-up

* VAULT-19255 fix bugs, and clean up

* VAULT-19255 clean imports, add more godocs

* VAULT-19255 add config for test

* VAULT-19255 typo

* VAULT-19255 don't do the kv refactor in this PR

* VAULT-19255 update docs

* VAULT-19255 PR feedback

* VAULT-19255 More specific error messages
2023-10-16 10:14:36 -04:00
Violet Hynes
54c84decfd
VAULT-19233 First part of caching static secrets work (#23054)
* VAULT-19233 First part of caching static secrets work

* VAULT-19233 update godoc

* VAULT-19233 invalidate cache on non-GET

* VAULT-19233 add locking to proxy cache writes

* VAULT-19233 update locking, future-proof

* VAULT-19233 fix mutex

* VAULT-19233 Use ParseSecret
2023-09-22 10:57:38 -04:00
hashicorp-copywrite[bot]
0b12cdcfd1
[COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00
Violet Hynes
3d7d8f4965
VAULT-15547 Agent/proxy decoupling, take two (#20634)
* VAULT-15547 Additional tests, refactoring, for proxy split

* VAULT-15547 Additional tests, refactoring, for proxy split

* VAULT-15547 Import reorganization

* VAULT-15547 Some missed updates for PersistConfig

* VAULT-15547 address comments

* VAULT-15547 address comments
2023-05-19 13:17:48 -04:00
Violet Hynes
6b4b0f7aaf
VAULT-15547 First pass at agent/proxy decoupling (#20548)
* VAULT-15547 First pass at agent/proxy decoupling

* VAULT-15547 Fix some imports

* VAULT-15547 cases instead of string.Title

* VAULT-15547 changelog

* VAULT-15547 Fix some imports

* VAULT-15547 some more dependency updates

* VAULT-15547 More dependency paths

* VAULT-15547 godocs for tests

* VAULT-15547 godocs for tests

* VAULT-15547 test package updates

* VAULT-15547 test packages

* VAULT-15547 add proxy to test packages

* VAULT-15547 gitignore

* VAULT-15547 address comments

* VAULT-15547 Some typos and small fixes
2023-05-17 09:38:34 -04:00