Skip to content
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

add templates #1

Merged
merged 17 commits into from
May 19, 2023
1 change: 1 addition & 0 deletions submodules/cfn-abi-aws-cloudtrail
Submodule cfn-abi-aws-cloudtrail added at 0f3834
58 changes: 6 additions & 52 deletions templates/horizon_init_stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Metadata:
- StackSetAdminRole
- StackSetExecRole
- CreateOrgTrail
- TrailName
- Label:
default: AWS S3 Bucket
Parameters:
Expand Down Expand Up @@ -51,8 +50,6 @@ Metadata:
default: StackSet Administration Role
CreateOrgTrail:
default: Create Optional Organization CloudTrail
TrailName:
default: Name of Optional Organization CloudTrail
pOrganizationId:
default: (Optional) AWS Organization ID

Expand Down Expand Up @@ -115,9 +112,6 @@ Parameters:
- 'true'
- 'false'
Default: 'false'
TrailName:
Type: String
Default: "crowdstrike-horizon-trail"
pOrganizationId:
AllowedPattern: '^$|^o-[a-z0-9]{10,32}$'
ConstraintDescription: Must start with 'o-' followed by from 10 to 32 lowercase letters or digits. (e.g. o-abc1234567)
Expand All @@ -141,54 +135,14 @@ Mappings:
CSRoleName: "CrowdStrikeCSPMConnector"

Resources:
# Create trail, bucket, and bucket policy to enable EB event collection
TrailBucket:
Condition: CreateTrail
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
AccessControl: Private
Trail:
CloudTrailStack:
Type: 'AWS::CloudFormation::Stack'
Condition: CreateTrail
Type: AWS::CloudTrail::Trail
DependsOn: BucketPolicy
Properties:
S3BucketName: !Ref TrailBucket
IsLogging: true
TrailName: !Sub ${TrailName}
IncludeGlobalServiceEvents: true
IsMultiRegionTrail: true
IsOrganizationTrail: true
S3KeyPrefix: cloudtrail-logs
EventSelectors:
- IncludeManagementEvents: true
BucketPolicy:
Condition: CreateTrail
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref TrailBucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AWSCloudTrailAclCheck20150319
Effect: Allow
Principal:
Service: cloudtrail.amazonaws.com
Action: s3:GetBucketAcl
Resource: !Sub arn:aws:s3:::${TrailBucket}
Condition:
StringEquals:
AWS:SourceArn: !Sub arn:aws:cloudtrail:${AWS::Region}:${AWS::AccountId}:trail/${TrailName}
- Sid: AWSCloudTrailWrite20150319
Effect: Allow
Principal:
Service: cloudtrail.amazonaws.com
Action: s3:PutObject
Resource: !Sub arn:aws:s3:::${TrailBucket}/*
Condition:
StringEquals:
s3:x-amz-acl: bucket-owner-full-control
AWS:SourceArn: !Sub arn:aws:cloudtrail:${AWS::Region}:${AWS::AccountId}:trail/${TrailName}
TemplateURL: !Sub https://${SourceS3BucketName}.s3.${S3BucketRegion}.${AWS::URLSuffix}/${StagingS3KeyPrefix}/submodules/cfn-abi-aws-cloudtrail/templates/sra-cloudtrail-enable-in-org-ssm.yaml
Parameters:
pSRAS3BucketRegion: !Ref S3BucketRegion
pEnableDataEventsOnly: false

# Create CSPM Role and StackSet
CrowdStrikeCSPMRole:
Expand Down