2021-11-24 20:44:32 -08:00
|
|
|
# Here are general definitions for security rulesets
|
|
|
|
|
|
2022-12-09 20:55:30 -08:00
|
|
|
resource "aws_security_group" "ecs_web_ingress" {
|
|
|
|
|
name = "Alpha-Web-Ingress"
|
|
|
|
|
description = "Allow web traffic into the host"
|
|
|
|
|
vpc_id = aws_vpc.athens_vpc.id
|
|
|
|
|
ingress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 443
|
2022-12-27 21:02:56 -08:00
|
|
|
to_port = 443
|
|
|
|
|
protocol = "tcp"
|
2022-12-09 20:55:30 -08:00
|
|
|
}
|
|
|
|
|
ingress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 80
|
2022-12-27 21:02:56 -08:00
|
|
|
to_port = 80
|
|
|
|
|
protocol = "tcp"
|
2022-12-09 20:55:30 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "aws_security_group" "base_ecs" {
|
|
|
|
|
vpc_id = aws_vpc.athens_vpc.id
|
2022-12-16 22:50:15 -08:00
|
|
|
egress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 80
|
2022-12-27 21:02:56 -08:00
|
|
|
to_port = 80
|
|
|
|
|
protocol = "tcp"
|
2022-12-16 22:50:15 -08:00
|
|
|
}
|
2022-12-09 20:55:30 -08:00
|
|
|
egress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 443
|
2022-12-27 21:02:56 -08:00
|
|
|
to_port = 443
|
|
|
|
|
protocol = "tcp"
|
2022-12-09 20:55:30 -08:00
|
|
|
}
|
|
|
|
|
egress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 2049
|
2022-12-27 21:02:56 -08:00
|
|
|
to_port = 2049
|
|
|
|
|
protocol = "tcp"
|
2022-12-09 20:55:30 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-02 19:08:25 -08:00
|
|
|
resource "aws_security_group" "load_balancer_health_check" {
|
|
|
|
|
name = "Load Balancer Health check"
|
|
|
|
|
vpc_id = aws_vpc.athens_vpc.id
|
|
|
|
|
egress {
|
|
|
|
|
cidr_blocks = ["10.0.0.0/8"]
|
|
|
|
|
from_port = 80
|
|
|
|
|
to_port = 80
|
|
|
|
|
protocol = "tcp"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-25 20:44:00 -08:00
|
|
|
resource "aws_security_group" "general_web_req" {
|
2021-11-25 00:11:51 -08:00
|
|
|
name = "Athens General web server ruleset"
|
2021-11-24 20:44:32 -08:00
|
|
|
description = "Allowing strictly web traffic"
|
2021-11-25 00:11:51 -08:00
|
|
|
vpc_id = aws_vpc.athens_vpc.id
|
2021-11-24 20:44:32 -08:00
|
|
|
# Intake of web requests(only serving TLS enabled traffic)
|
|
|
|
|
ingress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 443
|
|
|
|
|
to_port = 443
|
|
|
|
|
protocol = "tcp"
|
|
|
|
|
}
|
2021-11-25 20:44:00 -08:00
|
|
|
ingress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 80
|
|
|
|
|
to_port = 80
|
|
|
|
|
protocol = "tcp"
|
|
|
|
|
}
|
2021-11-24 20:44:32 -08:00
|
|
|
# WARN: Due to the usage of debian based images this rule
|
|
|
|
|
# is effectively required in order to properly update
|
|
|
|
|
# the system as apt mostly talks over port 443(maybe port 80 too?)
|
|
|
|
|
egress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 443
|
|
|
|
|
to_port = 443
|
|
|
|
|
protocol = "tcp"
|
|
|
|
|
}
|
2021-11-25 20:44:00 -08:00
|
|
|
# WARN: like 99% certrain apt falls back to port 80 on occasion
|
|
|
|
|
# which means we kinda need egress in to not break when requesting
|
|
|
|
|
# from shitty repos ...
|
|
|
|
|
egress {
|
|
|
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
|
|
|
from_port = 80
|
|
|
|
|
to_port = 80
|
|
|
|
|
protocol = "tcp"
|
|
|
|
|
}
|
2021-11-24 20:44:32 -08:00
|
|
|
}
|
|
|
|
|
|