Add restricted web egress rules
This commit is contained in:
@@ -67,6 +67,44 @@ locals {
|
||||
}
|
||||
}
|
||||
|
||||
web_egress_homelab_cidrs = {
|
||||
private_network_a = var.route_destinations.private_network_a
|
||||
private_network_b = var.route_destinations.private_network_b
|
||||
}
|
||||
|
||||
web_egress_rules = merge(
|
||||
{
|
||||
for pair in setproduct(keys(local.web_egress_homelab_cidrs), var.web_egress_policy.homelab_tcp_ports) :
|
||||
"${pair[0]}_tcp_${pair[1]}" => {
|
||||
description = "Allow TCP ${pair[1]} to homelab ${replace(pair[0], "_", " ")} via VyOS"
|
||||
ip_protocol = "tcp"
|
||||
from_port = pair[1]
|
||||
to_port = pair[1]
|
||||
cidr_ipv4 = local.web_egress_homelab_cidrs[pair[0]]
|
||||
}
|
||||
},
|
||||
{
|
||||
for pair in setproduct(keys(local.web_egress_homelab_cidrs), var.web_egress_policy.homelab_udp_ports) :
|
||||
"${pair[0]}_udp_${pair[1]}" => {
|
||||
description = "Allow UDP ${pair[1]} to homelab ${replace(pair[0], "_", " ")} via VyOS"
|
||||
ip_protocol = "udp"
|
||||
from_port = pair[1]
|
||||
to_port = pair[1]
|
||||
cidr_ipv4 = local.web_egress_homelab_cidrs[pair[0]]
|
||||
}
|
||||
},
|
||||
{
|
||||
for port in var.web_egress_policy.public_tcp_ports :
|
||||
"public_tcp_${port}" => {
|
||||
description = "Allow TCP ${port} to any IPv4 destination"
|
||||
ip_protocol = "tcp"
|
||||
from_port = port
|
||||
to_port = port
|
||||
cidr_ipv4 = "0.0.0.0/0"
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
ssh_security_group_name = coalesce(var.ssh_security_group.name, "${var.name_prefix}-ssh-enabled")
|
||||
web_instance_name = coalesce(var.web_instance.name, "${var.name_prefix}-web")
|
||||
key_pair_name = coalesce(var.key_pair.name, "${var.name_prefix}-key")
|
||||
|
||||
Reference in New Issue
Block a user