1 Commits

Author SHA1 Message Date
Peter Wilson
69c1e91679
VAULT-22482: New audit metrics (#24704)
* VAULT-22481: Audit filter node (#24465)

* Initial commit on adding filter nodes for audit

* tests for audit filter

* test: longer filter - more conditions

* copywrite headers

* Check interface for the right type

* Add audit filtering feature (#24554)

* Support filter nodes in backend factories and add some tests

* More tests and cleanup

* Attempt to move control of registration for nodes and pipelines to the audit broker (#24505)

* invert control of the pipelines/nodes to the audit broker vs. within each backend

* update noop audit test code to implement the pipeliner interface

* noop mount path has trailing slash

* attempting to make NoopAudit more friendly

* NoopAudit uses known salt

* Refactor audit.ProcessManual to support filter nodes

* HasFiltering

* rename the pipeliner

* use exported AuditEvent in Filter

* Add tests for registering and deregistering backends on the audit broker

* Add missing licence header to one file, fix a typo in two tests

---------

Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>

* Add changelog file

* initial work on global metrics for sink success/failure

* initial work to add a fallback device for audit

* Return when we have outright errors

* Improve comment

* Remove unneeded options on NewBroker and remove the policy opts elsewhere

* Remove duplicate node registration code

* Add more tests for audit backends

* ensure we return the multierror as soon as possible, and append it correctly

* error tweaks for audit: log req/resp

* extract the registration for fallback/normal devices, and ensure we always add to backends when successful

* slightly nicer error message rather than returning the raw err

* refactor the deregister methods for audit broker

* Prevent issues if fallback device is the first device added

* Bail early when the user tries adding more than one fallback audit device

* Check if there is an existing fallback audit device when setting the required sinks threshold for an audit broker

* Use the right ParseBool in audit backends

* Tweak the way we check for the threshold to make it clear why we ignore fallback

* Ensure all 'fallback' settings look the same

* nicer formatting of error

* broker tests for Register

* Deregister tests

* Deregister checks if registered before attempting

* Comment improvement

* Multiple Deregister calls are OK

* Fallback not required in this test

* Sanitise input for Deregister

* Locking mixup

* fix test

* Add changelog

* Check fallback broker's sink success threshold for register/deregister

* Remove changelog

* updated

* better name for the audit metrics labelers

* extra test

* remove name from metric counter type

* update func calls for NewMetricsCounter

* labelers should be pointers to the instance

* revert audit_test complaints about the header

* use constant value for the metric label on a fallback miss

* remove vault prefix from metric labels

* US spelling for labeler and adjust the way the labels are returned

* Fixed name and type we're testing for

* Defensive addition to HasFiltering (no nodemap no filter node)

* Remove dupe code block

* Revert to using armon/go-metrics

* Fallback miss fix

* PR feedback updates

* consistent format for configure methods

* Updated telemetry set up based on PR feedback

---------

Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com>
2024-01-10 17:48:06 +00:00