-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip: Merge pull request #211 from epam/upd_146
upd: update policy 146 to be supported by open source Cloud Custodian
- Loading branch information
Showing
29 changed files
with
512 additions
and
166 deletions.
There are no files selected for viewing
18 changes: 0 additions & 18 deletions
18
.../ecc-aws-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports.yml
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
...eryone_to_remote_server_administration_ports/placebo-green/ec2.DescribeNetworkAcls_1.json
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
..._acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red_policy_test.py
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
.../ecc-aws-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports.yml
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,16 @@ | ||
# Copyright (c) 2023 EPAM Systems, Inc. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
policies: | ||
- name: ecc-aws-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports | ||
comment: '010024022900' | ||
description: | | ||
VPC Network ACL allows ingress from 0.0.0.0/0 to remote server administration ports (22 or 3389) | ||
resource: aws.network-acl | ||
filters: | ||
- type: value | ||
key: min(Entries[?Egress==`false` && RuleAction=='allow' && contains(['-1', '6', '17'],Protocol) && (CidrBlock=='0.0.0.0/0' || Ipv6CidrBlock=='::/0') && (!PortRange || (PortRange.From <= `3389` && PortRange.To >= `3389`) || (PortRange.From <= `22` && PortRange.To >= `22`))].RuleNumber)>min(Entries[?Egress==`false` && RuleAction=='deny' && contains(['-1', '6', '17'],Protocol) && (CidrBlock=='0.0.0.0/0' || Ipv6CidrBlock=='::/0') && (!PortRange || (PortRange.From <= `3389` && PortRange.To >= `3389`) || (PortRange.From <= `22` && PortRange.To >= `22`))].RuleNumber) | ||
value: 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
20 changes: 20 additions & 0 deletions
20
..._acls_allow_ingress_for_everyone_to_remote_server_administration_ports/green2/provider.tf
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 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
profile = var.profile | ||
region = var.default-region | ||
|
||
default_tags { | ||
tags = { | ||
CustodianRule = "ecc-aws-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports" | ||
ComplianceStatus = "Green" | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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
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
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...ls_allow_ingress_for_everyone_to_remote_server_administration_ports/red1/terraform.tfvars
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,2 @@ | ||
profile = "c7n" | ||
default-region = "us-east-1" |
9 changes: 9 additions & 0 deletions
9
...o_acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red1/variables.tf
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,9 @@ | ||
variable "default-region" { | ||
type = string | ||
description = "Default region for resources will be created" | ||
} | ||
|
||
variable "profile" { | ||
type = string | ||
description = "Profile name configured before running apply" | ||
} |
30 changes: 30 additions & 0 deletions
30
...-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red1/vpc.tf
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,30 @@ | ||
resource "aws_vpc" "this" { | ||
cidr_block = "10.0.0.0/16" | ||
|
||
tags = { | ||
Name = "146_aws_vpc_red1" | ||
} | ||
} | ||
|
||
resource "aws_default_network_acl" "this" { | ||
default_network_acl_id = aws_vpc.this.default_network_acl_id | ||
tags = { | ||
Name = "146_default_network_acl_red1" | ||
} | ||
ingress { | ||
protocol = "udp" | ||
rule_no = 4 | ||
action = "allow" | ||
cidr_block = "0.0.0.0/0" | ||
from_port = 1 | ||
to_port = 65535 | ||
} | ||
ingress { | ||
protocol = "udp" | ||
rule_no = 40 | ||
action = "deny" | ||
cidr_block = "0.0.0.0/0" | ||
from_port = 1 | ||
to_port = 65535 | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red2/provider.tf
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 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
profile = var.profile | ||
region = var.default-region | ||
|
||
default_tags { | ||
tags = { | ||
CustodianRule = "ecc-aws-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports" | ||
ComplianceStatus = "Red" | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...ls_allow_ingress_for_everyone_to_remote_server_administration_ports/red2/terraform.tfvars
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,2 @@ | ||
profile = "c7n" | ||
default-region = "us-east-1" |
9 changes: 9 additions & 0 deletions
9
...o_acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red2/variables.tf
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,9 @@ | ||
variable "default-region" { | ||
type = string | ||
description = "Default region for resources will be created" | ||
} | ||
|
||
variable "profile" { | ||
type = string | ||
description = "Profile name configured before running apply" | ||
} |
30 changes: 30 additions & 0 deletions
30
...-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red2/vpc.tf
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,30 @@ | ||
resource "aws_vpc" "this" { | ||
cidr_block = "10.0.0.0/16" | ||
|
||
tags = { | ||
Name = "146_aws_vpc_red2" | ||
} | ||
} | ||
|
||
resource "aws_default_network_acl" "this" { | ||
default_network_acl_id = aws_vpc.this.default_network_acl_id | ||
tags = { | ||
Name = "146_default_network_acl_red2" | ||
} | ||
ingress { | ||
protocol = "tcp" | ||
rule_no = 1 | ||
action = "allow" | ||
cidr_block = "0.0.0.0/0" | ||
from_port = 20 | ||
to_port = 26 | ||
} | ||
ingress { | ||
protocol = -1 | ||
rule_no = 100 | ||
action = "deny" | ||
cidr_block = "0.0.0.0/0" | ||
from_port = 0 | ||
to_port = 0 | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red3/provider.tf
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 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
profile = var.profile | ||
region = var.default-region | ||
|
||
default_tags { | ||
tags = { | ||
CustodianRule = "ecc-aws-146-no_acls_allow_ingress_for_everyone_to_remote_server_administration_ports" | ||
ComplianceStatus = "Red" | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...ls_allow_ingress_for_everyone_to_remote_server_administration_ports/red3/terraform.tfvars
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,2 @@ | ||
profile = "c7n" | ||
default-region = "us-east-1" |
9 changes: 9 additions & 0 deletions
9
...o_acls_allow_ingress_for_everyone_to_remote_server_administration_ports/red3/variables.tf
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,9 @@ | ||
variable "default-region" { | ||
type = string | ||
description = "Default region for resources will be created" | ||
} | ||
|
||
variable "profile" { | ||
type = string | ||
description = "Profile name configured before running apply" | ||
} |
Oops, something went wrong.