Skip to content

Instantly share code, notes, and snippets.

@kaxil
Last active March 27, 2020 19:36
Show Gist options
  • Save kaxil/b318396094891a015441ba611dfc7c57 to your computer and use it in GitHub Desktop.
Save kaxil/b318396094891a015441ba611dfc7c57 to your computer and use it in GitHub Desktop.
Retrieve Secret from Hashicorp Vault
In [1]: import hvac
In [2]: client=hvac.Client(url="http://127.0.0.1:8200")
In [3]: client.token = "<YOUR-ROOT-TOKEN>"
In [4]: client.is_authenticated()
Out[4]: True
In [5]: client.secrets.kv.v2.read_secret_version(path="connections/smtp_default")
Out[5]:
{'request_id': '04857d45-a960-011c-f1f1-ba4011a1cccc',
'lease_id': '',
'renewable': False,
'lease_duration': 0,
'data': {'data': {'conn_uri': 'smtps://user:host@relay.example.com:465'},
'metadata': {'created_time': '2020-03-26T16:09:34.412794Z',
'deletion_time': '',
'destroyed': False,
'version': 1}},
'wrap_info': None,
'warnings': None,
'auth': None}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment