Mike Salvatore
6b4e991fdc
Merge pull request #1935 from guardicore/1928-stateful-aws-service
...
1928 stateful aws service
2022-05-10 07:57:29 -04:00
Mike Salvatore
4f3a150f5a
Common: Remove disused common.cmd.*
2022-05-09 16:30:24 -04:00
Mike Salvatore
fe1e8ccb75
Island: Remove disused RemoteRunAwsService
2022-05-09 16:27:07 -04:00
Mike Salvatore
68f31db03a
UT: Add StubDIContainer
2022-05-09 16:23:35 -04:00
Mike Salvatore
528ca76c32
Island: Use AWSService in RemoteRun resource
2022-05-09 15:52:01 -04:00
Mike Salvatore
144506c32d
Island: Implement AWSService._run_agent_on_managed_instance()
2022-05-09 15:43:52 -04:00
Mike Salvatore
653bfbd24b
Island: Replace AWSCommandRunner with start_infection_monkey_agent()
...
The AWSCommandRunner is a subclass of CmdRunner, which attempts to make
it easy to run commands on AWS nodes asynchronously. There are some
issues with the implementation, including unnecessary complexity and a
circular dependency between the CmdRunner and Cmd classes. A simple
function that runs a single command on a single instance is a simpler
solution. It can be run with a thread worker pool if asynchronicity is
required.
2022-05-09 15:25:56 -04:00
Mike Salvatore
c24bb1024e
Agent: Move Timer to common/
2022-05-09 13:26:42 -04:00
Mike Salvatore
a7dcc73a3d
Island: Rename AwsCmdRunner -> AWSCommandRunner
2022-05-09 13:26:36 -04:00
Mike Salvatore
83f230c5a1
Island: Move aws_cmd_runner.py -> aws_command_runner.py
2022-05-09 13:00:55 -04:00
Mike Salvatore
f11ac5cc2b
Island: Move AWSService to service/aws/
2022-05-09 12:59:28 -04:00
Mike Salvatore
cfbe1e5656
Island: Add docstrings to AWSService
2022-05-09 12:45:40 -04:00
Mike Salvatore
2da6e023e1
Island: Construct and register AWSService in the composition root
2022-05-09 10:25:13 -04:00
Mike Salvatore
a0660f12e9
Island: Rename _filter_instance_info_from_aws_response
2022-05-09 10:16:46 -04:00
Mike Salvatore
8995eb5d2f
Island: Add get_managed_instances() to AWSService
2022-05-09 10:09:17 -04:00
Mike Salvatore
acabc835d4
Island: Add run_agent_on_managed_instances() to AWSService
2022-05-09 09:23:35 -04:00
Mike Salvatore
0f4b69a6f7
Island: Add stateful AWSService
2022-05-09 09:13:03 -04:00
Mike Salvatore
e83848c8a4
Island: Add AWSInstance to the DIContainer
2022-05-09 08:54:35 -04:00
Mike Salvatore
4f023621d4
Merge pull request #1934 from guardicore/1928-lazy-load-aws-instance
...
1928 lazy load aws instance
2022-05-09 08:54:05 -04:00
Mike Salvatore
7864f48e3c
Common: Make AWSInstance.is_instance() return boolean
2022-05-09 07:39:05 -04:00
Mike Salvatore
7af03a83f6
Common: Simplify attribute assignment in AWSInstance
2022-05-09 06:44:21 -04:00
Shreya Malviya
28f60d51ff
Island: Use lock when creating an edge in the db
...
Fixes #1917
PR #1932
2022-05-09 06:28:11 -04:00
Mike Salvatore
d861328fbf
Common: Use relative import for aws_metadata module
2022-05-06 04:36:50 -04:00
Mike Salvatore
73e7e31a63
UT: Fix names in test_aws_metadata.py
2022-05-06 04:31:10 -04:00
Mike Salvatore
8d24b913df
Common: Raise exception if AWS metadata requests fail
2022-05-06 04:22:17 -04:00
Mike Salvatore
ca38235b8e
Common: Set AWSInstance.is_instance to False if empty string
2022-05-06 04:07:40 -04:00
Mike Salvatore
09218ef3d3
UT: Add tests for AWSInstance
2022-05-06 04:07:16 -04:00
Mike Salvatore
10136a325c
Common: Import AWSInstance in common/aws/__init__.py
2022-05-06 03:56:47 -04:00
Mike Salvatore
07f57a83ad
Common: Refactor aws_metadata to improve readablility
2022-05-05 15:14:47 -04:00
Mike Salvatore
d977d19d9f
Common: Lazy-load AWSInstance
2022-05-05 15:01:37 -04:00
Mike Salvatore
ab136284dc
Common: Remove disused AWSInstance.get_account_id()
2022-05-05 11:39:49 -04:00
Mike Salvatore
64f9bcacb5
Common: Rename AwsInstance -> AWSInstance
2022-05-05 11:29:08 -04:00
Mike Salvatore
174392848f
Merge pull request #1929 from 'EliaOnceAgain:1883/install_service'
2022-05-05 11:05:20 -04:00
Mike Salvatore
fc96e3aced
Build: Switch order of user_exists() and exit_if_user_doesnt_exist()
2022-05-05 11:03:48 -04:00
Mike Salvatore
d5bb94f1a8
Build: Make error message formatting consistent
2022-05-05 11:03:48 -04:00
Mike Salvatore
019bc56a73
Build: Handle empty usernames
2022-05-05 11:03:48 -04:00
Mike Salvatore
0f133d0b35
Build: Improve echo in install-infection-monkey-service.sh
2022-05-05 11:03:48 -04:00
Mike Salvatore
56bdbe5ac6
Build: Rename move_appimage() -> copy_appimage()
2022-05-05 11:03:48 -04:00
Mike Salvatore
e1b053f000
Build: Move move_appimage() for improved readability
2022-05-05 11:03:48 -04:00
Mike Salvatore
88eb9dbe81
Build: Extract function install_systemd_unit()
2022-05-05 11:03:48 -04:00
Mike Salvatore
a81462e617
Build: Use writable location for temporary systemd unit file
...
As set, the $SCRIPT_DIR was read-only (since the AppImage's squashfs is
readonly). Use $PWD instead.
2022-05-05 11:03:48 -04:00
Mike Salvatore
27ac518f2e
Build: Set umask before writing temporary systemd unit file
2022-05-05 11:03:48 -04:00
Mike Salvatore
02ba8361a9
Build: Extract function exit_if_user_doesnt_exist()
2022-05-05 11:03:48 -04:00
Mike Salvatore
2a18e3e1bf
Build: Remove unnecessary assert_parameter_supplied()
2022-05-05 11:03:48 -04:00
Mike Salvatore
7e039f73ff
Build: Ensure either --install or --uninstall are specified
2022-05-05 11:03:48 -04:00
Mike Salvatore
6d50814c19
Build: Make --install and --uninstall mutually exclusive
2022-05-05 11:03:48 -04:00
Mike Salvatore
ed58ca6950
Build: Rename $uname -> $username in AppImage installation script
...
"uname" could refer to the `uname` command (short for unix name).
"username" more clearly communicates the variable's purpose.
2022-05-05 11:03:48 -04:00
EliaOnceAgain
0287f58d8d
Build: Use $APPIMAGE instead of --path during service installation
2022-05-05 11:02:56 -04:00
EliaOnceAgain
02916a25f3
Build: Check for the 'service' argument in AppRun
2022-05-05 11:02:35 -04:00
EliaOnceAgain
1c702b28ba
Build: Include install-infection-monkey-service.sh in the AppImage
2022-05-05 11:02:28 -04:00