Island: Move island log file registration to setup_server.py

This commit is contained in:
Mike Salvatore 2022-08-12 12:02:23 -04:00
parent fdc041ead6
commit d6e0b03a64
2 changed files with 4 additions and 4 deletions

View File

@ -13,6 +13,7 @@ from gevent.pywsgi import WSGIServer
from monkey_island.cc import Version
from monkey_island.cc.deployment import Deployment
from monkey_island.cc.server_utils.consts import ISLAND_PORT
from monkey_island.cc.server_utils.island_logger import get_log_file_path
from monkey_island.cc.setup.config_setup import get_server_config
# Add the monkey_island directory to the path, to make sure imports that don't start with
@ -120,6 +121,7 @@ def _initialize_di_container(
container.register_convention(Sequence[str], "ip_addresses", ip_addresses)
container.register_instance(Version, version)
container.register_convention(Path, "data_dir", data_dir)
container.register_convention(Path, "island_log_file_path", get_log_file_path(data_dir))
initialize_services(container, data_dir)

View File

@ -34,7 +34,6 @@ from monkey_island.cc.repository import (
)
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.server_utils.island_logger import get_log_file_path
from monkey_island.cc.services import AWSService, IslandModeService, RepositoryService
from monkey_island.cc.services.attack.technique_reports.T1003 import T1003, T1003GetReportData
from monkey_island.cc.services.run_local_monkey import LocalMonkeyRunService
@ -56,7 +55,7 @@ REPOSITORY_KEY_FILE_NAME = "repository_key.bin"
def initialize_services(container: DIContainer, data_dir: Path):
_register_conventions(container, data_dir)
_register_conventions(container)
container.register_instance(AWSInstance, AWSInstance())
container.register_instance(MongoClient, MongoClient(MONGO_URL, serverSelectionTimeoutMS=100))
@ -79,7 +78,7 @@ def initialize_services(container: DIContainer, data_dir: Path):
)
def _register_conventions(container: DIContainer, data_dir: Path):
def _register_conventions(container: DIContainer):
container.register_convention(
AgentConfiguration, "default_agent_configuration", DEFAULT_AGENT_CONFIGURATION
)
@ -88,7 +87,6 @@ def _register_conventions(container: DIContainer, data_dir: Path):
"default_ransomware_agent_configuration",
DEFAULT_RANSOMWARE_AGENT_CONFIGURATION,
)
container.register_convention(Path, "island_log_file_path", get_log_file_path(data_dir))
def _register_repositories(container: DIContainer, data_dir: Path):