Skip to content

Commit e7bd29a

Browse files
committed
modules/aws/vpc - Better security for master nodes
For a VPC with master nodes in a public subnet, they are reachable from the entire internet. Usually, one will communicate with them via an ELB, and not directly. This change limits access to 80/443 TCP and ICMP to only nodes within the VPC and cluster.
1 parent daeb699 commit e7bd29a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/aws/vpc/sg-master.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ resource "aws_security_group_rule" "master_ingress_icmp" {
2323
security_group_id = "${aws_security_group.master.id}"
2424

2525
protocol = "icmp"
26-
cidr_blocks = ["0.0.0.0/0"]
26+
cidr_blocks = ["${data.aws_vpc.cluster_vpc.cidr_block}"]
2727
from_port = 0
2828
to_port = 0
2929
}
@@ -43,7 +43,7 @@ resource "aws_security_group_rule" "master_ingress_http" {
4343
security_group_id = "${aws_security_group.master.id}"
4444

4545
protocol = "tcp"
46-
cidr_blocks = ["0.0.0.0/0"]
46+
cidr_blocks = ["${data.aws_vpc.cluster_vpc.cidr_block}"]
4747
from_port = 80
4848
to_port = 80
4949
}
@@ -53,7 +53,7 @@ resource "aws_security_group_rule" "master_ingress_https" {
5353
security_group_id = "${aws_security_group.master.id}"
5454

5555
protocol = "tcp"
56-
cidr_blocks = ["0.0.0.0/0"]
56+
cidr_blocks = ["${data.aws_vpc.cluster_vpc.cidr_block}"]
5757
from_port = 443
5858
to_port = 443
5959
}

0 commit comments

Comments
 (0)