mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 11:25:08 -02:30
Merge pull request #4779 from omgjlk/proper-vault-headers
Use proper headers to auth with Vault Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -103,6 +103,8 @@ def kv_backend(**kwargs):
|
|||||||
|
|
||||||
sess = requests.Session()
|
sess = requests.Session()
|
||||||
sess.headers['Authorization'] = 'Bearer {}'.format(token)
|
sess.headers['Authorization'] = 'Bearer {}'.format(token)
|
||||||
|
# Compatability header for older installs of Hashicorp Vault
|
||||||
|
sess.headers['X-Vault-Token'] = token
|
||||||
|
|
||||||
if api_version == 'v2':
|
if api_version == 'v2':
|
||||||
if kwargs.get('secret_version'):
|
if kwargs.get('secret_version'):
|
||||||
@@ -158,6 +160,8 @@ def ssh_backend(**kwargs):
|
|||||||
|
|
||||||
sess = requests.Session()
|
sess = requests.Session()
|
||||||
sess.headers['Authorization'] = 'Bearer {}'.format(token)
|
sess.headers['Authorization'] = 'Bearer {}'.format(token)
|
||||||
|
# Compatability header for older installs of Hashicorp Vault
|
||||||
|
sess.headers['X-Vault-Token'] = token
|
||||||
# https://www.vaultproject.io/api/secret/ssh/index.html#sign-ssh-key
|
# https://www.vaultproject.io/api/secret/ssh/index.html#sign-ssh-key
|
||||||
request_url = '/'.join([url, secret_path, 'sign', role]).rstrip('/')
|
request_url = '/'.join([url, secret_path, 'sign', role]).rstrip('/')
|
||||||
resp = sess.post(request_url, **request_kwargs)
|
resp = sess.post(request_url, **request_kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user