forked from mulbc/vaultPass
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_dev_environment.sh
More file actions
executable file
·36 lines (28 loc) · 999 Bytes
/
start_dev_environment.sh
File metadata and controls
executable file
·36 lines (28 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# This starts the dev Vault environment using Docker / Podman
# This will enable the userpass auth module with the mitchellh user with password foo
GIT_ROOT=$(git rev-parse --show-toplevel)
docker run \
--cap-add=IPC_LOCK \
--env 'VAULT_DEV_ROOT_TOKEN_ID=myroot' \
--name=dev-vault \
--detach \
--publish 8200:8200/tcp \
--rm \
vault
VAULT_SETUP="
# Login to Vault
vault login myroot
# Create example secret for google.com domains
vault kv put secret/vaultPass/admin/google.com username=testUser password=unsafe
vault kv put secret/vaultPass/denied/google.com username=testUser password=unsafe
# Enable userpass auth and create example set
vault auth enable userpass
vault write \
auth/userpass/users/mitchellh \
password=foo \
policies=admins
vault write /sys/policy/default policy=@/dev_default.hcl
"
docker cp "$GIT_ROOT/dev_default.hcl" dev-vault:/
docker exec -it --env 'VAULT_ADDR=http://127.0.0.1:8200' dev-vault sh -c "$VAULT_SETUP"