get-hc-secrets 1.5.20__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.
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/PKG-INFO +1 -1
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/pyproject.toml +1 -1
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/src/getSecrets/__init__.py +9 -1
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/src/get_hc_secrets.egg-info/PKG-INFO +1 -1
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/tests/test_getsecrets.py +5 -1
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/LICENSE +0 -0
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/README.md +0 -0
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/setup.cfg +0 -0
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/src/get_hc_secrets.egg-info/SOURCES.txt +0 -0
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/src/get_hc_secrets.egg-info/dependency_links.txt +0 -0
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/src/get_hc_secrets.egg-info/requires.txt +0 -0
- {get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/src/get_hc_secrets.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: get_hc_secrets
|
|
3
|
-
Version: 1.5.
|
|
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,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
|
|
@@ -143,7 +150,8 @@ def upd_secret(id: str, data, repo: str = 'secret'):
|
|
|
143
150
|
# check if data is available in config file
|
|
144
151
|
if id in _config:
|
|
145
152
|
_config[id] = data
|
|
146
|
-
|
|
153
|
+
with open(join(_home, _config_file), 'w') as fd:
|
|
154
|
+
yaml.safe_dump(_config, fd)
|
|
147
155
|
return 200
|
|
148
156
|
|
|
149
157
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: get_hc_secrets
|
|
3
|
-
Version: 1.5.
|
|
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
|
|
@@ -11,9 +11,13 @@ class TestGetSecrets(unittest.TestCase):
|
|
|
11
11
|
self.assertTrue('test' in secrets)
|
|
12
12
|
|
|
13
13
|
def test_getsecrets(self):
|
|
14
|
+
|
|
15
|
+
secret = gs.get_secret('test')
|
|
16
|
+
secret['test'] = 'test1'
|
|
17
|
+
gs.upd_secret('test', secret)
|
|
14
18
|
secret = gs.get_secret('test')
|
|
15
19
|
self.assertTrue('test' in secret)
|
|
16
|
-
self.assertEqual(secret['test'], '
|
|
20
|
+
self.assertEqual(secret['test'], 'test1')
|
|
17
21
|
|
|
18
22
|
def test_usr_pwd(self):
|
|
19
23
|
usr, pwd = gs.get_user_pwd('test')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{get_hc_secrets-1.5.20 → get_hc_secrets-1.5.22}/src/get_hc_secrets.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|