open-vault/vault
Clint b55303eddb
Combined Database Backend: Static Accounts (#6834)
* Add priority queue to sdk

* fix issue of storing pointers and now copy

* update to use copy structure

* Remove file, put Item struct def. into other file

* add link

* clean up docs

* refactor internal data structure to hide heap method implementations. Other cleanup after feedback

* rename PushItem and PopItem to just Push/Pop, after encapsulating the heap methods

* updates after feedback

* refactoring/renaming

* guard against pushing a nil item

* minor updates after feedback

* Add SetCredentials, GenerateCredentials gRPC methods to combined database backend gPRC

* Initial Combined database backend implementation of static accounts and automatic rotation

* vendor updates

* initial implementation of static accounts with Combined database backend, starting with PostgreSQL implementation

* add lock and setup of rotation queue

* vendor the queue

* rebase on new method signature of queue

* remove mongo tests for now

* update default role sql

* gofmt after rebase

* cleanup after rebasing to remove checks for ErrNotFound error

* rebase cdcr-priority-queue

* vendor dependencies with 'go mod vendor'

* website database docs for Static Role support

* document the rotate-role API endpoint

* postgres specific static role docs

* use constants for paths

* updates from review

* remove dead code

* combine and clarify error message for older plugins

* Update builtin/logical/database/backend.go

Co-Authored-By: Jim Kalafut <jim@kalafut.net>

* cleanups from feedback

* code and comment cleanups

* move db.RLock higher to protect db.GenerateCredentials call

* Return output with WALID if we failed to delete the WAL

* Update builtin/logical/database/path_creds_create.go

Co-Authored-By: Jim Kalafut <jim@kalafut.net>

* updates after running 'make fmt'

* update after running 'make proto'

* Update builtin/logical/database/path_roles.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* Update builtin/logical/database/path_roles.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* update comment and remove and rearrange some dead code

* Update website/source/api/secret/databases/index.html.md

Co-Authored-By: Jim Kalafut <jim@kalafut.net>

* cleanups after review

* Update sdk/database/dbplugin/grpc_transport.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* code cleanup after feedback

* remove PasswordLastSet; it's not used

* document GenerateCredentials and SetCredentials

* Update builtin/logical/database/path_rotate_credentials.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* wrap pop and popbykey in backend methods to protect against nil cred rotation queue

* use strings.HasPrefix instead of direct equality check for path

* Forgot to commit this

* updates after feedback

* re-purpose an outdated test to now check that static and dynamic roles cannot share a name

* check for unique name across dynamic and static roles

* refactor loadStaticWALs to return a map of name/setCredentialsWAL struct to consolidate where we're calling set credentials

* remove commented out code

* refactor to have loadstaticwals filter out wals for roles that no longer exist

* return error if nil input given

* add nil check for input into setStaticAccount

* Update builtin/logical/database/path_roles.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* add constant for queue tick time in seconds, used for comparrison in updates

* Update builtin/logical/database/path_roles.go

Co-Authored-By: Jim Kalafut <jim@kalafut.net>

* code cleanup after review

* remove misplaced code comment

* remove commented out code

* create a queue in the Factory method, even if it's never used

* update path_roles to use a common set of fields, with specific overrides for dynamic/static roles by type

* document new method

* move rotation things into a specific file

* rename test file and consolidate some static account tests

* Update builtin/logical/database/path_roles.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* Update builtin/logical/database/rotation.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* Update builtin/logical/database/rotation.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* Update builtin/logical/database/rotation.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* Update builtin/logical/database/rotation.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* Update builtin/logical/database/rotation.go

Co-Authored-By: Brian Kassouf <briankassouf@users.noreply.github.com>

* update code comments, method names, and move more methods into rotation.go

* update comments to be capitalized

* remove the item from the queue before we try to destroy it

* findStaticWAL returns an error

* use lowercase keys when encoding WAL entries

* small cleanups

* remove vestigial static account check

* remove redundant DeleteWAL call in populate queue

* if we error on loading role, push back to queue with 10 second backoff

* poll in initqueue to make sure the backend is setup and can write/delete data

* add revoke_user_on_delete flag to allow users to opt-in to revoking the static database user on delete of the Vault role. Default false

* add code comments on read-only loop

* code comment updates

* re-push if error returned from find static wal

* add locksutil and acquire locks when pop'ing from the queue

* grab exclusive locks for updating static roles

* Add SetCredentials and GenerateCredentials stubs to mockPlugin

* add a switch in initQueue to listen for cancelation

* remove guard on zero time, it should have no affect

* create a new context in Factory to pass on and use for closing the backend queue

* restore master copy of vendor dir
2019-06-19 14:45:39 -05:00
..
cluster Add a get handler function (#6603) 2019-04-17 14:21:56 -07:00
external_tests Fix a deadlock if a panic happens during request handling (#6920) 2019-06-19 09:40:57 -04:00
replication Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
seal refactoring to unit test transit seal (#6605) 2019-04-23 15:13:56 -04:00
acl.go Check nil parameter value when processing an ACL. 2019-04-26 15:57:00 -07:00
acl_test.go Check nil parameter value when processing an ACL. 2019-04-26 15:57:00 -07:00
acl_util.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
audit.go Allow plugins to submit audit requests/responses via extended SystemView (#6777) 2019-05-22 18:52:53 -04:00
audit_broker.go Allow plugins to submit audit requests/responses via extended SystemView (#6777) 2019-05-22 18:52:53 -04:00
audit_test.go Allow plugins to submit audit requests/responses via extended SystemView (#6777) 2019-05-22 18:52:53 -04:00
audited_headers.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
audited_headers_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
auth.go Fix a case where mounts could be duplicated (#6771) 2019-06-04 10:33:36 -07:00
auth_test.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
barrier.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
barrier_access.go
barrier_aes_gcm.go Clear the Barrier AEAD cache on keyring reload (#6870) 2019-06-12 08:56:16 -07:00
barrier_aes_gcm_test.go Clear the Barrier AEAD cache on keyring reload (#6870) 2019-06-12 08:56:16 -07:00
barrier_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
barrier_view.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
barrier_view_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
barrier_view_util.go The big one (#5346) 2018-09-17 23:03:00 -04:00
capabilities.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
capabilities_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
cluster.go Move cluster logic out of vault package (#6601) 2019-04-17 13:50:31 -07:00
cluster_test.go Move cluster logic out of vault package (#6601) 2019-04-17 13:50:31 -07:00
core.go Fix a deadlock if a panic happens during request handling (#6920) 2019-06-19 09:40:57 -04:00
core_test.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
core_util.go Move cluster logic out of vault package (#6601) 2019-04-17 13:50:31 -07:00
cors.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
counters.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
counters_test.go Add code for writing and reading request counters to storage. (#5918) 2019-03-05 14:55:07 -05:00
dynamic_system_view.go core: add generic request forwarding bits to oss (#6866) 2019-06-11 13:13:03 -07:00
expiration.go Port over some SP v2 bits (#6516) 2019-05-01 13:47:41 -04:00
expiration_integ_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
expiration_test.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
expiration_util.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
generate_root.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
generate_root_test.go Update to api 1.0.1 and sdk 0.1.8 2019-04-15 14:10:07 -04:00
ha.go Fix a deadlock if a panic happens during request handling (#6920) 2019-06-19 09:40:57 -04:00
identity_lookup.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
identity_lookup_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
identity_store.go Storage packer V1 updates (#6531) 2019-05-07 15:29:51 -04:00
identity_store_aliases.go Prevent entity alias creation when entity is in different NS than mount (#943) (#6886) 2019-06-14 12:53:00 -04:00
identity_store_aliases_test.go Prevent entity alias creation when entity is in different NS than mount (#943) (#6886) 2019-06-14 12:53:00 -04:00
identity_store_entities.go Prevent entity alias creation when entity is in different NS than mount (#943) (#6886) 2019-06-14 12:53:00 -04:00
identity_store_entities_test.go Storage packer V1 updates (#6531) 2019-05-07 15:29:51 -04:00
identity_store_group_aliases.go Update group alias handling to better protect against namespace differences 2019-06-18 16:43:30 -04:00
identity_store_group_aliases_test.go Update group alias handling to better protect against namespace differences 2019-06-18 16:43:30 -04:00
identity_store_groups.go Update group alias handling to better protect against namespace differences 2019-06-18 16:43:30 -04:00
identity_store_groups_test.go Fix some tests 2019-06-17 17:02:34 -04:00
identity_store_schema.go Storage packer V1 updates (#6531) 2019-05-07 15:29:51 -04:00
identity_store_structs.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
identity_store_test.go Storage packer V1 updates (#6531) 2019-05-07 15:29:51 -04:00
identity_store_upgrade.go Prevent entity alias creation when entity is in different NS than mount (#943) (#6886) 2019-06-14 12:53:00 -04:00
identity_store_util.go Update group alias handling to better protect against namespace differences 2019-06-18 16:43:30 -04:00
init.go Port over some test fixes (#6261) 2019-02-19 12:03:02 -08:00
init_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
keyring.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
keyring_test.go Spelling (#4119) 2018-03-20 14:54:10 -04:00
logical_cubbyhole.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
logical_cubbyhole_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
logical_passthrough.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
logical_passthrough_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
logical_system.go List additional sys paths as unauthenticated (#6654) 2019-04-29 16:42:23 -07:00
logical_system_helpers.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
logical_system_integ_test.go Update to api 1.0.1 and sdk 0.1.8 2019-04-15 14:10:07 -04:00
logical_system_paths.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
logical_system_test.go Storage packer V1 updates (#6531) 2019-05-07 15:29:51 -04:00
mount.go Add new license callback init step for logical backends. (#6887) 2019-06-17 14:11:35 -04:00
mount_test.go Fix a case where mounts could be duplicated (#6771) 2019-06-04 10:33:36 -07:00
mount_util.go Add new license callback init step for logical backends. (#6887) 2019-06-17 14:11:35 -04:00
namespaces.go The big one (#5346) 2018-09-17 23:03:00 -04:00
plugin_catalog.go Update to api 1.0.1 and sdk 0.1.8 2019-04-15 14:10:07 -04:00
plugin_catalog_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
plugin_reload.go Sync plugin reload file 2019-04-23 10:22:56 -04:00
policy.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
policy_store.go Add a force capability to delete in the policy store 2019-06-18 10:25:57 -04:00
policy_store_test.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
policy_store_util.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
policy_test.go Fix hasMountPath for segment wildcard mounts; introduce priority order (#6532) 2019-04-10 17:46:17 -04:00
policy_util.go The big one (#5346) 2018-09-17 23:03:00 -04:00
rekey.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
rekey_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
request_forwarding.go Move cluster logic out of vault package (#6601) 2019-04-17 13:50:31 -07:00
request_forwarding_rpc.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
request_forwarding_rpc_util.go The big one (#5346) 2018-09-17 23:03:00 -04:00
request_forwarding_service.pb.go Combined Database Backend: Static Accounts (#6834) 2019-06-19 14:45:39 -05:00
request_forwarding_service.proto The big one (#5346) 2018-09-17 23:03:00 -04:00
request_handling.go Fix a deadlock if a panic happens during request handling (#6920) 2019-06-19 09:40:57 -04:00
request_handling_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
request_handling_util.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
rollback.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
rollback_test.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
router.go Fix a case where mounts could be duplicated (#6771) 2019-06-04 10:33:36 -07:00
router_access.go The big one (#5346) 2018-09-17 23:03:00 -04:00
router_test.go Fix a deadlock if a panic happens during request handling (#6920) 2019-06-19 09:40:57 -04:00
router_testing.go Fix a deadlock if a panic happens during request handling (#6920) 2019-06-19 09:40:57 -04:00
seal.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
seal_access.go Send initialized information via sys/seal-status (#5424) 2018-09-27 14:03:37 -07:00
seal_autoseal.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
seal_test.go Use atomic values in seal to avoid some data races (#4040) 2018-02-23 17:18:48 -05:00
seal_testing.go Updates to recovery keys (#6152) 2019-02-01 11:29:55 -08:00
seal_testing_util.go Run goimports across the repository (#6010) 2019-01-08 16:48:57 -08:00
sealunwrapper.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
sealunwrapper_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
testing.go fix test 2019-06-18 14:04:08 -07:00
testing_util.go Fix leader info repopulation (#6167) 2019-02-05 21:01:18 -05:00
token_store.go Update description field for some token store role values to be accurate 2019-06-18 11:33:56 -04:00
token_store_test.go Tokenhelper v2 (#6662) 2019-06-14 10:17:04 -04:00
token_store_util.go The big one (#5346) 2018-09-17 23:03:00 -04:00
ui.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
ui_test.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
util.go
util_test.go
wrapping.go Switch to go modules (#6585) 2019-04-13 03:44:06 -04:00
wrapping_util.go Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00