Commit Graph

5231 Commits

Author SHA1 Message Date
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
Shreya 954ad64255 Rename whitelist.py to vulture_whitelist.py 2021-05-28 19:39:24 +05:30
Shreya c165b0e4ea Since tests/unit_tests/ is now skipped by Vulture, add code used only by tests to whitelist
Add the code which exists in common/, monkey_island/, or infection_monkey/,
but is used in tests/unit_tests/, to the whitelist file.
2021-05-28 19:35:33 +05:30
Shreya 0c323929a2 Configure Vulture to ignore directory: tests/unit_tests/ 2021-05-28 19:31:32 +05:30
Shreya Malviya f3fccb3e06
Merge pull request #1188 from guardicore/mongodb_connection_setup_refactoring
Mongodb connection setup refactoring
2021-05-28 16:07:28 +05:30
VakarisZ eae63bd3c6 Deleted empty test file, removed irrelevant comments and moved import to the top in monkey_island.py 2021-05-28 13:26:13 +03:00
VakarisZ badcd0e87c
Merge pull request #1189 from guardicore/config_export_popup
Config export modal
2021-05-28 13:13:42 +03:00
Shreya Malviya a0487f480b
Update export config modal message for plaintext export 2021-05-28 14:56:44 +05:30
VakarisZ d0f5893e41 Finished up the configuration export modal and it's styling. 2021-05-28 10:57:31 +03:00
VakarisZ 3240e1138e Sketched out export config modal infrastructure 2021-05-27 16:25:00 +03:00
VakarisZ dbade5951c Removed unused unit test - test_mongo_setup.py. This is mongo setup tests db dir creation, which is already tested in test_utils.py 2021-05-27 16:02:01 +03:00
VakarisZ f2c8de9eb6 Improved unit test readability and fixed bugs related to refactoring of mongodb parameters in environment config 2021-05-27 15:57:57 +03:00
VakarisZ 2e600fd5b2 Decoupled mongo setup from environment config 2021-05-27 15:57:12 +03:00
VakarisZ 289f3df7e4 Implemented mongodb process launch from the island 2021-05-27 15:54:07 +03:00
VakarisZ 243642c1af
Merge pull request #1185 from guardicore/mongo_db_launch_from_island
Mongo db launch from island
2021-05-27 15:43:10 +03:00
VakarisZ 26e57153da Fixed typos and renamed windows permission setting function in windows_permissions.py to be more specific. 2021-05-27 14:09:21 +03:00
Shreya 4b733ba383 Fix unit tests (test_utils.py) 2021-05-27 15:40:47 +05:30
VakarisZ 7240d60342 Typos and small bugfixes in mongo_process_runner.py 2021-05-27 11:08:09 +03:00
VakarisZ cb14a4ea9b Refactored secure directory creation into a separate method. Data dir creation and db dir creation now use that method. Added unit tests for secure directory creation. 2021-05-27 11:08:09 +03:00
VakarisZ 5aeab3a56c Refactored mongo executable path to be calculated in consts, since this is a trivial calculation. 2021-05-27 11:08:07 +03:00
VakarisZ f7674b0635 Aggregated duplicate runtime os checking functions into one. 2021-05-27 11:05:54 +03:00
Shreya f5f8f572f6 Remove unneeded function arguments in test_mongo_process_runner.py 2021-05-27 11:05:54 +03:00
Shreya 1610860bd0 Rename test_process_runner.py to test_mongo_process_runner.py to better reflect the file it's testing 2021-05-27 11:05:54 +03:00
Shreya 0be8e56858 Add fixture for fake db dir in test_process_runner.py 2021-05-27 11:05:54 +03:00
Shreya 58745a0eb4 Use fixtures in test_process_runner.py 2021-05-27 11:05:54 +03:00
VakarisZ 5f7e886310 Updated CHANGELOG.md with mongodb launch from island changes. 2021-05-27 11:05:53 +03:00
VakarisZ a5d72c8b94 Fixed an import statement in monkey_island/main.py 2021-05-27 11:05:43 +03:00
VakarisZ 36b3e987da Added expand user call to transform data dir input into a proper path 2021-05-27 11:05:43 +03:00
VakarisZ 559b61b581 Removed code related to running mongodb and db folder creation 2021-05-27 11:05:43 +03:00
VakarisZ 73f23ad383 Removed run.sh and updated mongodb related documentation: removed db folder creation and run.sh execution on linux 2021-05-27 11:05:43 +03:00