InfraCityOpen editor

Secrets & Vault

Secrets live in one guarded place, are handed to apps for a short time, and are rotated without a deploy.

Secrets & Vault, drawn as an isometric city

The CityScript

This is all there is to it. Change it in the editor and the city redraws.

%% S · Secrets & Vault
%% Apps never hold a long-lived password: an agent fetches a short-lived one and renews it.
city 48x32

district vault "Vault cluster" 3,3..23,13
district apps "Applications" 28,3..45,16

building kms tower in vault "KMS"
  floor kms.f "Auto unseal"
    room kms.key config "Master key" secret=master-key
building vault-1 depot in vault "Vault 1"
  floor vault-1.f "Raft node"
    room vault-1.core service "Vault, leader" port=8200 secret=unseal-key
    room vault-1.store storage "Encrypted store"
building vault-2 depot in vault "Vault 2"
  floor vault-2.f "Raft node"
    room vault-2.core service "Vault, follower" port=8200 secret=unseal-key
building shop factory in apps "Shop"
  floor shop.f "App"
    room shop.api service "API" port=8080
    room shop.agent worker "Vault agent" secret=vault-token
building billing factory in apps "Billing"
  floor billing.f "App"
    room billing.api service "API" port=8080
    room billing.agent worker "Vault agent" secret=vault-token

boundary vault-zone "Vault cluster" members=kms,vault-1,vault-2
boundary app-zone "Applications" members=shop,billing

pipeline rotate "Rotate the database password" vault-1 -> [generate] -> [update-database] -> [distribute] -> [revoke-old] -> shop
  step vault-1 "The vault creates a new database password"
  step shop "The shop gets the new password and the old one stops working"
link kms.key -> vault-1.core "auto unseal" variant=security
link vault-1.core -> vault-2.core "Raft replication" variant=dashed
link shop.agent -> vault-1.core "fetch lease" variant=security
link billing.agent -> vault-1.core "fetch lease" variant=security
link shop.agent -> shop.api "hands over" variant=security