diff options
author | Mike Crute <mike@crute.us> | 2021-07-12 02:38:40 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2021-07-12 02:38:40 +0000 |
commit | af3c8cf29bc2acc99d73c663c51a806096f0758c (patch) | |
tree | 869a71ce813857373e2a2b9fce79de397c08f581 | |
parent | 763b810ca1a9d755205e49b1246025b83abb5132 (diff) | |
download | dockerfiles-af3c8cf29bc2acc99d73c663c51a806096f0758c.tar.bz2 dockerfiles-af3c8cf29bc2acc99d73c663c51a806096f0758c.tar.xz dockerfiles-af3c8cf29bc2acc99d73c663c51a806096f0758c.zip |
netbox: update to 2.11.9
-rw-r--r-- | netbox/Makefile | 2 | ||||
-rw-r--r-- | netbox/config-patch1.diff | 6 | ||||
-rw-r--r-- | netbox/config-patch2.diff | 15 | ||||
-rw-r--r-- | netbox/django-driver.py | 8 | ||||
-rw-r--r-- | netbox/django-vault-client.py | 4 |
5 files changed, 25 insertions, 10 deletions
diff --git a/netbox/Makefile b/netbox/Makefile index ffe7e64..1fb4dad 100644 --- a/netbox/Makefile +++ b/netbox/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | VERSION=2.10.3 | 1 | VERSION=2.11.9 |
2 | IMAGE=docker.crute.me/netbox:$(VERSION) | 2 | IMAGE=docker.crute.me/netbox:$(VERSION) |
3 | LATEST=$(subst :$(VERSION),,$(IMAGE)):latest | 3 | LATEST=$(subst :$(VERSION),,$(IMAGE)):latest |
4 | 4 | ||
diff --git a/netbox/config-patch1.diff b/netbox/config-patch1.diff index be5b068..cc5c6d2 100644 --- a/netbox/config-patch1.diff +++ b/netbox/config-patch1.diff | |||
@@ -1,5 +1,5 @@ | |||
1 | --- a/opt/netbox/netbox/netbox/configuration.py | 1 | --- a/opt/netbox/netbox/netbox/configuration.py 2021-07-11 22:24:55.365668931 +0000 |
2 | +++ b/opt/netbox/netbox/netbox/configuration.py | 2 | +++ b/opt/netbox/netbox/netbox/configuration.py 2021-07-11 22:25:25.077103585 +0000 |
3 | @@ -4,11 +4,13 @@ | 3 | @@ -4,11 +4,13 @@ |
4 | # # | 4 | # # |
5 | ######################### | 5 | ######################### |
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | # PostgreSQL database configuration. See the Django documentation for a complete list of available parameters: | 16 | # PostgreSQL database configuration. See the Django documentation for a complete list of available parameters: |
17 | # https://docs.djangoproject.com/en/stable/ref/settings/#databases | 17 | # https://docs.djangoproject.com/en/stable/ref/settings/#databases |
18 | @@ -51,7 +53,7 @@ | 18 | @@ -57,7 +59,7 @@ |
19 | # For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and | 19 | # For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and |
20 | # symbols. NetBox will not run without this defined. For more information, see | 20 | # symbols. NetBox will not run without this defined. For more information, see |
21 | # https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY | 21 | # https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY |
diff --git a/netbox/config-patch2.diff b/netbox/config-patch2.diff index 5983cc1..69162e4 100644 --- a/netbox/config-patch2.diff +++ b/netbox/config-patch2.diff | |||
@@ -1,5 +1,5 @@ | |||
1 | --- a/opt/netbox/netbox/netbox/configuration.py | 1 | --- a/opt/netbox/netbox/netbox/configuration.py 2021-07-11 22:24:55.365668931 +0000 |
2 | +++ b/opt/netbox/netbox/netbox/configuration.py | 2 | +++ b/opt/netbox/netbox/netbox/configuration.py 2021-07-11 22:28:09.665982854 +0000 |
3 | @@ -4,21 +4,35 @@ | 3 | @@ -4,21 +4,35 @@ |
4 | # # | 4 | # # |
5 | ######################### | 5 | ######################### |
@@ -43,7 +43,7 @@ | |||
43 | } | 43 | } |
44 | 44 | ||
45 | # Redis database settings. Redis is used for caching and for queuing background tasks such as webhook events. A separate | 45 | # Redis database settings. Redis is used for caching and for queuing background tasks such as webhook events. A separate |
46 | @@ -26,23 +40,23 @@ | 46 | @@ -26,26 +40,26 @@ |
47 | # to use two separate database IDs. | 47 | # to use two separate database IDs. |
48 | REDIS = { | 48 | REDIS = { |
49 | 'tasks': { | 49 | 'tasks': { |
@@ -57,6 +57,9 @@ | |||
57 | - 'DATABASE': 0, | 57 | - 'DATABASE': 0, |
58 | + 'DATABASE': int(os.getenv("NETBOX_REDIS_TASK_DB")), | 58 | + 'DATABASE': int(os.getenv("NETBOX_REDIS_TASK_DB")), |
59 | 'SSL': False, | 59 | 'SSL': False, |
60 | # Set this to True to skip TLS certificate verification | ||
61 | # This can expose the connection to attacks, be careful | ||
62 | # 'INSECURE_SKIP_TLS_VERIFY': False, | ||
60 | }, | 63 | }, |
61 | 'caching': { | 64 | 'caching': { |
62 | - 'HOST': 'localhost', | 65 | - 'HOST': 'localhost', |
@@ -69,9 +72,9 @@ | |||
69 | - 'DATABASE': 1, | 72 | - 'DATABASE': 1, |
70 | + 'DATABASE': int(os.getenv("NETBOX_REDIS_CACHE_DB")), | 73 | + 'DATABASE': int(os.getenv("NETBOX_REDIS_CACHE_DB")), |
71 | 'SSL': False, | 74 | 'SSL': False, |
72 | } | 75 | # Set this to True to skip TLS certificate verification |
73 | } | 76 | # This can expose the connection to attacks, be careful |
74 | @@ -51,7 +65,14 @@ | 77 | @@ -57,7 +71,14 @@ |
75 | # For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and | 78 | # For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and |
76 | # symbols. NetBox will not run without this defined. For more information, see | 79 | # symbols. NetBox will not run without this defined. For more information, see |
77 | # https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY | 80 | # https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY |
diff --git a/netbox/django-driver.py b/netbox/django-driver.py index 65a9136..80bfa13 100644 --- a/netbox/django-driver.py +++ b/netbox/django-driver.py | |||
@@ -28,12 +28,20 @@ class DatabaseWrapper(OrigWrapper): | |||
28 | self._vault_cache_lock = threading.Lock() | 28 | self._vault_cache_lock = threading.Lock() |
29 | self._vault_cred_cache = Credential.empty() | 29 | self._vault_cred_cache = Credential.empty() |
30 | 30 | ||
31 | def close(self): | ||
32 | self._vault_cred_cache = Credential.empty() | ||
33 | super().close() | ||
34 | |||
31 | def close_if_unusable_or_obsolete(self): | 35 | def close_if_unusable_or_obsolete(self): |
32 | super().close_if_unusable_or_obsolete() | 36 | super().close_if_unusable_or_obsolete() |
33 | 37 | ||
34 | if self.connection is None: | 38 | if self.connection is None: |
35 | return | 39 | return |
36 | 40 | ||
41 | if not self.is_usable(): | ||
42 | self.close() | ||
43 | return | ||
44 | |||
37 | with self._vault_cache_lock: | 45 | with self._vault_cache_lock: |
38 | if not self._vault_cred_cache.is_valid: | 46 | if not self._vault_cred_cache.is_valid: |
39 | self.close() | 47 | self.close() |
diff --git a/netbox/django-vault-client.py b/netbox/django-vault-client.py index e699db3..85b5671 100644 --- a/netbox/django-vault-client.py +++ b/netbox/django-vault-client.py | |||
@@ -73,6 +73,10 @@ class SimpleVaultClient: | |||
73 | url = parse.urljoin(self.base_url, parse.urljoin("/v1/", url)) | 73 | url = parse.urljoin(self.base_url, parse.urljoin("/v1/", url)) |
74 | req = request.Request(url, headers=headers, data=data) | 74 | req = request.Request(url, headers=headers, data=data) |
75 | res = request.urlopen(req, context=context) | 75 | res = request.urlopen(req, context=context) |
76 | |||
77 | if res.status != 200: | ||
78 | raise Exception("Failed to fetch credential from vault") | ||
79 | |||
76 | return json.load(res) | 80 | return json.load(res) |
77 | 81 | ||
78 | def get_kv_secret(self, path, key): | 82 | def get_kv_secret(self, path, key): |