Skip to content

Commit d8a2fdf

Browse files
authored
feat: improve docs and fix .gitignore (#72)
1 parent ddf2ae5 commit d8a2fdf

File tree

7 files changed

+88
-55
lines changed

7 files changed

+88
-55
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ node_modules
99
npm-debug.log
1010
VAULT_ROOT_TOKEN
1111
VAULT_UNSEAL_KEY
12-
/setenv-local.sh
1312
.DS_Store
1413
/intention.json
15-
/config/envconsul/env.hcl
16-
/config/config.json
1714
/setenv/*

README-config.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
# Vault Sync Tool - Configuration
22

3+
Back: [README.md](README.md)
4+
35
This document is aimed at Vault Administrators looking to alter the policies and access the Vault Sync Tool configures.
46

5-
For users, the Vault Sync Tool maps client roles coming from OIDC to internal groups with policies that manage what the group can do. For services, it maps App Roles to policies that manage what the service can do.
7+
For users, the Vault Sync Tool maps client roles coming from OIDC to internal groups with policies that manage what the group can do. For services, it maps [AppRoles](https://developer.hashicorp.com/vault/docs/auth/approle) to policies that manage what the service can do.
8+
9+
## Configuring OIDC
10+
11+
Configuring OIDC is out of scope for the Vault Sync Tool. The tool assumes there is another process (manual or automated) that maps end users to the roles included in their token.
12+
13+
It is extremely important that roles are correctly mapped.
614

715
## Defined Groups
816

9-
The 'group' here refers to a grouping of policies and not a Vault group. This allows for the syncing of a specific group of policies (like apps or system) by themselves. A group is a collection of policies aimed at solving a class of access.
17+
A group is a collection of policies aimed at solving a class of access. This allows for the syncing of a specific group of policies (like apps or system) by themselves.
18+
19+
The 'group' here is not a Vault group which is a separate thing.
1020

1121
| Group | Definition | Examples | Typical Usage |
1222
| --- | --- | --- | --- |
13-
| system | Policies that provide broad access of Vault or a specific part. | system/admin-super | Admin users |
14-
| apps | Policies that an individual application needs for itself. | apps/fidq/prod-kv-read | Applications or developers of an application |
15-
| groups | Policies for a group of end users (humans) | groups/appdelivery-user | A group of end users (application delivery, DBA, etc) |
23+
| system | Policies that provide broad access to Vault. | system/admin-super | Admin users; Generic access |
24+
| apps | Policies required by an individual application for its own use. | apps/fidq/prod-kv-read | Applications or developers of an application |
25+
| groups | Policies for a group of end users (humans) | groups/appdelivery-user | A group of end users (developers, operations, security, auditors, management) |
1626

1727
### Policy Naming Pattern
1828

@@ -24,6 +34,8 @@ The tool uses a naming pattern that Vault admins need to be aware of. The patter
2434

2535
This repo includes a generic configuration in [./config](./config/). If you have specific needs, you can copy this folder to another repository and make your changes there.
2636

37+
If required, copy (or mount) your configuration to the config folder before you run the tool.
38+
2739
## File: config.json
2840

2941
This is a key value object. Each of the root keys will be described in a separate section.

README-dev.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ podman build . -t vsync
2727

2828
### With NR Broker
2929

30-
NR Broker's local setup will start a Vault container and run a setup script. No further setup should be required.
30+
Setting up NR Broker locally involves starting a Vault container and executing a setup script. This process enables the Vault Sync Tool to operate seamlessly with the local installation, requiring no additional setup.
3131

3232
This is currently the only practical way to run the Vault Sync Tool because NR Broker is the only implemented data source for applications.
3333

3434
### Without NR Broker
3535

36-
The following will start up Vault in Podman. The Vault Sync Tool defaults to localhost:8200 for the address and myroot for the token.
36+
The following will start up Vault in Podman. The Vault Sync Tool defaults to 'localhost:8200' for the address and 'myroot' for the token.
3737

3838
`podman run --rm -e 'VAULT_DEV_ROOT_TOKEN_ID=myroot' -e 'VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200' --name=dev-vault -p 8200:8200 vault`
3939

@@ -47,6 +47,12 @@ vault secrets enable -path=apps -version=2 kv
4747
vault secrets enable -path=groups -version=2 kv
4848
```
4949

50-
## Running with Broker
50+
## Running Vault Sync Tool
51+
52+
### With NR Broker
5153

5254
See: [Running Vault Sync Tool](https://bcgov-nr.github.io/nr-broker/#/development?id=running-vault-sync-tool)
55+
56+
### Without NR Broker
57+
58+
This is unsupported currently.

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Vault Sync Tool
22

3-
The Vault Sync Tool configures HashiCorp Vault using data sources to allow applications and users to access Vault securely. It can read a static configuration or read dynamic data from the business intelligence tool, [NR Broker](https://github.com/bcgov-nr/nr-broker). It can monitor for changes in its datasources or be run on-demand.
3+
The Vault Sync Tool configures HashiCorp Vault by utilizing data sources, enabling secure access for applications and users. It can either read a static configuration or dynamically retrieve data from the business intelligence tool, [NR Broker](https://github.com/bcgov-nr/nr-broker). Additionally, it can monitor data source changes or be run on-demand.
44

55
<!-- toc -->
66
* [Vault Sync Tool](#vault-sync-tool)
@@ -10,23 +10,21 @@ The Vault Sync Tool configures HashiCorp Vault using data sources to allow appli
1010

1111
## Running
1212

13-
The tool can be run from the source using Node.js or a release container image by using Podman or Docker.
13+
The tool can be run from the source using Node.js or a container image by using Podman or Docker.
1414

1515
```
1616
./bin/dev health
1717
```
1818

1919
```
20-
podman run --rm ghcr.io/bcgov-nr/vault-sync-app:v1.0.4 health
20+
podman run --rm ghcr.io/bcgov-nr/vault-sync-app:v2.0.1 health
2121
```
2222

23-
The sample command runs the health command. All the commands will probably require some arguments set up to work with your Vault.
24-
25-
The container expects to recieve a VAULT_ADDR and VAULT_TOKEN to load
23+
The sample command runs the health command. All the commands will probably require some arguments set up to work with your installation of Hashicorp Vault. With no arguments set, it will try to use a local Vault installation with a static token.
2624

2725
## Environment Variables
2826

29-
The tool can use environment variables in place of most command arguments. It is recommended that all confidential paramaters (tokens, etc.) be set using environment variables.
27+
The tool can utilize environment variables instead of most command arguments. It is recommended to set all confidential parameters (such as tokens) using environment variables. Specifically, the argument 'vault-token' should always be configured with the environment variable 'VAULT_TOKEN'.
3028

3129
These can be found by looking in the [src/flags.ts](src/flags.ts) file.
3230

config/envconsul/env.hcl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
vault {
2+
renew_token = false
3+
retry {
4+
enabled = false
5+
attempts = 12
6+
backoff = "250ms"
7+
max_backoff = "1m"
8+
}
9+
}
10+
secret {
11+
no_prefix = true
12+
path = "apps/prod/vault/vsync"
13+
}
14+
exec {
15+
splay = "0s"
16+
env {
17+
pristine = false
18+
}
19+
kill_timeout = "5s"
20+
}

package-lock.json

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
]
3838
},
3939
"dependencies": {
40-
"@oclif/core": "^4.0.12",
40+
"@oclif/core": "^4.0.13",
4141
"@oclif/plugin-help": "^6.2.6",
42-
"@oclif/plugin-plugins": "^5.3.7",
42+
"@oclif/plugin-plugins": "^5.3.8",
4343
"axios": "^1.7.2",
4444
"ejs": "^3.1.10",
4545
"inversify": "^6.0.2",
@@ -62,7 +62,7 @@
6262
"eslint-plugin-jest": "^28.6.0",
6363
"eslint-plugin-prettier": "^5.2.1",
6464
"jest": "^29.7.0",
65-
"oclif": "^4.14.6",
65+
"oclif": "^4.14.8",
6666
"rimraf": "^3.0.2",
6767
"shx": "^0.3.4",
6868
"ts-jest": "^29.2.3",

0 commit comments

Comments
 (0)