From e8ebe845bfc574eef4a6e3ddfa87dad89235b4e3 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 12 Jul 2022 11:25:10 -0400 Subject: [PATCH] Island: Register RepositoryEncryptor with the DIContainer --- monkey/monkey_island/cc/services/initialize.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/monkey/monkey_island/cc/services/initialize.py b/monkey/monkey_island/cc/services/initialize.py index 4f326f58d..a622b091c 100644 --- a/monkey/monkey_island/cc/services/initialize.py +++ b/monkey/monkey_island/cc/services/initialize.py @@ -31,6 +31,7 @@ from monkey_island.cc.repository import ( RetrievalError, ) from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH +from monkey_island.cc.server_utils.encryption import ILockableEncryptor, RepositoryEncryptor from monkey_island.cc.services import AWSService, IslandModeService from monkey_island.cc.services.post_breach_files import PostBreachFilesService from monkey_island.cc.services.run_local_monkey import LocalMonkeyRunService @@ -48,6 +49,7 @@ from .reporting.report import ReportService logger = logging.getLogger(__name__) AGENT_BINARIES_PATH = Path(MONKEY_ISLAND_ABS_PATH) / "cc" / "binaries" +REPOSITORY_KEY_FILE_NAME = "repository_key.bin" def initialize_services(data_dir: Path) -> DIContainer: @@ -56,6 +58,9 @@ def initialize_services(data_dir: Path) -> DIContainer: container.register_instance(AWSInstance, AWSInstance()) container.register_instance(MongoClient, MongoClient(MONGO_URL, serverSelectionTimeoutMS=100)) + container.register_instance( + ILockableEncryptor, RepositoryEncryptor(data_dir / REPOSITORY_KEY_FILE_NAME) + ) _register_repositories(container, data_dir) _register_services(container)