Getting started with HashiCorp Vault

Tobi's Developer Corner
Tobi's Developer Corner
25.3 هزار بار بازدید - 3 سال پیش - In this video I will
In this video I will give you an introduction to HashiCorp Vault and how you can run it locally in a Docker container (in Development mode). I will walk you through the process of getting the docker image and setting everything up to successfully connect to the vault server and write and read secrets.

COMMANDS
Get docker image: docker pull vault

Running image: docker run -d --rm --name vault-server --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=tdc-token' -e 'VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200' vault

Get IP Address: docker inspect vault-server | grep IPAddress

Set environment variable: export VAULT_ADDR='http://172.17.0.2:8200'

Authenticate to server from CLI: vault login

Write secret (CLI): vault kv put secret/tdc tdcpassword=test1234

Read secret (CLI): vault kv get secret/tdc

INFO
vault info: https://vaultproject.io
vault CLI download: https://vaultproject.io/downloads
docker image at: https://hub.docker.com/_/vault
hvac info at: https://hvac.readthedocs.io/en/stable...

==========================

Python script (run pip install hvac first!):

import hvac

client = hvac.Client(url='http://172.17.0.2:8200',token="tdc-token")
print(client.is_authenticated())
read_response = client.secrets.kv.read_secret_version(path='tdc')

print(read_response['data']['data']['tdcpassword'])
3 سال پیش در تاریخ 1400/11/17 منتشر شده است.
25,313 بـار بازدید شده
... بیشتر