You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AV-43704: initial new cred and revoke of db creds implementation using v4 cp open api (#1)
* AV-43704: initial new cred and revoke of db creds implementation using v4 cp open api
* refactored to accept the access in the creation statement of role config
* Refactored the config and adding rotate-root support (wip)
* fixed the issue with static role creation and also updated to newer lib
* fixed the list of creds issue
* updating the sample commands
* fixed the pagination handling during the finding of db cred key
* changed the module
* partial fix for the rotate key saving of vault configuration
* updated the example for capella dev env
* Fixed the side effect of change AV-59622
* Fixed the side effect of change AV-59622
* Removed allowed roles
* added back mandatory fields in the database config
* trying to optimize the saving new password
* Adding default and more examples to cover the default and all buckets scenarios
* Fixing the root rotate issue and considering the password policy
* Changed root rotation per new v4 api changes
* Changed root rotation per new v4 api changes
* Updating the latest steps
* Few more updates
* Reformatting to have easy copy of code
* Reformatting to have easy copy of code
* Reformatting to have easy copy of code
* Update README.md
@@ -10,7 +10,7 @@ The plugin supports the generation of static and dynamic user roles and root cre
10
10
11
11
## Build
12
12
13
-
To build this package for any platform you will need to clone this repository and cd into the repo directory and `go build -o couchbasecapella-database-plugin ./cmd/couchbasecapella-database-plugin/`. To test `go test` will execute a set of basic tests against against the docker.io/couchbase/server-sandbox:6.5.0 couchbase database image. To test against different sandbox images, for example 5.5.1, set the `COUCHBASE_VERSION=5.5.1` environment variable. If you want to run the tests against a local couchbase installation or an already running couchbase container, set the environment variable `COUCHBASE_HOST` before executing. **Note** you will need to align the Administrator username, password and bucket_name with the pre-set values in the `couchbasecapella_test.go` file. Set VAULT_ACC to execute all of the tests. A subset of tests can be run using the command `go test -run TestDriver/Init` for example.
13
+
To build this package for any platform you will need to clone this repository and cd into the repo directory and `go build -o couchbasecapella-database-plugin ./cmd/couchbasecapella-database-plugin/`.
14
14
15
15
## Installation
16
16
@@ -24,121 +24,203 @@ You will need to define a plugin directory using the `plugin_directory` configur
24
24
Sample commands for registering and starting to use the plugin:
25
25
26
26
```bash
27
-
$ SHA256=$(shasum -a 256 plugins/couchbasecapella-database-plugin | cut -d'' -f1)
27
+
SHA256=$(shasum -a 256 plugins/couchbasecapella-database-plugin | cut -d'' -f1)
At this stage you are now ready to initialize the plugin to connect to couchbase capella cluster using unencrypted or encrypted communications.
36
36
37
-
Prior to initializing the plugin, ensure that you have created an administration account. Vault will use the user specified here to create/update/revoke database credentials. That user must have the appropriate permissions to perform actions upon other database users.
37
+
Prior to initializing the plugin, ensure that you have created a couchbase capella provisioned cluster along with V4 API keys. Vault will use the user specified settings here to create/update/revoke database credentials. That user must have the appropriate permissions to perform actions upon other database users.
38
38
39
-
### Unencrypted plugin initialization
39
+
### Plugin initialization
40
+
41
+
#### Set Vault Address to the local or hosted server
Note: If you want to connect the plugin to a couchbase capella cluster prior to version 6.5.0 you will also have to supply an existing bucket (bucket_name="travel-sample") or the command will fail with the error message **"error verifying connection: error in Connection waiting for cluster: unambiguous timeout"**.
<code>Success! Data written to: database/config/couchbasecapella-database</code>
56
109
57
-
The example here uses the self signed CA certificate that comes with the out of the box couchbase cluster installation and is not suitable for real production use where commercial grade certificates should be obtained.
110
+
You should consider rotating the root password (same as secretKey). Note that if you do, the new password(secret) will never be made available through Vault, so you should create a vault-specific database admin user for this.
58
111
59
112
```bash
60
-
$ BASE64PEM=$(curl -X GET http://Administrator:Admin123@127.0.0.1:8091/pools/default/certificate|base64 -w0)
When you create roles, you need to provide a JSON string containing the access with Couchbase RBAC roles which are documented [here](http://cbc-cp-api.s3-website-us-east-1.amazonaws.com/#tag/databaseCredentials/operation/postDatabaseCredential).
67
120
68
-
# You should consider rotating the admin password. Note that if you do, the new password will never be made available
69
-
# through Vault, so you should create a vault-specific database admin user for this.
NOTE: if a creation_statement is not provided readonly for all buckets(with all scopes and collections), <code>'{access: [{ privileges: [ data_reader ], resources: { buckets: [ { name :* } ] } }]}'</code>
122
+
123
+
#### dynamicrole1 with a specific bucket, scope with both data read and write.
<code>Success! Data written to: database/roles/dynamicrole1</code>
74
130
75
-
When you create roles, you need to provide a JSON string containing the Couchbase RBAC roles which are documented [here](https://docs.couchbase.com/server/6.5/learn/security/roles.html). From Couchbase 6.5 groups are supported and the creation statement can contain just roles or just groups or a mixture of the two. **Note** to use a group, it must have been created in the database previously.
131
+
#### dynamicrole2 with a list of 3 buckets (its all scopes &collections) access previleges of both data read and write.
76
132
77
133
```bash
78
-
# if a creation_statement is not provided the user account will default to read only admin, '{"roles":[{"role":"ro_admin"}]}'
In order to use static roles, the user must already exist in the Couchbase Capella security settings. The example below assumes that there is an existing user with the name "vault-edu". If the user does not exist you will receive the following error.
190
+
In order to use static roles, the database credential user must already exist in the Couchbase Capella security settings. The example below assumes that there is an existing user with the name "vault-edu".
191
+
117
192
118
193
```bash
119
-
* 1 error occurred:
120
-
* error setting credentials: rpc error: code = Unknown desc = user not found | {"unique_id":"74f229fd-b3b3-4036-9673-312adae094bb","endpoint":"http://localhost:8091"}
You can run `make dev` in the root of the repo to start up a development vault server and automatically register a local build of the plugin. You will need to have a built `vault` binary available in your `$PATH` to do so.
0 commit comments