mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Add requests verify option in vault section
This fix allow pass requests 'verify' option from vault configs If vault certificate signed with Intermediate CA, and Intermedia CA sign by internal root CA, requests will fail verifying vault certificate with error: _ssl.c:510: ... routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed 'verify' option allow explicitly specify ca-bundle, or disable verifications. http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
This commit is contained in:
parent
5d719a2219
commit
56c91f0895
@ -16,6 +16,7 @@ Functions to interact with Hashicorp Vault.
|
||||
|
||||
vault:
|
||||
url: https://vault.service.domain:8200
|
||||
verify: /etc/ssl/certs/ca-certificates.crt
|
||||
auth:
|
||||
method: token
|
||||
token: 11111111-2222-3333-4444-555555555555
|
||||
@ -27,6 +28,10 @@ Functions to interact with Hashicorp Vault.
|
||||
url
|
||||
Url to your Vault installation. Required.
|
||||
|
||||
verify
|
||||
For details please see
|
||||
http://docs.python-requests.org/en/master/user/advanced/#ssl-cert-verification
|
||||
|
||||
auth
|
||||
Currently only token auth is supported. The token must be able to create
|
||||
tokens with the policies that should be assigned to minions. Required.
|
||||
|
@ -56,8 +56,10 @@ def generate_token(minion_id, signature, impersonated_by_master=False):
|
||||
'metadata': audit_data
|
||||
}
|
||||
|
||||
verify = config.get('verify', None)
|
||||
|
||||
log.trace('Sending token creation request to Vault')
|
||||
response = requests.post(url, headers=headers, json=payload)
|
||||
response = requests.post(url, headers=headers, json=payload, verify=verify)
|
||||
|
||||
if response.status_code != 200:
|
||||
return {'error': response.reason}
|
||||
|
@ -124,6 +124,9 @@ def make_request(method, resource, profile=None, **args):
|
||||
connection = _get_vault_connection()
|
||||
token, vault_url = connection['token'], connection['url']
|
||||
|
||||
if "verify" not in args:
|
||||
args["verify"] = __opts__['vault'].get('verify', None)
|
||||
|
||||
url = "{0}/{1}".format(vault_url, resource)
|
||||
headers = {'X-Vault-Token': token, 'Content-Type': 'application/json'}
|
||||
response = requests.request(method, url, headers=headers, **args)
|
||||
|
Loading…
Reference in New Issue
Block a user