Skip to content

Commit

Permalink
Updated config role permissions and fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferyfry committed Oct 6, 2023
1 parent 9bf6a5e commit 8017922
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CFT_PREFIX := templates
CFT_DIR := templates
DATASET := lacework-alliances-prod

PROFILE ?= ct
PROFILE ?= alliances-admin
REGION ?= us-west-2

BUCKET_NAME ?= service_not_defined
Expand Down
4 changes: 2 additions & 2 deletions lambda_functions/source/account/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT = LaceworkCTAccount
DIR_NAME = account
FUNCTION = $(PROJECT)3.0.0
DIST_DIR ?= "$(BASE)"/functions/packages/$(DIR_NAME)
FUNCTION = $(PROJECT)3.0.1
DIST_DIR ?= "$(BASE)"/lambda_functions/packages/$(DIR_NAME)
HONEY_DATASET = $(DATASET)

all: build
Expand Down
6 changes: 0 additions & 6 deletions lambda_functions/source/account/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ def cfn_stack_set_processing(messages):
if len(create_stack_instance_list) > 0:
response = create_stack_set_instances(config_stack_set_name, create_stack_instance_list,
param_regions, [
{
"ParameterKey": "AccessToken",
"ParameterValue": access_token,
"UsePreviousValue": False,
"ResolvedValue": "string"
},
{
"ParameterKey": "ExternalID",
"ParameterValue": external_id,
Expand Down
3 changes: 2 additions & 1 deletion lambda_functions/source/account/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
crhelper
requests
requests
urllib3==1.26.15
4 changes: 2 additions & 2 deletions lambda_functions/source/auth/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT = LaceworkCTAuth
DIR_NAME = auth
FUNCTION = $(PROJECT)
DIST_DIR ?= "$(BASE)"/functions/packages/$(DIR_NAME)
FUNCTION = $(PROJECT)3.0.1
DIST_DIR ?= "$(BASE)"/lambda_functions/packages/$(DIR_NAME)

all: build

Expand Down
3 changes: 2 additions & 1 deletion lambda_functions/source/auth/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
crhelper
requests
requests
urllib3==1.26.15
4 changes: 2 additions & 2 deletions lambda_functions/source/setup/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT = LaceworkCTSetup
DIR_NAME = setup
FUNCTION = $(PROJECT)3.0.0
DIST_DIR ?= "$(BASE)"/functions/packages/$(DIR_NAME)
FUNCTION = $(PROJECT)3.0.1
DIST_DIR ?= "$(BASE)"/lambda_functions/packages/$(DIR_NAME)
HONEY_DATASET = $(DATASET)

all: build
Expand Down
3 changes: 2 additions & 1 deletion lambda_functions/source/setup/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
crhelper
requests
requests
urllib3==1.26.15
12 changes: 0 additions & 12 deletions lambda_functions/source/setup/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,18 +529,6 @@ def setup_config(lacework_aws_account_id, lacework_url, lacework_account_name, l
"UsePreviousValue": False,
"ResolvedValue": "string"
},
{
"ParameterKey": "AccessToken",
"ParameterValue": access_token,
"UsePreviousValue": False,
"ResolvedValue": "string"
},
{
"ParameterKey": "ServiceToken",
"ParameterValue": service_token,
"UsePreviousValue": False,
"ResolvedValue": "string"
},
{
"ParameterKey": "LaceworkAWSAccountId",
"ParameterValue": lacework_aws_account_id,
Expand Down
12 changes: 6 additions & 6 deletions templates/cfn-abi-control-tower-integration.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ Resources:
Properties:
Code:
S3Bucket: !Ref S3BucketName
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/submodules/lacework-control-tower-cfn/lambda_functions/packages/setup/LaceworkCTSetup3.0.0.zip']]
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/submodules/lacework-control-tower-cfn/lambda_functions/packages/setup/LaceworkCTSetup3.0.1.zip']]
Handler: setup.lambda_handler
Runtime: python3.7
Runtime: python3.9
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -418,9 +418,9 @@ Resources:
Properties:
Code:
S3Bucket: !Ref S3BucketName
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/submodules/lacework-control-tower-cfn/lambda_functions/packages/account/LaceworkCTAccount3.0.0.zip']]
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/submodules/lacework-control-tower-cfn/lambda_functions/packages/account/LaceworkCTAccount3.0.1.zip']]
Handler: account.lambda_handler
Runtime: python3.7
Runtime: python3.9
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -463,9 +463,9 @@ Resources:
Properties:
Code:
S3Bucket: !Ref S3BucketName
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/submodules/lacework-control-tower-cfn/lambda_functions/packages/auth/LaceworkCTAuth.zip']]
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/submodules/lacework-control-tower-cfn/lambda_functions/packages/auth/LaceworkCTAuth3.0.1.zip']]
Handler: auth.lambda_handler
Runtime: python3.7
Runtime: python3.9
Timeout: 120
Environment:
Variables:
Expand Down
20 changes: 10 additions & 10 deletions templates/control-tower-integration.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ Resources:
SourceBucket: !Ref 'S3BucketName'
Prefix: !Ref 'S3KeyPrefix'
Objects:
- '/lambda/LaceworkCTAuth.zip'
- '/lambda/LaceworkCTSetup3.0.0.zip'
- '/lambda/LaceworkCTAccount3.0.0.zip'
- '/lambda/LaceworkCTAuth3.0.1.zip'
- '/lambda/LaceworkCTSetup3.0.1.zip'
- '/lambda/LaceworkCTAccount3.0.1.zip'

CopyZipsRole:
Type: AWS::IAM::Role
Expand Down Expand Up @@ -232,7 +232,7 @@ Resources:
Properties:
Description: Copies objects from the S3 bucket to a new location.
Handler: index.handler
Runtime: python3.7
Runtime: python3.9
Role: !GetAtt 'CopyZipsRole.Arn'
Timeout: 240
Code:
Expand Down Expand Up @@ -294,9 +294,9 @@ Resources:
Properties:
Code:
S3Bucket: !Ref LambdaZipsBucket
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/lambda/LaceworkCTSetup3.0.0.zip']]
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/lambda/LaceworkCTSetup3.0.1.zip']]
Handler: setup.lambda_handler
Runtime: python3.7
Runtime: python3.9
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -525,9 +525,9 @@ Resources:
Properties:
Code:
S3Bucket: !Ref LambdaZipsBucket
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/lambda/LaceworkCTAccount3.0.0.zip']]
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/lambda/LaceworkCTAccount3.0.1.zip']]
Handler: account.lambda_handler
Runtime: python3.7
Runtime: python3.9
Timeout: 900
Environment:
Variables:
Expand Down Expand Up @@ -570,9 +570,9 @@ Resources:
Properties:
Code:
S3Bucket: !Ref LambdaZipsBucket
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/lambda/LaceworkCTAuth.zip']]
S3Key: !Join ['', [!Ref 'S3KeyPrefix', '/lambda/LaceworkCTAuth3.0.1.zip']]
Handler: auth.lambda_handler
Runtime: python3.7
Runtime: python3.9
Timeout: 120
Environment:
Variables:
Expand Down
95 changes: 95 additions & 0 deletions templates/lacework-aws-cfg-member.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,98 @@ Resources:
'sts:ExternalId': !Ref ExternalID
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/SecurityAudit'
LaceworkCWSPolicy:
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: LaceworkCWSPolicy
PolicyDocument:
Version: 2012-10-17
Statement:
- Sid: GetEc2DefaultEncryption
Action:
- 'ec2:GetEbsEncryptionByDefault'
Effect: Allow
Resource: '*'
- Sid: EksListTagsForResource
Action:
- 'eks:ListTagsForResource'
Effect: Allow
Resource: '*'
- Sid: EfsPolicies
Action:
- 'elasticfilesystem:DescribeFileSystemPolicy'
- 'elasticfilesystem:DescribeLifecycleConfiguration'
- 'elasticfilesystem:DescribeAccessPoints'
- 'elasticfilesystem:DescribeAccountPreferences'
- 'elasticfilesystem:DescribeBackupPolicy'
- 'elasticfilesystem:DescribeReplicationConfigurations'
Effect: Allow
Resource: '*'
- Sid: SagemakerPolicies
Action:
- 'sagemaker:GetLineageGroupPolicy'
- 'sagemaker:GetModelPackageGroupPolicy'
Effect: Allow
Resource: '*'
- Sid: IdentityStoreReadOnly
Action:
- 'identitystore:DescribeGroup'
- 'identitystore:DescribeGroupMembership'
- 'identitystore:DescribeUser'
- 'identitystore:ListGroupMemberships'
- 'identitystore:ListGroupMembershipsForMember'
- 'identitystore:ListGroups'
- 'identitystore:ListUsers'
Effect: Allow
Resource: '*'
- Sid: SSOReadOnly
Action:
- 'sso:DescribeAccountAssignmentDeletionStatus'
- 'sso:DescribeInstanceAccessControlAttributeConfiguration'
- 'sso:GetInlinePolicyForPermissionSet'
Effect: Allow
Resource: '*'
- Sid: APIGATEWAY
Action:
- 'apigateway:GetApiKeys'
- 'apigateway:GetAuthorizers'
- 'apigateway:GetBasePathMappings'
- 'apigateway:GetClientCertificates'
- 'apigateway:GetDeployments'
- 'apigateway:GetDocumentationParts'
- 'apigateway:GetDocumentationVersions'
- 'apigateway:GetDomainNames'
- 'apigateway:GetGatewayResponses'
- 'apigateway:GetModels'
- 'apigateway:GetModelTemplate'
- 'apigateway:GetRequestValidators'
- 'apigateway:GetResources'
- 'apigateway:GetRestApis'
- 'apigateway:GetSdk'
- 'apigateway:GetSdkTypes'
- 'apigateway:GetStages'
- 'apigateway:GetTags'
- 'apigateway:GetUsagePlanKeys'
- 'apigateway:GetUsagePlans'
- 'apigateway:GetVpcLinks'
Effect: Allow
Resource: '*'
- Sid: APIGATEWAYV2
Action:
- 'apigatewayv2:GetApis'
- 'apigatewayv2:GetApiMappings'
- 'apigatewayv2:GetAuthorizers'
- 'apigatewayv2:GetDeployments'
- 'apigatewayv2:GetDomainNames'
- 'apigatewayv2:GetIntegrations'
- 'apigatewayv2:GetIntegrationResponses'
- 'apigatewayv2:GetModelTemplate'
- 'apigatewayv2:GetModels'
- 'apigatewayv2:GetRoute'
- 'apigatewayv2:GetRouteResponses'
- 'apigatewayv2:GetStages'
- 'apigatewayv2:GetVpcLinks'
Effect: Allow
Resource: '*'
Roles:
- !Ref LaceworkCrossAccountAccessRole

0 comments on commit 8017922

Please sign in to comment.