- Docker
- Docker Compose
- Domain name (for ssl and vault accessibility)
- Cloudflare account
- Cloud Service or VPS (Virtual Private Server) such as AWS, Azure, Digitalocean
- In your server console clone this repository
$ git clone https://github.com/alvinveroy/vault-nginx.git
- Sign up for cloudflare
- Add an A record for your Vault's subdomain and enter your VPS or Cloud VM IP. Make sure to enable proxy so that your Vault's server IP will be hidden to anyone who will dig your DNS records.
- Obtain the free 15 years SSL Certificate from cloudflare.
- Click on the create button.
- Create a file under the folder ssl and name is as "ssl.crt" - paste the content of Origin certificate that you have copied from cloudflare, then create another file and name it "ssl.key". Paste the contents of the private key from cloudflare inside ssl.key file. MAKE SURE NOT TO CLICK THE OK BUTTON IF YOU HAVEN'T SAVE THE CONTENTS OF THE PRIVATE KEY. You will not able to get it again and must revoke your Certificate and create a new one.
- Open the file nginx.conf under nginx_conf folder and edit the server_name to your Vault's domain name. Example my domain name is "alvin.tech" with subdomain "vault".
You are now ready to launch your Vault cluster.
- In your server console go inside the director named vault-nginx and type docker network create vault-network then docker-compose up -d
$ cd vault-nginx
$ docker network create vault-network
$ docker-compose up -d
-
Go to your Vault's web ui https://vault.<your_domain_name>/ui You will be asked to initialize your vault with number of Key Shares and Key Threshold. This will create unseal keys and one to keep for yourself and others to be distributed to key personel. It's avisable to always have tow or more people to unseal the vault in an event that it was restarted. I recommend creating 3 key shares and 2 key threshold. You may distribute two keys to two personel that way in an event that one person is not available to unseal the vault with you, theres always one backup who could help you start it.
-
Download the keys it contains root token and I strongly suggest to put it in a safe container. I suggest using https://www.keybase.io and encrypt the token and your unseal key. After distributing the unseal keys delete the file. DO NOT KEEP ALL THE UNSEAL KEYS BY YOURSELF.
You may now store all your sensitive credentials like database URI's and password and let Vault rotate the credentials for you. There are lot of tutorials online on how to use it and it will open you to the world of confidential computing.