-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ecs policies to the catalog
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
- Loading branch information
1 parent
dd3b385
commit c378c92
Showing
6 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,21 @@ | ||
apiVersion: json.kyverno.io/v1alpha1 | ||
kind: ValidatingPolicy | ||
metadata: | ||
name: ecs-cluster-enable-logging | ||
spec: | ||
rules: | ||
- name: ecs-cluster-enable-logging | ||
match: | ||
any: | ||
- type: aws_ecs_cluster | ||
context: | ||
- name: forbidden_values | ||
variable: ["NONE"] | ||
assert: | ||
all: | ||
- message: "ECS Cluster should enable logging of ECS Exec" | ||
check: | ||
values: | ||
~.configuration: | ||
~.execute_command_configuration: | ||
(contains($forbidden_values, @.logging)): false |
This file contains 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,20 @@ | ||
apiVersion: json.kyverno.io/v1alpha1 | ||
kind: ValidatingPolicy | ||
metadata: | ||
name: required-container-insights | ||
spec: | ||
rules: | ||
- name: required-container-insights | ||
match: | ||
any: | ||
- type: aws_ecs_cluster | ||
assert: | ||
all: | ||
- message: "Container insights should be enabled on ECS cluster" | ||
check: | ||
values: | ||
~.setting: | ||
name: containerInsights | ||
value: enabled | ||
|
||
|
This file contains 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,20 @@ | ||
apiVersion: json.kyverno.io/v1alpha1 | ||
kind: ValidatingPolicy | ||
metadata: | ||
name: ecs-public-ip | ||
spec: | ||
rules: | ||
- name: ecs-public-ip | ||
match: | ||
any: | ||
- type: aws_ecs_service | ||
context: | ||
- name: allowed-values | ||
variable: [false] | ||
assert: | ||
all: | ||
- message: "ECS services should not have public IP addresses assigned to them automatically" | ||
check: | ||
values: | ||
~.network_configuration: | ||
(contains('$allowed-values', @.assign_public_ip)): false |
21 changes: 21 additions & 0 deletions
21
catalog/ecs/ecs-service-required-latest-platform-fargate.yaml
This file contains 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,21 @@ | ||
apiVersion: json.kyverno.io/v1alpha1 | ||
kind: ValidatingPolicy | ||
metadata: | ||
name: required-latest-platform-fargate | ||
spec: | ||
rules: | ||
- name: required-latest-platform | ||
match: | ||
any: | ||
- type: aws_ecs_service | ||
values: | ||
launch_type: FARGATE | ||
context: | ||
- name: pv | ||
variable: platform_version | ||
assert: | ||
all: | ||
- message: "ECS Fargate services should run on the latest Fargate platform version" | ||
check: | ||
values: | ||
platform_version: 'LATEST' |
This file contains 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,18 @@ | ||
apiVersion: json.kyverno.io/v1alpha1 | ||
kind: ValidatingPolicy | ||
metadata: | ||
name: fs-read-only | ||
spec: | ||
rules: | ||
- name: require-fs-read-only | ||
match: | ||
any: | ||
- type: aws_ecs_task_definition | ||
assert: | ||
any: | ||
- message: ECS containers only have read-only access to root filesystems | ||
check: | ||
values: | ||
~.(json_parse(container_definitions)): | ||
readonlyRootFilesystem: true | ||
|
This file contains 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