Skip to content

eidam/personal-zero-trust-hashicorp-vault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Personal Zero-Trust HashiCorp Vault

Secrets are hard, especially for local development. This is why I took two of my favorite products (Cloudflare For Teams and HashiCorp Vault) and used them together to come up with a Zero-Trust Vault deployment that is easy to use from any of my workstations.

The focus was to achieve fast deployment and easy maintenance. Terraform takes care of the full deployment, and the full stack is deployed with two terraform apply commands, everything is configured and ready to go within minutes.

TLDR Stack

  • Terraform putting everything together ❤️
  • Cloudflare for Teams
    • Cloudflare Tunnel (exposing Vault, SSH to internet)
    • Cloudflare Access
      • Vault UI (generic Cloudflare Access app)
      • SSH Web Terminal (SSH access to GCE instance)
      • JWT Auth backend (Vault auth)
    • Cloudflare WARP to private network (through Tunnel)
  • Google Cloud Platform
    • GCE Instance (with deny-all incoming traffic)
    • GCS Bucket (Vault storage)
    • Secret Manager (Cloudflare Tunnel credentials store)
    • (optional) KMS (for Vault auto-unseal)

Estimated Costs

Cloudflare

Free. (for up to 50 users)

Google Cloud Platform

I cannot tell the exact GCP costs of this stack yet, but there is a Free Tier for the default machine type.

If you want to change the region, just note that only some regions are eligible for the GCP Free Tier.

Deployment

The deployment process consists of two steps. The first one (Infra) is to deploy the Zero-Trust stack and the second one is configuring the Vault itself.

1. Pre-requisities

In order to deploy this stack, make sure you have:

2. Infra

Please refer to infra folder

3. Vault configuration

Please refer to vault-config folder

Couple of notes

  • Cloudflare Teams tunnels IP routes are Terraformed using REST provider, this will be changed to official cloudflare provider once supported.
  • OIDC auth flow or automatic WARP auth to get the JWT token would be better, this will be implemented if and once supported.
  • Why? You may ask. The next step is to configure my local development to load ENV variables based on the project directory.