Skip to content

cisolutions-nl/docker-hashicorp-vault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HashiCorp Vault on Docker in production mode (standalone mode, for dev and test purposes only)

For the cluster mode readme click here.

Requirements:

  • Virtual machine
  • Docker
  • Docker-Compose
  • (sudo) rights
  • Certificates

Instructions:

  1. Clone the project
git clone https://github.com/Nenodema/docker-hashicorp-vault.git
  1. Enter the project directory and start the container with docker-compose
cd docker-hashicorp-vault/standalone
(sudo) docker-compose up -d
  1. Enter container and initilize vault (save the unseal keys on a secure location)
(sudo) docker exec -it vault_vault-server_1 /bin/sh
vault operator init

image

  1. Go to http://VAULT_IP:8200/ and unseal the vault with 3 of the 5 keys

  2. Login with the "Initial Root Token" which is provided after the vault initionalization

  3. Have fun and stay safe

File structure:

standalone
├── config
│   └── vault.json
└── docker-compose.yml

Noteworthy links:


HashiCorp Vault on Docker in production mode (cluster mode)

Requirements:

  • Virtual machine (minimum of three)
  • Docker
  • Docker-Compose
  • (sudo) rights
  • Certificates

Instructions:

  1. Clone the project
git clone https://github.com/Nenodema/docker-hashicorp-vault.git
  1. Change variables in the following files:
  • .env
  • config/vault.json
  • certs/generate_CA.sh
  • certs/generate_certificate.sh
  • certs/generate_certificate_request.sh
  1. Generate CA, copy and rename CA file, move vault-server-ca.crt to the config directory
cd certs
chmod 766 * (make sure that you are in the certs directory!)
./certs/generate_CA.sh
cp vault-server-ca.pem ../vault-server-ca.crt
  1. Generarte Certificate request per machine
./certs/generate_certificate_request.sh
  1. Generarte Certificate per machine
./certs/generate_certificate.sh
  1. Copy the "cert.pem" and the "key.pm" to the config directory
cp cert.pem key.pem ../config
  1. Enter the project directory and start the container with docker-compose
verify that you are in the following directory: docker-hashicorp-vault/cluster
(sudo) docker-compose up -d --build
  1. Enter container and initilize vault (save the unseal keys on a secure location)
(sudo) docker exec -it vault_vault-server_1 /bin/sh
vault operator init

image

  1. Go to http://VAULT_IP:8200/ and unseal the vault with 3 of the 5 keys

  2. Login with the "Initial Root Token" which is provided after the vault initionalization

  3. Execute steps 1-10 for the other two nodes

  4. Join the new two nodes to the first node

(sudo) docker exec -it vault_vault-server_1 /bin/sh
vault operator raft join "https://$PRIMARY_NODE:8200"
vault operator unseal (3 times)
  1. check the status of the cluster
vault login (use the "Initial Root Token" which is provided after the vault initionalization
vault operator raft list-peers
Node Address State Voter
 — — — — — — — — — — — — — — — — — — — — — — — — -
vault_node_1 10.99.99.10:8201 leader true
vault_node_2 10.99.99.11:8201 follower true
vault_node_3 10.99.99.12:8201 follower true
  1. Go to http://VAULT_IP:8200/ of one of the nodes

  2. Login with the "Initial Root Token" which is provided after the vault initionalization

  3. Have fun and stay safe

File structure:

cluster
├── Dockerfile
├── certs
│   ├── generate_CA.sh
│   ├── generate_certificate.sh
│   └── generate_certificate_request.sh
├── config
│   └── vault.json
└── docker-compose.yml

Noteworthy links:

About

A short instruction (setup files included) to start with HashiCorp Vault on Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors