Mike Salvatore
a815850c9e
Merge branch 'default-data-dir-bug' into develop
2021-06-07 06:41:38 -04:00
Mike Salvatore
2b1af17433
island: Add typehint to create_default_server_config_file()
...
Co-authored-by: Shreya Malviya <shreya.malviya@gmail.com>
2021-06-07 06:39:05 -04:00
Mike Salvatore
b0ac07553a
island: Assert isdir() in test_monkey_island_abs_path()
2021-06-06 19:01:16 -04:00
Mike Salvatore
0cd9709b82
island: Remove server_config.json.develop
...
Since Monkey Island no longer writes to server_config.json in the source
code directory, and each package will overwrite server_config.json with
its own server config (until we separate the deployment from the config
in issue #1205 ), we no longer need server_config.json.develop and we
don't need to worry about accidentally committing credentials to git.
2021-06-03 20:38:13 -04:00
Mike Salvatore
e57e28a97f
island: Consolidate tests for consts.py
2021-06-03 20:25:07 -04:00
Mike Salvatore
5ecc02d553
island: Use the data_dir specified in the default server config
2021-06-03 20:25:05 -04:00
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
Mike Salvatore
583115c419
island: Reset logger handlers after each test
...
The root logger does not get reset for each test that is run. Add an
autouse fixture that resets the logger handlers after each test run so
that handlers do not accumulate in the root logger.
2021-06-03 10:57:23 -04:00
Mike Salvatore
14b68580f8
island: Configure loggin in python code instead of JSON
2021-06-03 10:57:23 -04:00
VakarisZ
cc00b85edc
Refactored monkey island startup files to the old structure which was compatible with our build scripts.
2021-06-03 10:56:46 -04:00
VakarisZ
e6bb48100e
Merge pull request #1190 from guardicore/vulture-skip-unit-tests
...
Configure Vulture to skip tests/unit_tests/
2021-06-03 09:35:22 +03:00
Shreya
52b57a7166
Have Vulture skip tests/ instead of tests/unit_tests/
2021-06-03 11:57:44 +05:30
Shreya
b69c1c531a
Rename vulture_whitelist.py -> vultue_allowlist.py
2021-06-02 13:08:37 +05:30
Shreya
55ed8d28d0
Rearranged unused code in Vulture whitelist according to categories
2021-06-02 13:05:21 +05:30
Mike Salvatore
4e6bb21942
Merge pull request #1191 from guardicore/test-data-dir-expand-user-env
...
Test data dir expand user env
2021-06-01 04:22:43 -04:00
Mike Salvatore
09e7deb936
island: Use os.path.join when creating test config contents dict
2021-06-01 03:59:07 -04:00
Mike Salvatore
2cd665ff11
island: Refactor duplicate code in IslandConfigOptions data_dir tests
2021-06-01 03:46:28 -04:00
Mike Salvatore
c761dba030
island: Expand environment variables in data_dir
2021-06-01 03:35:33 -04:00
Mike Salvatore
0ab20d558b
island: Add unit test to verify '~' expanded in data_dir
2021-06-01 03:33:34 -04:00
Shreya
995eaa0f3f
Add more detailed comment in vulture_whitelist.py
2021-05-28 19:42:23 +05:30