|
| 1 | +AWSTemplateFormatVersion: "2010-09-09" |
| 2 | +Description: EventBridge resources that forward CloudTrail logs to Sysdig Secure via API Destination |
| 3 | + |
| 4 | +Metadata: |
| 5 | + AWS::CloudFormation::Interface: |
| 6 | + ParameterGroups: |
| 7 | + - Label: |
| 8 | + default: "Sysdig Settings (Do not change)" |
| 9 | + Parameters: |
| 10 | + - EventBridgeRoleName |
| 11 | + - ExternalID |
| 12 | + - TrustedIdentity |
| 13 | + - ApiKey |
| 14 | + - IngestionUrl |
| 15 | + - RateLimit |
| 16 | + - EventBridgeState |
| 17 | + - EventBridgeEventPattern |
| 18 | + |
| 19 | + ParameterLabels: |
| 20 | + ExternalID: |
| 21 | + default: "External ID (Sysdig use only)" |
| 22 | + TrustedIdentity: |
| 23 | + default: "Trusted Identity (Sysdig use only)" |
| 24 | + ApiKey: |
| 25 | + default: "API Key (Sysdig use only)" |
| 26 | + IngestionUrl: |
| 27 | + default: "Ingestion URL (Sysdig use only)" |
| 28 | + RateLimit: |
| 29 | + default: "Rate Limit (Sysdig use only)" |
| 30 | + EventBridgeRoleName: |
| 31 | + default: "Integration Name (Sysdig use only)" |
| 32 | + EventBridgeState: |
| 33 | + default: "State of the EventBridge Rule (Sysdig use only)" |
| 34 | + EventBridgeEventPattern: |
| 35 | + default: "Event Pattern (Sysdig use only)" |
| 36 | + |
| 37 | +Parameters: |
| 38 | + EventBridgeRoleName: |
| 39 | + Type: String |
| 40 | + Description: A unique identifier used to create an IAM Role and EventBridge Rule |
| 41 | + ExternalID: |
| 42 | + Type: String |
| 43 | + Description: Sysdig ExternalID required for the policy creation |
| 44 | + TrustedIdentity: |
| 45 | + Type: String |
| 46 | + Description: The Role in Sysdig's AWS Account with permissions to your account |
| 47 | + ApiKey: |
| 48 | + Type: String |
| 49 | + Description: API key for Sysdig Secure authentication |
| 50 | + IngestionUrl: |
| 51 | + Type: String |
| 52 | + Description: Sysdig Secure API ingestion URL |
| 53 | + RateLimit: |
| 54 | + Type: Number |
| 55 | + Description: Maximum invocations per second for the API destination |
| 56 | + Default: 300 |
| 57 | + EventBridgeState: |
| 58 | + Type: String |
| 59 | + Description: The state of the EventBridge Rule |
| 60 | + Default: ENABLED |
| 61 | + AllowedValues: |
| 62 | + - ENABLED |
| 63 | + - DISABLED |
| 64 | + EventBridgeEventPattern: |
| 65 | + Type: String |
| 66 | + Description: JSON pattern for the EventBridge rule's event pattern |
| 67 | + Default: | |
| 68 | + { |
| 69 | + "detail-type": [ |
| 70 | + "AWS API Call via CloudTrail", |
| 71 | + "AWS Console Sign In via CloudTrail", |
| 72 | + "AWS Service Event via CloudTrail", |
| 73 | + "Object Access Tier Changed", |
| 74 | + "Object ACL Updated", |
| 75 | + "Object Created", |
| 76 | + "Object Deleted", |
| 77 | + "Object Restore Completed", |
| 78 | + "Object Restore Expired", |
| 79 | + "Object Restore Initiated", |
| 80 | + "Object Storage Class Changed", |
| 81 | + "Object Tags Added", |
| 82 | + "Object Tags Deleted", |
| 83 | + "GuardDuty Finding" |
| 84 | + ] |
| 85 | + } |
| 86 | +
|
| 87 | +Resources: |
| 88 | + EventBridgeConnection: |
| 89 | + Type: AWS::Events::Connection |
| 90 | + Properties: |
| 91 | + Name: !Sub ${EventBridgeRoleName}-connection |
| 92 | + AuthorizationType: API_KEY |
| 93 | + AuthParameters: |
| 94 | + ApiKey: |
| 95 | + Key: X-Api-Key |
| 96 | + Value: !Ref ApiKey |
| 97 | + |
| 98 | + EventBridgeApiDestination: |
| 99 | + Type: AWS::Events::ApiDestination |
| 100 | + Properties: |
| 101 | + Name: !Sub ${EventBridgeRoleName}-destination |
| 102 | + ConnectionArn: !GetAtt EventBridgeConnection.Arn |
| 103 | + InvocationEndpoint: !Ref IngestionUrl |
| 104 | + HttpMethod: POST |
| 105 | + InvocationRateLimitPerSecond: !Ref RateLimit |
| 106 | + |
| 107 | + EventBridgeRole: |
| 108 | + Type: AWS::IAM::Role |
| 109 | + Properties: |
| 110 | + RoleName: !Ref EventBridgeRoleName |
| 111 | + AssumeRolePolicyDocument: |
| 112 | + Statement: |
| 113 | + - Effect: Allow |
| 114 | + Principal: |
| 115 | + Service: events.amazonaws.com |
| 116 | + Action: 'sts:AssumeRole' |
| 117 | + - Effect: "Allow" |
| 118 | + Principal: |
| 119 | + AWS: !Ref TrustedIdentity |
| 120 | + Action: "sts:AssumeRole" |
| 121 | + Condition: |
| 122 | + StringEquals: |
| 123 | + sts:ExternalId: !Ref ExternalID |
| 124 | + Policies: |
| 125 | + - PolicyName: !Ref EventBridgeRoleName |
| 126 | + PolicyDocument: |
| 127 | + Version: "2012-10-17" |
| 128 | + Statement: |
| 129 | + - Sid: "InvokeApiDestination" |
| 130 | + Effect: Allow |
| 131 | + Action: |
| 132 | + - "events:InvokeApiDestination" |
| 133 | + Resource: |
| 134 | + - !Sub "arn:aws:events:*:*:api-destination/${EventBridgeRoleName}-destination/*" |
| 135 | + - Sid: "CloudTrailEventRuleAccess" |
| 136 | + Effect: Allow |
| 137 | + Action: |
| 138 | + - "events:DescribeRule" |
| 139 | + - "events:ListTargetsByRule" |
| 140 | + Resource: |
| 141 | + - !Sub "arn:aws:events:*:*:rule/${EventBridgeRoleName}" |
| 142 | + - Sid: "ValidationAccess" |
| 143 | + Effect: Allow |
| 144 | + Action: |
| 145 | + - "events:DescribeApiDestination" |
| 146 | + - "events:DescribeConnection" |
| 147 | + Resource: "*" |
| 148 | + |
| 149 | + EventBridgeRule: |
| 150 | + Type: AWS::Events::Rule |
| 151 | + Properties: |
| 152 | + Name: !Ref EventBridgeRoleName |
| 153 | + Description: Capture all CloudTrail events for Sysdig Secure |
| 154 | + EventPattern: !Ref EventBridgeEventPattern |
| 155 | + State: !Ref EventBridgeState |
| 156 | + Targets: |
| 157 | + - Id: !Ref EventBridgeRoleName |
| 158 | + Arn: !GetAtt EventBridgeApiDestination.Arn |
| 159 | + RoleArn: !GetAtt EventBridgeRole.Arn |
0 commit comments