Chapter 94: HashiCorp Vault and Secrets Management
94.1 Why a secrets service — not another encrypted file
Story (fictional teaching scenario). Priya in Pune and Daniel in Lisbon build a fictional bakery app. A copied database password lives in three CI jobs and six servers. Changing it means finding every copy. They need one controlled way to obtain credentials, not another spreadsheet.
Why
An encrypted file protects a stored copy. It does not by itself identify each running application, expire access or revoke a live database credential.
What
- Secret is sensitive information such as a password or private key.
- Secrets management is the lifecycle: store or generate, authorize access, deliver, rotate and revoke.
- Static secret is an existing value stored for later retrieval.
- Dynamic secret is a credential generated on demand with a limited lifetime; it needs a configured provider.
How
-
Inventory where sensitive values are used, without recording their values.
-
Separate humans, CI jobs and application identities.
-
Decide which values should be stored and which credentials could be generated.
Example 1: A lifecycle, without a password
- Read the command or request.
Application -> authenticate -> read permitted path -> use in memory
Rotation -> publish replacement -> refresh clients -> retire old credential
- Read the result.
Output (illustrative; NOT executed against Vault)
Each caller gets only the access its job requires.
- Line by line: The arrows describe a delivery plan, not a network test. Rotation means changing the underlying credential too, not just renaming a variable. A fictional shop may spend ₹5000 or €60 on a training budget; those are story amounts, not a Vault license/hosting quote.
Ravindra Bagale's Tip
Central storage is only useful with scoped identities and a tested refresh plan.
Scoped identity आणि refresh plan असेल तरच central storage उपयोगी पडतं.
Scoped identity और refresh plan के साथ ही central storage उपयोगी है.
Did you understand? Let us try it once more.