-
Notifications
You must be signed in to change notification settings - Fork 1
[SSPROD-48724] CFT template for VM Workload Scanning #139
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
Merged
miguelpais
merged 7 commits into
main
from
ssprod-48724-cft-for-vm-workload-scanning-aws
Dec 12, 2024
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
27e26eb
CFT template for VM Workload Scanning
miguelpais 2e87d6d
Version without so many variables
miguelpais f6426db
With org corrected
miguelpais 4c654d0
Pushed my mistake some changes to makefile, reverting them
miguelpais 34abf9d
comments from ravhina's pull request
miguelpais 062c41b
Identation fix
miguelpais 1bf18a3
Fixing condition
miguelpais 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
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,260 @@ | ||
| AWSTemplateFormatVersion: '2010-09-09' | ||
| Description: Sysdig Secure Agentless Workload Scanning Onboarding | ||
| Metadata: | ||
| AWS::CloudFormation::Interface: | ||
| ParameterGroups: | ||
| - Label: | ||
| default: Sysdig Assigned Settings (Do not change) | ||
| Parameters: | ||
| - NameSuffix | ||
| - ExternalID | ||
| - TrustedIdentity | ||
| - LambdaScanningEnabled | ||
| - IsOrganizational | ||
| - OrganizationalUnitIDs | ||
| ParameterLabels: | ||
| NameSuffix: | ||
| default: Name Suffix | ||
| ExternalID: | ||
| default: External ID | ||
| TrustedIdentity: | ||
| default: Trusted Identity | ||
| LambdaScanningEnabled: | ||
| default: Enable Lambda Scanning | ||
| IsOrganizational: | ||
| default: Is Organizational Deployment? | ||
| OrganizationalUnitIDs: | ||
| default: Organizational Unit IDs | ||
| Parameters: | ||
| NameSuffix: | ||
| Type: String | ||
| Description: Suffix to append to the resource name identifiers | ||
| AllowedPattern: '[0-9a-z]+' | ||
| MaxLength: 8 | ||
| MinLength: 4 | ||
| ExternalID: | ||
| Type: String | ||
| Description: Sysdig assigned token that proves you own this account | ||
| TrustedIdentity: | ||
| Type: String | ||
| Description: The Role in Sysdig's AWS Account with permissions to your account | ||
| LambdaScanningEnabled: | ||
| Type: String | ||
| Description: Enable Lambda function scanning | ||
| Default: 'false' | ||
| AllowedValues: | ||
| - 'true' | ||
| - 'false' | ||
| IsOrganizational: | ||
| Type: String | ||
| Description: Whether this is an organizational deployment | ||
| Default: 'false' | ||
| AllowedValues: | ||
| - 'true' | ||
| - 'false' | ||
| OrganizationalUnitIDs: | ||
| Type: CommaDelimitedList | ||
| Description: Comma-separated list of organizational unit IDs to deploy (required for organizational deployments) | ||
|
|
||
| Conditions: | ||
| IsOrganizational: | ||
| Fn::Equals: | ||
| - Ref: IsOrganizational | ||
| - 'true' | ||
| IsNotOrganizational: | ||
| Fn::Equals: | ||
| - Ref: IsOrganizational | ||
| - 'false' | ||
| IsNotOrganizationalAndLambdaEnabled: | ||
| Fn::And: | ||
| - Fn::Equals: | ||
| - Ref: IsOrganizational | ||
| - 'false' | ||
| - Fn::Equals: | ||
| - Ref: LambdaScanningEnabled | ||
| - 'true' | ||
|
|
||
| Resources: | ||
| ScanningRole: | ||
| Type: AWS::IAM::Role | ||
| Condition: IsNotOrganizational | ||
| Properties: | ||
| RoleName: !Sub sysdig-vm-workload-scanning-${NameSuffix} | ||
| AssumeRolePolicyDocument: | ||
| Version: '2012-10-17' | ||
| Statement: | ||
| - Effect: Allow | ||
| Principal: | ||
| AWS: | ||
| Ref: TrustedIdentity | ||
| Action: ['sts:AssumeRole'] | ||
| Condition: | ||
| StringEquals: | ||
| sts:ExternalId: | ||
| Ref: ExternalID | ||
| ECRPolicy: | ||
| Type: AWS::IAM::Policy | ||
| Condition: IsNotOrganizational | ||
| Properties: | ||
| PolicyName: !Sub sysdig-vm-workload-scanning-${NameSuffix}-ecr | ||
| Roles: | ||
| - !Ref ScanningRole | ||
| PolicyDocument: | ||
| Version: '2012-10-17' | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ecr:GetDownloadUrlForLayer | ||
| - ecr:BatchGetImage | ||
| - ecr:BatchCheckLayerAvailability | ||
| - ecr:ListImages | ||
| - ecr:GetAuthorizationToken | ||
| Resource: '*' | ||
| LambdaPolicy: | ||
| Type: AWS::IAM::Policy | ||
| Condition: IsNotOrganizationalAndLambdaEnabled | ||
| Properties: | ||
| PolicyName: !Sub sysdig-vm-workload-scanning-${NameSuffix}-lambda | ||
| Roles: | ||
| - !Ref ScanningRole | ||
| PolicyDocument: | ||
| Version: '2012-10-17' | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - lambda:GetFunction | ||
| - lambda:GetFunctionConfiguration | ||
| - lambda:GetRuntimeManagementConfig | ||
| - lambda:ListFunctions | ||
| - lambda:ListTagsForResource | ||
| - lambda:GetLayerVersionByArn | ||
| - lambda:GetLayerVersion | ||
| - lambda:ListLayers | ||
| - lambda:ListLayerVersions | ||
| Resource: '*' | ||
|
|
||
|
|
||
| ScanningOrgStackSet: | ||
| Type: AWS::CloudFormation::StackSet | ||
| Condition: IsOrganizational | ||
| Properties: | ||
| StackSetName: !Sub sysdig-vm-workload-scanning-${NameSuffix} | ||
| Description: Creates IAM roles within an AWS organization for Agentless Workload Scanning | ||
| PermissionModel: SERVICE_MANAGED | ||
| Capabilities: | ||
| - CAPABILITY_NAMED_IAM | ||
| AutoDeployment: | ||
| Enabled: true | ||
| RetainStacksOnAccountRemoval: false | ||
| ManagedExecution: | ||
| Active: true | ||
| OperationPreferences: | ||
| MaxConcurrentPercentage: 100 | ||
| FailureTolerancePercentage: 90 | ||
| ConcurrencyMode: SOFT_FAILURE_TOLERANCE | ||
| Parameters: | ||
| - ParameterKey: NameSuffix | ||
| ParameterValue: | ||
| Ref: NameSuffix | ||
| - ParameterKey: TrustedIdentity | ||
| ParameterValue: | ||
| Ref: TrustedIdentity | ||
| - ParameterKey: ExternalID | ||
| ParameterValue: | ||
| Ref: ExternalID | ||
| - ParameterKey: LambdaScanningEnabled | ||
| ParameterValue: | ||
| Ref: LambdaScanningEnabled | ||
| StackInstancesGroup: | ||
| - DeploymentTargets: | ||
| OrganizationalUnitIds: !Ref OrganizationalUnitIDs | ||
| Regions: | ||
| - Ref: AWS::Region | ||
| TemplateBody: | | ||
| AWSTemplateFormatVersion: "2010-09-09" | ||
| Description: IAM Role for Agentless Workload Scanning | ||
| Parameters: | ||
| NameSuffix: | ||
| Type: String | ||
| Description: Suffix to append to the resource name identifiers | ||
| AllowedPattern: "[0-9a-z]+" | ||
| MaxLength: 8 | ||
| MinLength: 4 | ||
| TrustedIdentity: | ||
| Type: String | ||
| Description: Trusted identity | ||
| ExternalID: | ||
| Type: String | ||
| Description: external ID | ||
| LambdaScanningEnabled: | ||
| Type: String | ||
| Description: Enable Lambda function scanning | ||
| Default: 'false' | ||
| Conditions: | ||
| IsLambdaEnabled: | ||
| Fn::Equals: | ||
| - Ref: LambdaScanningEnabled | ||
| - 'true' | ||
| Resources: | ||
| ScanningRole: | ||
| Type: AWS::IAM::Role | ||
| Properties: | ||
| RoleName: !Sub sysdig-vm-workload-scanning-${NameSuffix} | ||
| AssumeRolePolicyDocument: | ||
| Version: "2012-10-17" | ||
| Statement: | ||
| - Effect: "Allow" | ||
| Action: "sts:AssumeRole" | ||
| Principal: | ||
| AWS: !Ref TrustedIdentity | ||
| Condition: | ||
| StringEquals: | ||
| sts:ExternalId: !Ref ExternalID | ||
| ECRPolicy: | ||
| Type: AWS::IAM::Policy | ||
| Properties: | ||
| PolicyName: !Sub sysdig-vm-workload-scanning-${NameSuffix}-ecr | ||
| Roles: | ||
| - !Ref ScanningRole | ||
| PolicyDocument: | ||
| Version: '2012-10-17' | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - ecr:GetDownloadUrlForLayer | ||
| - ecr:BatchGetImage | ||
| - ecr:BatchCheckLayerAvailability | ||
| - ecr:ListImages | ||
| - ecr:GetAuthorizationToken | ||
| Resource: '*' | ||
| LambdaPolicy: | ||
| Type: AWS::IAM::Policy | ||
| Condition: IsOrganizationalAndLambdaEnabled | ||
| Properties: | ||
| PolicyName: !Sub sysdig-vm-workload-scanning-${NameSuffix}-lambda | ||
| Roles: | ||
| - !Ref ScanningRole | ||
| PolicyDocument: | ||
| Version: '2012-10-17' | ||
| Statement: | ||
| - Effect: Allow | ||
| Action: | ||
| - lambda:GetFunction | ||
| - lambda:GetFunctionConfiguration | ||
| - lambda:GetRuntimeManagementConfig | ||
| - lambda:ListFunctions | ||
| - lambda:ListTagsForResource | ||
| - lambda:GetLayerVersionByArn | ||
| - lambda:GetLayerVersion | ||
| - lambda:ListLayers | ||
| - lambda:ListLayerVersions | ||
| Resource: '*' | ||
|
|
||
|
|
||
|
|
||
| Outputs: | ||
| ScanningRoleARN: | ||
| Description: ARN of the scanning role | ||
| Value: | ||
| Fn::Sub: sysdig-vm-workload-scanning-${NameSuffix} | ||
|
|
||
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,12 @@ | ||
| [ | ||
| { | ||
| "type": "COMPONENT_TRUSTED_ROLE", | ||
| "instance": "secure-vm-workload-scanning", | ||
| "version": "v0.1.0", | ||
| "trustedRoleMetadata": { | ||
| "aws": { | ||
| "roleName": "sysdig-vm-workload-scanning-{{NameSuffix}}" | ||
| } | ||
| } | ||
| } | ||
| ] |
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.
Uh oh!
There was an error while loading. Please reload this page.