Modify server_config.json ssl cert fields
This commit is contained in:
parent
2b73ec75c8
commit
42a9a79800
|
@ -99,6 +99,7 @@ def _start_island_server(should_setup_only, config_options: IslandConfigOptions)
|
||||||
http_server = WSGIServer(
|
http_server = WSGIServer(
|
||||||
("0.0.0.0", env_singleton.env.get_island_port()),
|
("0.0.0.0", env_singleton.env.get_island_port()),
|
||||||
app,
|
app,
|
||||||
|
# TODO: modify next two lines?
|
||||||
certfile=os.environ.get("SERVER_CRT", crt_path),
|
certfile=os.environ.get("SERVER_CRT", crt_path),
|
||||||
keyfile=os.environ.get("SERVER_KEY", key_path),
|
keyfile=os.environ.get("SERVER_KEY", key_path),
|
||||||
)
|
)
|
||||||
|
|
|
@ -50,3 +50,8 @@ DEFAULT_START_MONGO_DB = True
|
||||||
|
|
||||||
DEFAULT_CRT_PATH = str(Path(MONKEY_ISLAND_ABS_PATH, "cc", "server.crt"))
|
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_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,
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from monkey_island.cc.server_utils.consts import (
|
from monkey_island.cc.server_utils.consts import (
|
||||||
|
DEFAULT_CERTIFICATE_PATHS,
|
||||||
DEFAULT_CRT_PATH,
|
DEFAULT_CRT_PATH,
|
||||||
DEFAULT_DATA_DIR,
|
DEFAULT_DATA_DIR,
|
||||||
DEFAULT_KEY_PATH,
|
DEFAULT_KEY_PATH,
|
||||||
|
@ -24,10 +25,14 @@ class IslandConfigOptions:
|
||||||
).get("start_mongodb", DEFAULT_START_MONGO_DB)
|
).get("start_mongodb", DEFAULT_START_MONGO_DB)
|
||||||
|
|
||||||
self.crt_path = IslandConfigOptions._expand_path(
|
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(
|
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
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue