-
Notifications
You must be signed in to change notification settings - Fork 54
Add all remaining aws package permissions to the Federated Identity CFT #7637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seanrathier
wants to merge
9
commits into
main
Choose a base branch
from
seanrathier/federated-identity-aws-remaining
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+340
−0
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
52ef28c
Add parameterized CloudFormation template for Federated Identity (AWS)
seanrathier a3abc38
Simplify federated-identity-aws.yml: grant all permissions unconditio…
seanrathier 5cfb4c0
Add security posture permissions from integrations#20240 patch sets
seanrathier 7c6c286
Align per-service permissions with integrations#19405 declarations
seanrathier 63434a3
Rework template to grow incrementally from declared permissions
seanrathier 2bc6e79
Add all remaining integration permissions to the Federated Identity CFT
seanrathier 08dbf06
Add aws Config permissions to the Federated Identity CFT
seanrathier 33cd03f
Remove ElasticAwsSecurityHub — moving to separate PR (ingest-dev#8812)
seanrathier 83fb8a6
Add SecurityAudit to combined Federated Identity CFT for CSPM and CAI
seanrathier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,337 @@ | ||
| AWSTemplateFormatVersion: "2010-09-09" | ||
|
|
||
| Description: 'Creates an IAM Role for Elastic Federated Identity (Cloud Connectors). Grants read-only permissions for all Elastic AWS integrations that support Federated Identity: the aws package integrations (GuardDuty, Inspector, Config, CloudWatch, and metrics services), Cloud Security Posture Management (cloud_security_posture), and Cloud Asset Inventory (cloud_asset_inventory).' | ||
|
|
||
| Parameters: | ||
| ElasticResourceId: | ||
| Description: The Elastic resource ID (deployment component ID or serverless project ID) that the role will trust. | ||
| Type: String | ||
|
|
||
| ElasticRoleARN: | ||
| Description: Elastic's super-role ARN. Change only for test environments. | ||
| Type: String | ||
| Default: arn:aws:iam::254766567737:role/cloud_connectors | ||
|
|
||
| Resources: | ||
|
|
||
| # Grants live in two places, both mirroring the provider_permissions | ||
| # declared in each integration's package manifest (elastic/integrations): | ||
| # managed policies (`roles`) go on the role's ManagedPolicyArns; inline | ||
| # permissions get one AWS::IAM::Policy resource per federated integration. | ||
| # Add grants only when an integration gains Federated Identity support — | ||
| # never ahead of a declaration. | ||
| ElasticFederatedIdentityRole: | ||
| Type: AWS::IAM::Role | ||
| Properties: | ||
| RoleName: !Sub ElasticFederatedIdentity-${AWS::StackName} | ||
| AssumeRolePolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Principal: | ||
| AWS: !Ref ElasticRoleARN | ||
| Action: sts:AssumeRole | ||
| Condition: | ||
| StringEquals: | ||
| sts:ExternalId: !Join | ||
| - '-' | ||
| - - !Ref ElasticResourceId | ||
| - !Select | ||
| - 2 | ||
| - !Split | ||
| - / | ||
| - !Ref AWS::StackId | ||
| Path: / | ||
| ManagedPolicyArns: | ||
|
|
||
| # aws/guardduty: pre-dates provider_permissions; grant carried over | ||
| # from the shipped cloud-connectors-guardduty template. | ||
| - arn:aws:iam::aws:policy/AmazonGuardDutyReadOnlyAccess | ||
|
|
||
| # cloud_security_posture (CSPM) and cloud_asset_inventory (CAI): | ||
| # both require SecurityAudit for broad read-only access to AWS config | ||
| # and resource metadata. Consolidates the grants previously split across | ||
| # deploy/cloudformation/cloud-connectors-remote-role.yml (CSPM) and | ||
| # deploy/asset-inventory-cloudformation/cloud-connectors-remote-role.yml (CAI). | ||
| - arn:aws:iam::aws:policy/SecurityAudit | ||
|
|
||
| # aws/inspector: inspector2 data stream | ||
| ElasticAwsInspector: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsInspector-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - inspector2:ListFindings | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/cloudwatch: cloudwatch_logs (aws-cloudwatch) and cloudwatch_metrics (aws/metrics) | ||
| # Also covers ec2_logs, elb_logs, lambda_logs via the shared aws-cloudwatch input | ||
| ElasticAwsCloudwatchLogs: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsCloudwatchLogs-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - logs:DescribeLogGroups | ||
| - logs:FilterLogEvents | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # Shared base for all aws/metrics metricsets (cloudwatch, ec2, elb, lambda, rds, etc.) | ||
| ElasticAwsMetrics: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsMetrics-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ec2:DescribeRegions | ||
| - cloudwatch:ListMetrics | ||
| - cloudwatch:GetMetricData | ||
| - tag:GetResources | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/awshealth: health events data stream | ||
| ElasticAwsHealth: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsHealth-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - health:DescribeEvents | ||
| - health:DescribeEventDetails | ||
| - health:DescribeAffectedEntities | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/config: rule listing and per-rule compliance reads for the AWS Config data stream | ||
| ElasticAwsConfig: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsConfig-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - config:DescribeConfigRules | ||
| - config:GetComplianceDetailsByConfigRule | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/billing: billing metrics data stream | ||
| ElasticAwsBilling: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsBilling-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ce:GetCostAndUsage | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/dynamodb: dynamodb metrics data stream | ||
| ElasticAwsDynamoDB: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsDynamoDB-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - dynamodb:ListTables | ||
| - dynamodb:DescribeTable | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/ebs: ebs metrics data stream | ||
| ElasticAwsEBS: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsEBS-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ec2:DescribeVolumes | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/ec2: ec2_metrics data stream | ||
| ElasticAwsEC2: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsEC2-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ec2:DescribeInstances | ||
| - ec2:DescribeInstanceStatus | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/ecs: ecs_metrics data stream | ||
| ElasticAwsECS: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsECS-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ecs:ListClusters | ||
| - ecs:DescribeClusters | ||
| - ecs:ListServices | ||
| - ecs:DescribeServices | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/elb: elb_metrics data stream | ||
| ElasticAwsELB: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsELB-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - elasticloadbalancing:DescribeLoadBalancers | ||
| - elasticloadbalancing:DescribeTargetGroups | ||
| - elasticloadbalancing:DescribeTargetHealth | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/lambda: lambda metrics data stream | ||
| ElasticAwsLambda: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsLambda-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - lambda:ListFunctions | ||
| - lambda:GetFunction | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/rds: rds metrics data stream | ||
| ElasticAwsRDS: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsRDS-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - rds:DescribeDBInstances | ||
| - rds:DescribeDBClusters | ||
| - rds:ListTagsForResource | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/sns: sns metrics data stream | ||
| ElasticAwsSNS: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsSNS-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - sns:ListTopics | ||
| - sns:GetTopicAttributes | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/sqs: sqs metrics data stream | ||
| ElasticAwsSQS: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsSQS-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - sqs:ListQueues | ||
| - sqs:GetQueueAttributes | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| # aws/transitgateway: transitgateway metrics data stream | ||
| ElasticAwsTransitGateway: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub ElasticAwsTransitGateway-${AWS::StackName} | ||
| PolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ec2:DescribeTransitGateways | ||
| - ec2:DescribeTransitGatewayAttachments | ||
| Resource: '*' | ||
| Roles: | ||
| - !Ref ElasticFederatedIdentityRole | ||
|
|
||
| Outputs: | ||
| RoleArn: | ||
| Description: The ARN of the IAM Role. Paste this into Kibana. | ||
| Value: !GetAtt ElasticFederatedIdentityRole.Arn | ||
|
|
||
| ExternalId: | ||
| Description: The External ID used in the trust policy. Paste this into Kibana. | ||
| Value: !Join | ||
| - '-' | ||
| - - !Ref ElasticResourceId | ||
| - !Select | ||
| - 2 | ||
| - !Split | ||
| - / | ||
| - !Ref AWS::StackId | ||
|
|
||
| StackId: | ||
| Description: Store this in Kibana to construct stack-update URLs later. | ||
| Value: !Ref AWS::StackId | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.