Skip to content

Commit

Permalink
fix: Replace custom in line policy with securityAudit policy
Browse files Browse the repository at this point in the history
  • Loading branch information
arunpaladin authored and santhosh-challa committed Mar 14, 2023
1 parent 1408d10 commit 55b501d
Showing 1 changed file with 4 additions and 106 deletions.
110 changes: 4 additions & 106 deletions installer/resources/iam/base_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class BaseCloudWatchEventFullAcessPolicyAttach(iam.IAMRolePolicyAttachmentResour
role = BaseRole.get_output_attr('name')
policy_arn = "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"

class BaseSecurityAudit(iam.IAMRolePolicyAttachmentResource):
role = BaseRole.get_output_attr('name')
policy_arn = "arn:aws:iam::aws:policy/SecurityAudit"


class ECSTaskExecutionRolePolicyDocument(iam.IAMPolicyDocumentData):
statement = [
Expand Down Expand Up @@ -76,112 +80,6 @@ class BaseECSTaskExecPolicyAttach(iam.IAMRolePolicyAttachmentResource):
role = BaseRole.get_output_attr('name')
policy_arn = ECSTaskExecutionRolePolicy.get_output_attr('arn')

class PolicySpecificReadOnlyAccessPolicyDocument(iam.IAMPolicyDocumentData):
statement = [
{
"effect": "Allow",
"actions": [
"access-analyzer:ListAnalyzers",
"acm:DescribeCertificate",
"acm:ListCertificates",
"apigateway:GET",
"appflow:ListFlows",
"athena:ListQueryExecutions",
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribePolicies",
"backup:ListBackupVaults",
"cloudformation:DescribeStacks",
"cloudformation:ListStacks",
"cloudfront:GetDistributionConfig",
"cloudfront:ListDistributions",
"cloudtrail:DescribeTrails",
"cloudtrail:GetEventSelectors",
"cloudtrail:GetTrailStatus",
"cloudtrail:LookupEvents",
"cloudwatch:DescribeAlarms",
"comprehend:ListEntitiesDetectionJobs",
"dax:DescribeClusters",
"directconnect:Describe*",
"dms:DescribeReplicationInstances",
"dynamodb:Describe*",
"dynamodb:List*",
"ec2:Describe*",
"ecs:DescribeClusters",
"ecs:DescribeTaskDefinition",
"ecs:List*",
"eks:ListClusters",
"elasticache:Describe*",
"elasticache:List*",
"elasticfilesystem:DescribeFileSystems",
"elasticloadbalancing:DescribeListeners",
"elasticloadbalancing:DescribeLoadBalancerAttributes",
"elasticloadbalancing:DescribeLoadBalancers",
"elasticloadbalancing:DescribeRules",
"elasticloadbalancing:DescribeTags",
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:DescribeTargetHealth",
"elasticmapreduce:ListClusters",
"es:DescribeElasticsearchDomains",
"es:ListDomainNames",
"es:ListTags",
"firehose:DescribeDeliveryStream",
"firehose:ListDeliveryStreams",
"firehose:ListTagsForDeliveryStream",
"health:DescribeAffectedEntities",
"health:DescribeEventDetails",
"health:DescribeEvents",
"iam:GetAccessKeyLastUsed",
"iam:ListAccessKeys",
"iam:ListAttachedGroupPolicies",
"iam:ListGroups",
"iam:ListGroupsForUser",
"iam:ListMFADevices",
"iam:ListPolicies",
"iam:ListRoles",
"iam:ListServerCertificates",
"iam:ListUsers",
"kinesis:ListStreams",
"kinesisvideo:ListStreams",
"kms:DescribeKey",
"kms:GetKeyRotationStatus",
"kms:ListAliases",
"kms:ListKeys",
"kms:ListResourceTags",
"lambda:GetPolicy",
"lambda:List*",
"rds:Describe*",
"rds:List*",
"redshift:DescribeClusters",
"redshift:DescribeLoggingStatus",
"route53:List*",
"s3:GetBucketLocation",
"s3:GetBucketLogging",
"s3:GetBucketNotification",
"s3:GetBucketTagging",
"s3:ListAllMyBuckets",
"s3:PutBucketNotification",
"securityhub:DescribeHub",
"sns:List*",
"SNS:ListTopics",
"sqs:ListQueues",
"ssm:DescribeInstanceInformation"

],
"resources": ["*"]
}
]


class PaladinCloudReadOnlyAccessRolePolicy(iam.IAMRolePolicyResource):
name = "ReadOnlyAccessForAWSPolicies"
path = '/'
policy = PolicySpecificReadOnlyAccessPolicyDocument.get_output_attr('json')


class PaladinCloudReadOnlyAccessPolicyAttach(iam.IAMRolePolicyAttachmentResource):
role = BaseRole.get_output_attr('name')
policy_arn = PaladinCloudReadOnlyAccessRolePolicy.get_output_attr('arn')


class PaladinCognitoUserPoolFullAccessDocument(iam.IAMPolicyDocumentData):
Expand Down

0 comments on commit 55b501d

Please sign in to comment.