diff --git a/monkey/monkey_island/cc/server_setup.py b/monkey/monkey_island/cc/server_setup.py index 61c6d19c8..fbd61982a 100644 --- a/monkey/monkey_island/cc/server_setup.py +++ b/monkey/monkey_island/cc/server_setup.py @@ -99,6 +99,7 @@ def _start_island_server(should_setup_only, config_options: IslandConfigOptions) http_server = WSGIServer( ("0.0.0.0", env_singleton.env.get_island_port()), app, + # TODO: modify next two lines? certfile=os.environ.get("SERVER_CRT", crt_path), keyfile=os.environ.get("SERVER_KEY", key_path), ) diff --git a/monkey/monkey_island/cc/server_utils/consts.py b/monkey/monkey_island/cc/server_utils/consts.py index 333008c6d..9149d81b1 100644 --- a/monkey/monkey_island/cc/server_utils/consts.py +++ b/monkey/monkey_island/cc/server_utils/consts.py @@ -50,3 +50,8 @@ DEFAULT_START_MONGO_DB = True DEFAULT_CRT_PATH = str(Path(MONKEY_ISLAND_ABS_PATH, "cc", "server.crt")) DEFAULT_KEY_PATH = str(Path(MONKEY_ISLAND_ABS_PATH, "cc", "server.key")) + +DEFAULT_CERTIFICATE_PATHS = { + "ssl_certificate_file": DEFAULT_CRT_PATH, + "ssl_certificate_key_file": DEFAULT_KEY_PATH, +} diff --git a/monkey/monkey_island/cc/setup/island_config_options.py b/monkey/monkey_island/cc/setup/island_config_options.py index 664159944..fb94e6396 100644 --- a/monkey/monkey_island/cc/setup/island_config_options.py +++ b/monkey/monkey_island/cc/setup/island_config_options.py @@ -3,6 +3,7 @@ from __future__ import annotations import os from monkey_island.cc.server_utils.consts import ( + DEFAULT_CERTIFICATE_PATHS, DEFAULT_CRT_PATH, DEFAULT_DATA_DIR, DEFAULT_KEY_PATH, @@ -24,10 +25,14 @@ class IslandConfigOptions: ).get("start_mongodb", DEFAULT_START_MONGO_DB) self.crt_path = IslandConfigOptions._expand_path( - config_contents.get("cert_path", DEFAULT_CRT_PATH) + config_contents.get("ssl_certificate", DEFAULT_CERTIFICATE_PATHS).get( + "ssl_certificate_file", DEFAULT_CRT_PATH + ) ) self.key_path = IslandConfigOptions._expand_path( - config_contents.get("key_path", DEFAULT_KEY_PATH) + config_contents.get("ssl_certificate", DEFAULT_CERTIFICATE_PATHS).get( + "ssl_certificate_key_file", DEFAULT_KEY_PATH + ) ) @staticmethod