From 4e9e975425208b4f332c68cdded23fe097fcfb86 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 15 Sep 2022 18:11:37 +0200 Subject: [PATCH] Added notes about Hashicorp Vault to the KB --- knowledge base/vault.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 knowledge base/vault.md diff --git a/knowledge base/vault.md b/knowledge base/vault.md new file mode 100644 index 0000000..b3305df --- /dev/null +++ b/knowledge base/vault.md @@ -0,0 +1,39 @@ +# Hashicorp Vault + +## TL;DR + +```shell +# Install the CLI. +brew tap hashicorp/tap && brew install hashicorp/tap/vault + +# Settings. +export VAULT_ADDR='https://vault.address/' +export VAULT_NAMESPACE='namespace_name' + +# Check the connection to the Vault server. +vault status + +# Login. +vault login +vault login -method='oidc' + +# Unwrap a token. +# This operation may only be attempted once; after this attempt, the token will +# die and will need to be regenerated. +export VAULT_TOKEN='s.WVDAitOTTTfcjlklwk8AADDs' && vault unwrap + +# Create a secret. +vault kv put secret/demo-app/config username='foo' password='bar' + +# Get a secret. +# Note: "data" need to be added here in the path (secret/demo-app/config), as +# it is a property of the Vault API. +vault read -format 'json' 'secret/data/demo-app/config' +``` + +## Further readings + +- [HashiCorp Vault] + + +[hashicorp vault]: https://www.vaultproject.io/