diff --git a/requirements.txt b/requirements.txt index 2ce4c3466..e04b6ae11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ six>=1.11.0 -cloudaux==1.5.0 +cloudaux>=1.5.0 celery==4.2.0 celery[redis]==4.2.0 redis==2.10.6 diff --git a/security_monkey/watchers/iam/iam_role.py b/security_monkey/watchers/iam/iam_role.py index 0f9cfbd95..56f16ef53 100644 --- a/security_monkey/watchers/iam/iam_role.py +++ b/security_monkey/watchers/iam/iam_role.py @@ -1,10 +1,10 @@ from security_monkey.cloudaux_batched_watcher import CloudAuxBatchedWatcher from cloudaux.aws.iam import list_roles -from cloudaux.orchestration.aws.iam.role import get_role +from cloudaux.orchestration.aws.iam.role import get_all_roles from security_monkey import AWS_DEFAULT_REGION -class IAMRole(CloudAuxBatchedWatcher): +class IAMRole(CloudAuxWatcher): index = 'iamrole' i_am_singular = 'IAM Role' i_am_plural = 'IAM Roles' @@ -17,22 +17,12 @@ def __init__(self, **kwargs): def _get_regions(self): return [AWS_DEFAULT_REGION] - + def get_name_from_list_output(self, item): return item['RoleName'] def list_method(self, **kwargs): - all_roles = list_roles(**kwargs) - items = [] - - for role in all_roles: - role["Region"] = "us-east-1" # IAM is global - items.append(role) - - return items + return get_all_roles(**kwargs) def get_method(self, item, **kwargs): - # This is not needed for IAM Role: - item.pop("Region") - - return get_role(dict(item), **kwargs) + return item diff --git a/security_monkey/watchers/iam/iam_user.py b/security_monkey/watchers/iam/iam_user.py index e2981d03d..2f2dc8af3 100644 --- a/security_monkey/watchers/iam/iam_user.py +++ b/security_monkey/watchers/iam/iam_user.py @@ -1,7 +1,7 @@ from security_monkey.cloudaux_watcher import CloudAuxWatcher from security_monkey import AWS_DEFAULT_REGION from cloudaux.aws.iam import list_users -from cloudaux.orchestration.aws.iam.user import get_user +from cloudaux.orchestration.aws.iam.user import get_all_users class IAMUser(CloudAuxWatcher): @@ -27,7 +27,7 @@ def _get_regions(self): return [AWS_DEFAULT_REGION] def list_method(self, **kwargs): - return list_users(**kwargs) + return get_all_users(**kwargs) def get_method(self, item, **kwargs): - return get_user(item, **kwargs) + return item