Commit Graph

5173 Commits

Author SHA1 Message Date
Mike Salvatore 0519153aaf island: Move _expand_path() to file_utils.py so it can be reused 2021-06-07 13:04:38 -04:00
Mike Salvatore e4866b1286 island: Change _expand_path() from a static to regular function
_expand_path() is a utility function used by IslandConfigOptions. It
doesn't need to be part of the class. It can potentially be reused by
other modules that require the same functionality.
2021-06-07 12:57:42 -04:00
Mike Salvatore f0a109a145 island: Add tests for ssl_certificate_key_file 2021-06-07 12:53:32 -04:00
Mike Salvatore 4231f316db island: Add tests for ssl_certificate_file 2021-06-07 12:41:11 -04:00
Mike Salvatore f2a2efc2a7 island: Remove redundant "test_island_config_options" from tests
The file is named "test_island_config_options.py". Including
"island_config_options" in every test/function name is reduntant.
2021-06-07 12:30:03 -04:00
Mike Salvatore ea0d6f0141 island: Add a generalized testing function to test_island_config_options 2021-06-07 12:20:32 -04:00
Shreya 4f601ca5dc Pass file paths to setup_certificate() instead of IslandConfigOptions 2021-06-07 20:12:29 +05:30
Shreya 42a9a79800 Modify server_config.json ssl cert fields 2021-06-07 20:12:29 +05:30
Shreya 2b73ec75c8 Move monkey_island/cc/setup/certificate/certificate_setup.py to monkey/monkey_island/cc/setup/certificate_setup.py 2021-06-07 20:12:29 +05:30
Shreya 227039f30c Add `_expand_path()` to wrap `os.path.expandvars()\' and `os.path.expanduser()\' 2021-06-07 20:12:27 +05:30
Shreya 5ba8effe1a Use octal representation for permissions 2021-06-07 13:26:14 +05:30
Shreya 4ad49d19c7 Rename "required" permissions to "expected" permissions 2021-06-07 13:22:44 +05:30
Shreya 53a126482f Extract file checking activities 2021-06-07 13:22:38 +05:30
Shreya d740173f79 Post-rebase fixes 2021-06-04 13:20:01 +05:30
Shreya 88ae762618 Expand cert and key path in IslandConfigOptions 2021-06-04 12:23:04 +05:30
Shreya a2bd59c377 Move `has_sufficient_permissions` to a separate file in utils/ 2021-06-04 12:23:03 +05:30
Shreya 6f1154f911 Add log message for which certificate is being used 2021-06-04 12:23:03 +05:30
Shreya c1463b4a18 Implement `has_sufficient_permissions` function for checking certificate files 2021-06-04 12:23:03 +05:30
Shreya c9a53833e2 Add support for custom certificate (partially) 2021-06-04 12:23:03 +05:30
Mike Salvatore 00434b9a25 Only search tests/unit_tests for monkey unit tests 2021-06-03 16:09:57 -04:00
Mike Salvatore 4e888b00b1 Merge branch 'refactor-island-start' into develop 2021-06-03 16:07:08 -04:00
Mike Salvatore 19e47583e9 island: Use `os.getcwd()` for MONKEY_ISLAND_ABS_PATH on Windows
See issue #1207 for more details.
2021-06-03 15:51:36 -04:00
Mike Salvatore 03b543f7f6 island: Move setup/island_config_options.py -> cc/setup/ 2021-06-03 12:20:55 -04:00
Mike Salvatore 623d551c6c island: Move setup/config_setup.py -> cc/setup/config_setup.py 2021-06-03 11:12:39 -04:00
Mike Salvatore ac407bf48a island: Remove unused mongo_url from BootloaderHttpServer constructor 2021-06-03 11:09:07 -04:00
Mike Salvatore 4f97be59c3 island: Rename _initialize_global_resources -> _initialize_globals 2021-06-03 11:06:04 -04:00
Mike Salvatore 92293e601c island: Add unit test for MONKEY_ISLAND_ABS_PATH
If the consts.py is moved, MONKEY_ISLAND_ABS_PATH may be incorrect. This
unit test guards against the introduction of a bug if consts.py is
moved.
2021-06-03 11:04:16 -04:00
Mike Salvatore c40af5073b island: Rename start_island() -> main() 2021-06-03 11:01:03 -04:00
Mike Salvatore 3917663c5c island: Rename startup.py -> main.py 2021-06-03 11:00:12 -04:00
Mike Salvatore 44a3456c62 island: Remove the responsibility of choosing a log file from MongoDbProcess 2021-06-03 10:57:23 -04:00
Mike Salvatore 5f25debfd2 island: Decouple mongo_setup from IslandConfigOptions 2021-06-03 10:57:23 -04:00
Mike Salvatore edbb2c39f3 island: Trap OSError and JSONDecodeError when reading config 2021-06-03 10:57:23 -04:00
Mike Salvatore 4a1653ed5f island: Do not start bootloader server if --setup-only is passed 2021-06-03 10:57:23 -04:00
Mike Salvatore 1c73a154bc appimage: Remove `run_appimage.sh` as it is no longer needed
The functionality of setting up the data directory and starting mongodb
is now handled in python code.
2021-06-03 10:57:23 -04:00
Mike Salvatore 19e8042ee4 island: Construct mongo run command in MongoDbProcess constructor 2021-06-03 10:57:23 -04:00
Mike Salvatore cc1865dc5b island: Log a warning if MongoDbProcess.stop() is erroniously called 2021-06-03 10:57:23 -04:00
Mike Salvatore e80ac4c943 island; Build log file path in MongoDbProcess constructor 2021-06-03 10:57:23 -04:00
Mike Salvatore 12b11ce260 island: Rename _build_mongo_launch_cmd -> _build_mongo_run_cmd 2021-06-03 10:57:23 -04:00
Mike Salvatore 3b958f5a61 island: Inline method _start_mongodb_process() in MongoDbProcess 2021-06-03 10:57:23 -04:00
Mike Salvatore 1e21446bb8 island: Rename logging_dir_path -> _logging_dir in MongoDbProcess 2021-06-03 10:57:23 -04:00
Mike Salvatore a3bd432538 island: Remove directory creation logic from MongoDbProcess 2021-06-03 10:57:23 -04:00
Mike Salvatore 7d85ce0611 island: Store MongoDB logs in mondogb.log instead of mongo_log.txt
".log" is the standard extension for log files.
2021-06-03 10:57:23 -04:00
Mike Salvatore 559af47928 island: Clean up MongoDB subprocess when Monkey Island shuts down 2021-06-03 10:57:23 -04:00
Mike Salvatore d1a2501a5b island: Add connect_to_mongo() function 2021-06-03 10:57:23 -04:00
Mike Salvatore dc40713683 island: Rename launch_mongodb() -> start() 2021-06-03 10:57:23 -04:00
Mike Salvatore d35099fa9b island: Rename MongoDbRunner -> MongoDbProcess 2021-06-03 10:57:23 -04:00
Mike Salvatore 28a34a4ec9 island: Use MONKEY_ISLAND_ABS_PATH to locate STIX attack data 2021-06-03 10:57:23 -04:00
Mike Salvatore a8570987a6 island: Find MONKEY_ISLAND_ABS_PATH by __file__ instead of os.getcwd()
We can't be sure what $PWD is when Monkey Island is started.
2021-06-03 10:57:23 -04:00
Mike Salvatore 184594f509 island: Refactor setup/start logic separate concerns
Most configuration/setup logic is removed from monkey_island.py. The
only responsibility of startup.py is now to setup a default
failsafe logger and call run_monkey_island().

setup_island() has been renamed to run_monkey_island(), since that's
what it does. Some of the logic used to setup/configure/initialize
monkey island has been wrapped in different functions with specific
responsibilities.

setup_mongodb() has been renamed to start_mongodb(), since that's what
it does.
2021-06-03 10:57:23 -04:00
Mike Salvatore 5e78666f91 island: Add function to setup default failsafe logger 2021-06-03 10:57:23 -04:00