Commit Graph

7496 Commits

Author SHA1 Message Date
Mike Salvatore 17cb77cfdd Agent: Move AbstractAgentEvent serialization to HTTPIslandAPIClient 2022-09-20 09:45:00 -04:00
Mike Salvatore 34a4d81336 Agent: Reraise IslandAPIError in handle_island_errors() 2022-09-20 09:39:20 -04:00
Shreya Malviya 7884f96a9c UT: Fix broken HTTPIslandAPIClient.get_agent_binary() tests 2022-09-20 18:45:39 +05:30
Shreya Malviya 2bd64a3175 Agent: Make variable `island_api_client` protected in InfectionMonkey 2022-09-20 18:38:09 +05:30
Shreya Malviya 9b3950e8eb Agent: Accept OperatingSystem instead of str in HTTPIslandAPIClientget_agent_binary() 2022-09-20 18:36:22 +05:30
Shreya Malviya 088e020fee Agent: Catch IslandAPIError and raise RetrievalError in CachingAgentBinaryRepository._download_binary_from_island() 2022-09-20 18:36:22 +05:30
Shreya Malviya 0e9397b283 Agent: Add RetrievalError to i_agent_binary_repository.py 2022-09-20 18:36:22 +05:30
Shreya Malviya e8ecaa2169 UT: Add tests for HTTPIslandAPIClient.get_agent_binary() 2022-09-20 18:36:22 +05:30
Shreya Malviya 30cf360e98 Agent: Fix URL in HTTPIslandAPIClient.get_agent_binary() 2022-09-20 18:36:22 +05:30
Shreya Malviya 2cebc19843 Agent: Add get_agent_binary() to the IIslandAPIClient interface 2022-09-20 18:36:22 +05:30
Shreya Malviya d84550ba23 Agent: Fix return type hint in CachingAgentBinaryRepository._download_binary_from_island() 2022-09-20 18:36:21 +05:30
Shreya Malviya 4605722874 Agent: Add logging in CachingAgentBinaryRepository._download_binary_from_island() 2022-09-20 18:36:21 +05:30
Shreya Malviya 3b3f39065d Agent: Remove comment no longer relevant from monkey.py 2022-09-20 18:36:19 +05:30
Shreya Malviya 8b52ba0686 Agent: Modify docstring in IIslandAPIClient.send_events() 2022-09-20 18:01:17 +05:30
Mike Salvatore e3adae03b0
Merge pull request #2321 from guardicore/2294-clear-repositories-on-clear-simulation
Clear repositories on CLEAR_SIMULATION_DATA event
2022-09-20 07:56:31 -04:00
Shreya Malviya 5032588c23 Island: Initialize MongoDB connection before DI container so that repositories using mongo can be registered and subscribed 2022-09-20 17:07:28 +05:30
Shreya Malviya 638e4cd7ed Island: Simplify logic in island_event_handlers._subscribe_clear_simulation_data_events 2022-09-20 17:05:53 +05:30
Ilija Lazoroski 14592d964e Agent: Pass island_api_client when constructing AgentEventForwarder 2022-09-20 13:13:01 +02:00
Ilija Lazoroski b320fba2c8 Agent: Modify AgentEventForwarder to use IIslandAPIClient 2022-09-20 12:32:00 +02:00
Ilija Lazoroski f39007b0ce Agent: Implement send_events in HTTPIslandAPIClient 2022-09-20 12:30:08 +02:00
Ilija Lazoroski 9000a01d1d Agent: Add send_events to IIslandAPIClient 2022-09-20 12:28:50 +02:00
Shreya Malviya f93565b2cf Island: Subscribe repository reset functions to CLEAR_SIMULATION_DATA event 2022-09-20 15:50:43 +05:30
Shreya Malviya 51a9bad000 Island: Register instances of INodeRepository, IMachineRepository, IAgentRepository in DI container 2022-09-20 15:48:07 +05:30
Shreya Malviya e23c6de745 Agent: Remove no longer needed `island_url` parameter from CachingAgentBinaryRepository 2022-09-20 14:59:35 +05:30
Shreya Malviya 1355c038b5 Agent: Add and use HTTPIslandAPIClient.get_agent_binary() 2022-09-20 14:56:10 +05:30
Shreya Malviya 9da1ad4c46 Agent: Pass and accept island_api_client in CachingAgentBinaryRepository's constructor 2022-09-20 14:54:25 +05:30
Shreya Malviya 1480203627 Agent: Modify docstrings in IIslandAPIClient 2022-09-20 12:35:21 +05:30
Ilija Lazoroski 1b4f834f46 UT: Add status code tests for HTTIslandAPIClient 2022-09-20 08:50:55 +02:00
Ilija Lazoroski 0c13298bbb UT: Add error handling tests for HTTPIslandAPIClient send_log and
get_pba_file
2022-09-20 07:52:48 +02:00
Mike Salvatore 107a15b5f0 Agent: Call raise_for_status() in HTTPIslandAPIClient 2022-09-19 20:05:19 -04:00
Mike Salvatore a724758caa Agent: Handle HTTPErrors in HTTPIslandAPIClient 2022-09-19 20:04:52 -04:00
Mike Salvatore cb8fda0bec Agent: Add HTTPIslandAPIClient._api_url attribute 2022-09-19 19:57:28 -04:00
Mike Salvatore 841183d8e7 Agent: Reimplement HTTPIslandAPIClient.get_pba_file() as a method 2022-09-19 19:55:07 -04:00
Mike Salvatore aa3c6c2f4d Agent: Add IIslandAPIClient.get_pba_file() 2022-09-19 19:52:58 -04:00
Mike Salvatore 92da3b78db Agent: Reimplement HTTPIslandAPIClient.send_log() as member, not static 2022-09-19 19:44:16 -04:00
Mike Salvatore aba342b3f2 Agent: Pass IIslandAPIClient to ControlClient.__init__() 2022-09-19 19:41:14 -04:00
Mike Salvatore 9936605242 Agent: Add IIslandAPIClient.send_log() 2022-09-19 19:39:00 -04:00
Shreya Malviya 393bec29e7 Agent: Remove comment from HTTPIslandAPIClient 2022-09-19 19:39:00 -04:00
Shreya Malviya 365376a190 Agent: Change exception handling and log message in ControlClient.get_pba_file() 2022-09-19 19:39:00 -04:00
Shreya Malviya d07760fe60 Agent: Make HTTPIslandAPIClient.send_log() and HTTPIslandAPIClient.get_pba_file() static 2022-09-19 19:39:00 -04:00
Shreya Malviya 8ab17a96e3 Agent: Fix functions defined in HTTPIslandAPIClient and use the handle_island_errors() decorator on them 2022-09-19 19:39:00 -04:00
Shreya Malviya fa9225370e Agent: Add handle_island_errors() decorator to http_island_api_client.py 2022-09-19 19:39:00 -04:00
Shreya Malviya d188b06980 Agent: Implement HTTPIslandAPIClient.get_pba_file and use in ControlClient 2022-09-19 19:39:00 -04:00
Shreya Malviya 1b92ec78fb Agent: Implement HTTPIslandAPIClient.send_log and use in ControlClient 2022-09-19 19:39:00 -04:00
Mike Salvatore b9576db426 UT: Fix broken tests for find_available_island_apis() 2022-09-19 14:21:17 -04:00
Mike Salvatore 753ac739b0 Agent: rename find_servers() -. find_available_island_apis() 2022-09-19 14:20:40 -04:00
Mike Salvatore 2ebb7621e3 Agent: Fix server selection logic 2022-09-19 14:05:34 -04:00
Mike Salvatore 9ea291a7fa Agent: Fix crash when connecting to IPv4Address
socket.connect() needs a string, not IPv4Address, otherwise the thread
will crash.
2022-09-19 14:01:51 -04:00
Mike Salvatore 51ecf52d4b Agent: Add an ID (int) to relay control message thread name 2022-09-19 14:01:08 -04:00
Mike Salvatore c6a5e294df Agent: Add a timeout to notify disconnect socket 2022-09-19 13:57:25 -04:00
Mike Salvatore 6563be8222 Agent: Remove unnecessary local variable 2022-09-19 12:16:20 -04:00
Mike Salvatore db75806a08 Agent: Rename _get_server() -> _connect_to_island_api() 2022-09-19 12:13:03 -04:00
Ilija Lazoroski bc19b5ea93 Agent: Modify find_server to return tuple of server and IIslandAPIClient 2022-09-19 17:24:00 +02:00
Ilija Lazoroski f4b47f8238 Agent: Use HTTPIslandAPIClient in find_server 2022-09-19 16:44:37 +02:00
Mike Salvatore 787af6ae1b Agent: Fix send relay disconnect to unneeded relays
Since `find_server()` is parallelized, the iterator was completely
exhausted when `send_remove_from_waitlist_control_message_to_relays()`
was called, making it effectively a NOOP.
2022-09-19 16:40:04 +02:00
Shreya Malviya 9456a30bd9 Agent: Remove unnecessary logic in _check_if_island_server() 2022-09-19 16:40:04 +02:00
Shreya Malviya 69b26287b6 UT: Fix Island API errors' import in network/relay/test_utils.py 2022-09-19 16:40:04 +02:00
Shreya Malviya 8a4666fba2 Agent: Fix Island API client import in network/relay/utils.py 2022-09-19 16:40:04 +02:00
Ilija Lazoroski 11da608fe6 Agent: Modify find_server to use IslandApiClient 2022-09-19 16:40:04 +02:00
Mike Salvatore 310b58392f
Merge pull request #2313 from guardicore/2292-island-api-client
2292 island api client
2022-09-19 10:25:29 -04:00
Mike Salvatore 9f697e57d2
Merge pull request #2317 from guardicore/fix-zerologon
Fix zerologon
2022-09-19 10:16:19 -04:00
Ilija Lazoroski 2857e70fa2 Island: Change credentials stolen event subscriber argument name 2022-09-19 15:52:44 +02:00
Shreya Malviya 1b037c4b3a Agent: Add IslandAPIRequestError for errors that are the client's mistake 2022-09-19 19:08:15 +05:30
Mike Salvatore 04e82de641 Agent: Make language consistent in IIslandAPIClient docstrings 2022-09-19 09:25:56 -04:00
Mike Salvatore f4f9ca6317 Agent: Update island API client docstrings 2022-09-19 08:18:46 -04:00
Mike Salvatore 43d6ebcc15 Agent: Rename IslandAPIClient -> HTTPIslandAPIClient 2022-09-19 08:03:45 -04:00
Mike Salvatore 6d5503bd6e Agent: Move IslandAPIClient to island_api_client package 2022-09-19 08:00:00 -04:00
Mike Salvatore 184e54228d Agent: Use relative import for errors in IslandAPIClient 2022-09-19 07:56:34 -04:00
Mike Salvatore ca1bc06c55 Agent: Add IIslandAPIClient 2022-09-19 07:51:50 -04:00
Shreya Malviya b432a9f567 Agent: Fix docstrings in IslandAPIClient 2022-09-19 17:16:10 +05:30
Shreya Malviya d53b3d5026 UT: Fix Island API errors' import 2022-09-19 17:11:14 +05:30
Shreya Malviya f5279a6cb1 Agent: Import Island API errors in transport/__init__.py 2022-09-19 17:09:52 +05:30
Shreya Malviya 672fde0b94 UT: Change IslandApiClient -> IslandAPIClient 2022-09-19 17:06:41 +05:30
Shreya Malviya d217d30b2e Agent: Change IslandApiClient -> IslandAPIClient 2022-09-19 17:05:56 +05:30
vakarisz 8386a006d0 Agent: Implement IslandApiClient 2022-09-19 11:11:50 +02:00
vakarisz 0b0f039474 Agent: Add 4 IslandAPIErrors 2022-09-16 17:39:46 +03:00
Mike Salvatore f677096439 Agent: Make BatchingTelemetryMessenger sleep period configurable
The ransomware integration tests were sometimes painfully slow because
they were waiting for the BatchingTelemetryMessenger to stop its
internal thread. This commit surfaces the sleep period parameter to the
`build_ransomware()` function so that the unit tests can set it to a
very small value. This is somewhat of a hack, but
BatchingTelemetryMessenger is going away very soon, as Telemetry is
being replaced by Events.
2022-09-16 10:34:31 -04:00
Shreya Malviya 2146985e51 Island: Undo accidental change to cc/repository/zero_trust/IEventRepository.py 2022-09-16 19:17:19 +05:30
Mike Salvatore 4e1ca659a9 Merge branch '2293-rename-event-serializers' into develop
PR #2300
2022-09-16 09:41:37 -04:00
Mike Salvatore 5669bdd8a2 Agent: Add a comment about locking bcrypt and cryptography 2022-09-16 09:36:26 -04:00
Mike Salvatore 9ec55f20ba
Merge pull request #2302 from guardicore/lock-cryptography
Lock cryptography and bcrypt
2022-09-16 09:34:30 -04:00
vakarisz 998c1d7a4f Agent: Rename EVENTS_API_URL to AGENT_EVENTS_API_URL 2022-09-16 16:20:58 +03:00
vakarisz 77a23b7920 Island, Common: Delete the cached versions of ip retrieval 2022-09-16 16:05:56 +03:00
Mike Salvatore f0e8691bc4 UT: Rename common/events -> common/agent_events 2022-09-16 09:02:09 -04:00
Mike Salvatore 83279cb1b7 UT: Fix CredentialsStolenEvent event import 2022-09-16 08:59:28 -04:00
Shreya Malviya f8134e505e UT: Fix imports common.events -> common.agent_events 2022-09-16 08:58:02 -04:00
Shreya Malviya d93eb4565b Island: Fix imports common.events -> common.agent_events 2022-09-16 08:58:02 -04:00
Shreya Malviya c8d11cdfe7 Agent: Fix imports common.events -> common.agent_events 2022-09-16 08:58:02 -04:00
Shreya Malviya b5736fdd3e Common: Rename common/events/ -> common/agent_events/ 2022-09-16 08:58:02 -04:00
Shreya Malviya 89a8ed7a5e Island: Rename i_event_repository.py -> i_agent_event_repository.py 2022-09-16 08:58:02 -04:00
Shreya Malviya be612abb23 UT: Change IEventRepository -> IAgentEventRepository 2022-09-16 08:58:02 -04:00
Shreya Malviya 0dccbd32b6 Island: Rename IEventRepository -> IAgentEventRepository 2022-09-16 08:58:02 -04:00
Shreya Malviya f0d5545f28 Island: Rename cc/resources/events.py -> cc/resources/agent_events.py 2022-09-16 08:58:02 -04:00
Shreya Malviya 66eaccb698 Agent: `/api/agent-events` in place of `/api/events` 2022-09-16 08:58:02 -04:00
Shreya Malviya cfc0905d0c Island: Rename `/api/events` to `/api/agent-events` 2022-09-16 08:58:02 -04:00
Shreya Malviya 354d6624d3 UT: Use AgentEvents in place of Events in test_events.py 2022-09-16 08:58:02 -04:00
Shreya Malviya c37876cb97 Island: Rename resource Events -> AgentEvents 2022-09-16 08:58:02 -04:00
Shreya Malviya edce35efef Agent: Make log message more specific in agent_event_forwarder.py 2022-09-16 08:58:02 -04:00
Shreya Malviya 5ad5de9c4a UT: Change event_serializer_registry -> agent_event_serializer_registry in test_agent_event_serializer_registry.py 2022-09-16 08:58:02 -04:00
Shreya Malviya e6db64bf88 UT: Rename test_event_serializer_registry.py -> test_agent_event_serializer_registry.py 2022-09-16 08:58:02 -04:00