mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 20:40:13 +03:00
feat(config): add encryption key loading for sensitive data
Add a new method `_load_encryption_key` to initialize encryption for sensitive data such as API keys. This method is called within `_load_secret_files` alongside JWT secret key loading, ensuring encryption is set up during server configuration. The change enhances security by enabling encryption for secrets stored in the server's secrets directory.
This commit is contained in:
parent
8fad27d904
commit
9315f06e1f
@ -225,6 +225,17 @@ class Config:
|
||||
except OSError as e:
|
||||
log.error(f"Could not read JWT secret key file '{jwt_secret_key_path}': {e}")
|
||||
|
||||
def _load_encryption_key(self):
|
||||
"""
|
||||
Load the encryption key for sensitive data (API keys, etc.).
|
||||
"""
|
||||
from .utils.encryption import init_encryption
|
||||
|
||||
try:
|
||||
init_encryption(self._settings.Server.secrets_dir)
|
||||
except Exception as e:
|
||||
log.error(f"Could not initialize encryption: {e}")
|
||||
|
||||
def _load_secret_files(self):
|
||||
"""
|
||||
Load the secret files.
|
||||
@ -234,6 +245,7 @@ class Config:
|
||||
self._settings.Server.secrets_dir = os.path.dirname(self.server_config)
|
||||
|
||||
self._load_jwt_secret_key()
|
||||
self._load_encryption_key()
|
||||
|
||||
def read_config(self):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user