Sfoglia il codice sorgente

Add support for configuring use of an SSL connection to Redis.

Requires a build or release of django-rq containing
https://github.com/rq/django-rq/pull/326/commits/44f3fdd7cbd94a4e0331befbb4a57c81e079cdbf
Alexander Kinneer 7 anni fa
parent
commit
e544705256

+ 7 - 0
docs/configuration/optional-settings.md

@@ -283,6 +283,7 @@ REDIS = {
     'PASSWORD': '',
     'PASSWORD': '',
     'DATABASE': 0,
     'DATABASE': 0,
     'DEFAULT_TIMEOUT': 300,
     'DEFAULT_TIMEOUT': 300,
+    'SSL': False,
 }
 }
 ```
 ```
 
 
@@ -315,3 +316,9 @@ The TCP port to use when connecting to the Redis server.
 Default: None
 Default: None
 
 
 The password to use when authenticating to the Redis server (optional).
 The password to use when authenticating to the Redis server (optional).
+
+### SSL
+
+Default: False
+
+Use secure sockets layer to encrypt the connections to the Redis server.

+ 1 - 0
netbox/extras/apps.py

@@ -22,6 +22,7 @@ class ExtrasConfig(AppConfig):
                     port=settings.REDIS_PORT,
                     port=settings.REDIS_PORT,
                     db=settings.REDIS_DATABASE,
                     db=settings.REDIS_DATABASE,
                     password=settings.REDIS_PASSWORD or None,
                     password=settings.REDIS_PASSWORD or None,
+                    ssl=settings.REDIS_SSL,
                 )
                 )
                 rs.ping()
                 rs.ping()
             except redis.exceptions.ConnectionError:
             except redis.exceptions.ConnectionError:

+ 1 - 0
netbox/netbox/configuration.example.py

@@ -132,6 +132,7 @@ REDIS = {
     'PASSWORD': '',
     'PASSWORD': '',
     'DATABASE': 0,
     'DATABASE': 0,
     'DEFAULT_TIMEOUT': 300,
     'DEFAULT_TIMEOUT': 300,
+    'SSL': False,
 }
 }
 
 
 # The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of
 # The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of

+ 2 - 0
netbox/netbox/settings.py

@@ -131,6 +131,7 @@ REDIS_PORT = REDIS.get('PORT', 6379)
 REDIS_PASSWORD = REDIS.get('PASSWORD', '')
 REDIS_PASSWORD = REDIS.get('PASSWORD', '')
 REDIS_DATABASE = REDIS.get('DATABASE', 0)
 REDIS_DATABASE = REDIS.get('DATABASE', 0)
 REDIS_DEFAULT_TIMEOUT = REDIS.get('DEFAULT_TIMEOUT', 300)
 REDIS_DEFAULT_TIMEOUT = REDIS.get('DEFAULT_TIMEOUT', 300)
+REDIS_SSL = REDIS.get('SSL', False)
 
 
 # Email
 # Email
 EMAIL_HOST = EMAIL.get('SERVER')
 EMAIL_HOST = EMAIL.get('SERVER')
@@ -291,6 +292,7 @@ RQ_QUEUES = {
         'DB': REDIS_DATABASE,
         'DB': REDIS_DATABASE,
         'PASSWORD': REDIS_PASSWORD,
         'PASSWORD': REDIS_PASSWORD,
         'DEFAULT_TIMEOUT': REDIS_DEFAULT_TIMEOUT,
         'DEFAULT_TIMEOUT': REDIS_DEFAULT_TIMEOUT,
+        'SSL': REDIS_SSL,
     }
     }
 }
 }