From 26ae50f90f239ed47cf4d02a10b461307d95d775 Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 14 Jun 2021 13:21:29 +0530 Subject: [PATCH] island: Create mongo key file securely before using it --- monkey/monkey_island/cc/server_utils/encryptor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/monkey/monkey_island/cc/server_utils/encryptor.py b/monkey/monkey_island/cc/server_utils/encryptor.py index 60ab8ead9..cfa5b751c 100644 --- a/monkey/monkey_island/cc/server_utils/encryptor.py +++ b/monkey/monkey_island/cc/server_utils/encryptor.py @@ -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):