Hashicorp Consul and Vault

Why?

Centralized secrets management vault to store API keys, passwords, certificates, and tokens in one secure location. This eleminates secret sprawl and provides encryption. This can also eliminate clear text passwords in automation and deployment scripts. Every operation is also logged so if a breach does happen you can trace it back to the source.

Installation

It is best practice to install the vault on a VM or dedicated machine which is isolated from any production environment or public network. You should have it be accessible through a VPN or zero trust network.

I will be installing it on an isolated Ubuntu server VM in my Proxmox datacenter.

Below is a practical, homelab‑friendly guide that assumes:

  • You have multiple nodes (Proxmox VMs, cloud VMs, containers, etc.)
  • Everything is reachable over Tailscale for management
  • You want Consul as the storage backend for Vault
  • You want to use Ansible to automate secrets distribution and operations

Let’s build this in a way that mirrors real enterprise patterns but stays lightweight.


Architecture Overview
Vault
  • Stores secrets, issues dynamic credentials, signs SSH certs, etc.
  • Runs on 1–3 nodes (start with 1 for homelab)
  • Uses Consul as its storage backend
Consul
  • Provides service discovery + KV store
  • Acts as Vault’s highly available storage backend
  • Runs on 1–3 nodes (start with 1)
Tailscale
  • Provides secure overlay network
  • Allows Vault/Consul nodes to communicate without exposing ports publicly
  • Lets Ansible reach Vault securely from anywhere
Network Layout (Recommended)
ComponentNetworkNotes
VaultTailscale network (100.x.x.x)Management + API access
ConsulTailscale networkCluster gossip + Vault backend
Ansible controllerTailscale networkUses Vault for secrets
Proxmox hostsTailscale networkOptional: use Vault for SSH certs

You do not need to expose Vault or Consul to your LAN or WAN. Tailscale is your secure transport.


Step 1 — Prepare Your Nodes

On each VM/container that will run Vault or Consul:

Make sure nodes can ping each other via Tailscale:


Step 2 — Install Consul
Add HashiCorp repo
Create Consul config

/etc/consul.d/consul.hcl

IF you would like to enable TLS, add this stanzas:

Enable and start:

Check status:

You should see the node bound to its Tailscale IP.


Step 3 — Install Vault
Create Vault config

/etc/vault.d/vault.hcl

If you are enabling TLS, add this stanza:

Start Vault:


Step 4 — Initialize & Unseal Vault

Initialize:

vault operator init

Save:

  • Unseal keys
  • Root token

Unseal:

Enable KV v2 (Key/Value v2 engine)

Login:


Step 5 — Verify Vault + Consul Integration

Check Vault storage:

Check Consul KV:

If you see a leader entry, Vault is successfully using Consul.


Step 6 — Secure Vault Access Over Tailscale
Allow only Tailscale subnet to reach Vault

Vault is already bound to tailscale0, so it’s isolated.

If you want to restrict further:


Optional Enhancements (Highly Recommended)
Enable Vault SSH CA

Issue short‑lived SSH certs for Proxmox, Linux VMs, and containers.

Enable auto‑unseal

Use:

  • Tailscale SSH
  • Transit auto‑unseal (if you run a second Vault)
  • Cloud KMS (AWS/GCP/Azure)



Leave a Reply

Your email address will not be published. Required fields are marked *