get-hc-secrets 1.5.21__tar.gz → 1.5.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: get_hc_secrets
3
- Version: 1.5.21
3
+ Version: 1.5.22
4
4
  Summary: A package to read secrets from Hashicorp vault or from a local file
5
5
  Author-email: Xavier Mayeur <xavier@mayeur.be>
6
6
  Project-URL: Homepage, https://github.com/xmayeur/getSecrets
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "get_hc_secrets"
3
- version = '1.5.21'
3
+ version = '1.5.22'
4
4
  authors = [
5
5
  { name = "Xavier Mayeur", email = "xavier@mayeur.be" }
6
6
  ]
@@ -1,5 +1,7 @@
1
1
  import logging
2
2
  import os
3
+ import re
4
+ import socket
3
5
  import sys
4
6
  from os import getenv
5
7
  from os.path import join
@@ -7,6 +9,7 @@ from os.path import join
7
9
  import requests
8
10
  import urllib3
9
11
  import yaml
12
+ from certifi import where
10
13
 
11
14
  logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s',
12
15
  datefmt='%m/%d/%Y %I:%M:%S %p')
@@ -49,6 +52,10 @@ def get_secret(id: str, repo: str = 'secret') -> dict:
49
52
  certs = '/etc/vault/bundle.pem'
50
53
  else:
51
54
  certs = join(_home, _config['vault']['certs'].replace("~/", ''))
55
+ hostname = re.sub(r'https://(.*?)[:/?].*', r'\1', base_url)
56
+ ip = socket.gethostbyname(hostname)
57
+ if '192.168.' not in ip:
58
+ certs = where()
52
59
  # check if file exist, else make insecure
53
60
  if not (os.path.exists(certs)):
54
61
  certs = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: get_hc_secrets
3
- Version: 1.5.21
3
+ Version: 1.5.22
4
4
  Summary: A package to read secrets from Hashicorp vault or from a local file
5
5
  Author-email: Xavier Mayeur <xavier@mayeur.be>
6
6
  Project-URL: Homepage, https://github.com/xmayeur/getSecrets
File without changes