forked from p15670423/monkey
island: Create mongo key file securely before using it
This commit is contained in:
parent
ff85360639
commit
26ae50f90f
|
@ -6,6 +6,8 @@ import os
|
||||||
from Crypto import Random # noqa: DUO133 # nosec: B413
|
from Crypto import Random # noqa: DUO133 # nosec: B413
|
||||||
from Crypto.Cipher import AES # noqa: DUO133 # nosec: B413
|
from Crypto.Cipher import AES # noqa: DUO133 # nosec: B413
|
||||||
|
|
||||||
|
from monkey_island.cc.environment.utils import create_secure_file
|
||||||
|
|
||||||
__author__ = "itay.mizeretz"
|
__author__ = "itay.mizeretz"
|
||||||
|
|
||||||
_encryptor = None
|
_encryptor = None
|
||||||
|
@ -21,6 +23,7 @@ class Encryptor:
|
||||||
if os.path.exists(password_file):
|
if os.path.exists(password_file):
|
||||||
self._load_existing_key(password_file)
|
self._load_existing_key(password_file)
|
||||||
else:
|
else:
|
||||||
|
create_secure_file(path=password_file)
|
||||||
self._init_key(password_file)
|
self._init_key(password_file)
|
||||||
|
|
||||||
def _init_key(self, password_file):
|
def _init_key(self, password_file):
|
||||||
|
|
Loading…
Reference in New Issue