island: Create mongo key file securely before using it

This commit is contained in:
Shreya 2021-06-14 13:21:29 +05:30
parent ff85360639
commit 26ae50f90f
1 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,8 @@ import os
from Crypto import Random # 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"
_encryptor = None
@ -21,6 +23,7 @@ class Encryptor:
if os.path.exists(password_file):
self._load_existing_key(password_file)
else:
create_secure_file(path=password_file)
self._init_key(password_file)
def _init_key(self, password_file):