|
@@ -3,17 +3,23 @@
|
|
|
# Server to workers on 5900-5999 (VNC)
|
|
|
# Workers to server on 80 and 443
|
|
|
|
|
|
-# Server
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# VMRAY Server ALB Security Group
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group" "vmray_server_sg" {
|
|
|
+ # checkov:skip=CKV2_AWS_5: this SG is attached to VMRAY Server
|
|
|
name = "vmray_server_sg"
|
|
|
description = "Security Rules Specific to VMRay"
|
|
|
vpc_id = var.vpc_id
|
|
|
tags = merge(local.standard_tags, var.tags)
|
|
|
}
|
|
|
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# INGRESS
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group_rule" "vmray_server_http_in_from_workers" {
|
|
|
- description = "Allow inbound port 80 for redirect from other vmray servers"
|
|
|
type = "ingress"
|
|
|
+ description = "HTTP - Inbound port 80 for redirect from other VMRAY Servers"
|
|
|
from_port = 80
|
|
|
to_port = 80
|
|
|
protocol = "tcp"
|
|
@@ -22,8 +28,8 @@ resource "aws_security_group_rule" "vmray_server_http_in_from_workers" {
|
|
|
}
|
|
|
|
|
|
resource "aws_security_group_rule" "vmray_server_https_in_from_workers" {
|
|
|
- description = "Allow inbound https for interserver communication from other vmray servers"
|
|
|
type = "ingress"
|
|
|
+ description = "HTTPS - Inbound for interserver communication from other VMRAY Servers"
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
|
protocol = "tcp"
|
|
@@ -32,8 +38,8 @@ resource "aws_security_group_rule" "vmray_server_https_in_from_workers" {
|
|
|
}
|
|
|
|
|
|
resource "aws_security_group_rule" "vmray_server_https_in" {
|
|
|
- description = "Allow https ingress from the VPN"
|
|
|
type = "ingress"
|
|
|
+ description = "HTTPS - Inbound - from the VPN"
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
|
protocol = "tcp"
|
|
@@ -42,10 +48,13 @@ resource "aws_security_group_rule" "vmray_server_https_in" {
|
|
|
security_group_id = aws_security_group.vmray_server_sg.id
|
|
|
}
|
|
|
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# EGRESS
|
|
|
+#----------------------------------------------------------------------------
|
|
|
## VMRay Does DNS Lookups to the Local Network
|
|
|
resource "aws_security_group_rule" "vmray_server_tcpdns_out" {
|
|
|
- description = "Allow DNS lookups to the local DNS server"
|
|
|
type = "egress"
|
|
|
+ description = "DNS TCP - Outbound - lookups to the local DNS server"
|
|
|
from_port = 53
|
|
|
to_port = 53
|
|
|
protocol = "tcp"
|
|
@@ -54,8 +63,8 @@ resource "aws_security_group_rule" "vmray_server_tcpdns_out" {
|
|
|
}
|
|
|
|
|
|
resource "aws_security_group_rule" "vmray_server_udpdns_out" {
|
|
|
- description = "Allow DNS lookups to the local DNS server"
|
|
|
type = "egress"
|
|
|
+ description = "DNS UDP - Outbound - lookups to the local DNS server"
|
|
|
from_port = 53
|
|
|
to_port = 53
|
|
|
protocol = "udp"
|
|
@@ -63,31 +72,29 @@ resource "aws_security_group_rule" "vmray_server_udpdns_out" {
|
|
|
security_group_id = aws_security_group.vmray_server_sg.id
|
|
|
}
|
|
|
|
|
|
-# tfsec:ignore:aws-vpc-no-public-egress-sgr VMRay Requires Direct Internet Access
|
|
|
resource "aws_security_group_rule" "vmray_server_http_out" {
|
|
|
- description = "VMRay requires direct HTTP outbound"
|
|
|
type = "egress"
|
|
|
+ description = "HTTP - Outbound - VMRay requirement"
|
|
|
from_port = 80
|
|
|
to_port = 80
|
|
|
protocol = "tcp"
|
|
|
- cidr_blocks = ["0.0.0.0/0"]
|
|
|
+ cidr_blocks = ["0.0.0.0/0"] # tfsec:ignore:aws-vpc-no-public-egress-sgr VMRay Requires Direct Internet Access
|
|
|
security_group_id = aws_security_group.vmray_server_sg.id
|
|
|
}
|
|
|
|
|
|
-# tfsec:ignore:aws-vpc-no-public-egress-sgr VMRay Requires Direct Internet Access
|
|
|
resource "aws_security_group_rule" "vmray_server_https_out" {
|
|
|
- description = "VMRay requires direct HTTPS outbound"
|
|
|
type = "egress"
|
|
|
+ description = "HTTPS - Outbound - VMRay requirement"
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
|
protocol = "tcp"
|
|
|
- cidr_blocks = ["0.0.0.0/0"]
|
|
|
+ cidr_blocks = ["0.0.0.0/0"] # tfsec:ignore:aws-vpc-no-public-egress-sgr VMRay Requires Direct Internet Access
|
|
|
security_group_id = aws_security_group.vmray_server_sg.id
|
|
|
}
|
|
|
|
|
|
resource "aws_security_group_rule" "vmray_server_vnc_to_workers" {
|
|
|
- description = "VMRay uses VNC for client machine access."
|
|
|
type = "egress"
|
|
|
+ description = "VMRay uses VNC for client machine access."
|
|
|
from_port = 5900
|
|
|
to_port = 5999
|
|
|
protocol = "tcp"
|
|
@@ -95,14 +102,20 @@ resource "aws_security_group_rule" "vmray_server_vnc_to_workers" {
|
|
|
security_group_id = aws_security_group.vmray_server_sg.id
|
|
|
}
|
|
|
|
|
|
-# Workers
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# VMRAY Worker ALB Security Group
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group" "vmray_worker_sg" {
|
|
|
+ # checkov:skip=CKV2_AWS_5: this SG is attached to VMRAY worker
|
|
|
name = "vmray_worker_sg"
|
|
|
description = "Security Rules for the VMRay Worker Nodes"
|
|
|
vpc_id = var.vpc_id
|
|
|
tags = merge(local.standard_tags, var.tags)
|
|
|
}
|
|
|
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# INGRESS
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group_rule" "vmwary_worker_vnc_from_server" {
|
|
|
description = "VMRay uses VNC for client machine access."
|
|
|
type = "ingress"
|
|
@@ -123,9 +136,12 @@ resource "aws_security_group_rule" "vmwary_worker_vnc_from_access" {
|
|
|
security_group_id = aws_security_group.vmray_worker_sg.id
|
|
|
}
|
|
|
|
|
|
+#----------------------------------------------------------------------------
|
|
|
+# EGRESS
|
|
|
+#----------------------------------------------------------------------------
|
|
|
resource "aws_security_group_rule" "vmray_worker_tcpdns_out" {
|
|
|
- description = "VMRay does DNS lookups to an instance in the local vpc."
|
|
|
type = "egress"
|
|
|
+ description = "VMRay DNS TCP - Outbound to instance in local vpc."
|
|
|
from_port = 53
|
|
|
to_port = 53
|
|
|
protocol = "tcp"
|
|
@@ -134,8 +150,8 @@ resource "aws_security_group_rule" "vmray_worker_tcpdns_out" {
|
|
|
}
|
|
|
|
|
|
resource "aws_security_group_rule" "vmray_worker_udpdns_out" {
|
|
|
- description = "VMRay does DNS lookups to an instance in the local vpc."
|
|
|
type = "egress"
|
|
|
+ description = "VMRay DNS UDP - Outbound to instance in local vpc."
|
|
|
from_port = 53
|
|
|
to_port = 53
|
|
|
protocol = "udp"
|
|
@@ -145,8 +161,8 @@ resource "aws_security_group_rule" "vmray_worker_udpdns_out" {
|
|
|
|
|
|
# tfsec:ignore:aws-vpc-no-public-egress-sgr VMRay Requires Direct Internet Access
|
|
|
resource "aws_security_group_rule" "vmray_worker_http_out" {
|
|
|
- description = "VMRay requires direct HTTP access."
|
|
|
type = "egress"
|
|
|
+ description = "HTTP - Outbound - VMRay requires direct HTTP access."
|
|
|
from_port = 80
|
|
|
to_port = 80
|
|
|
protocol = "tcp"
|
|
@@ -156,8 +172,8 @@ resource "aws_security_group_rule" "vmray_worker_http_out" {
|
|
|
|
|
|
# tfsec:ignore:aws-vpc-no-public-egress-sgr VMRay Requires Direct Internet Access
|
|
|
resource "aws_security_group_rule" "vmray_worker_https_out" {
|
|
|
- description = "VMRay requires direct HTTPS access."
|
|
|
type = "egress"
|
|
|
+ description = "HTTPS - Outbound - VMRay requires direct HTTPS access."
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
|
protocol = "tcp"
|
|
@@ -166,8 +182,8 @@ resource "aws_security_group_rule" "vmray_worker_https_out" {
|
|
|
}
|
|
|
|
|
|
resource "aws_security_group_rule" "vmray_worker_http_to_server" {
|
|
|
- description = "VMRay worker communicates with the server."
|
|
|
type = "egress"
|
|
|
+ description = "HTTP - VMRay worker communicates with the server."
|
|
|
from_port = 80
|
|
|
to_port = 80
|
|
|
protocol = "tcp"
|
|
@@ -176,8 +192,8 @@ resource "aws_security_group_rule" "vmray_worker_http_to_server" {
|
|
|
}
|
|
|
|
|
|
resource "aws_security_group_rule" "vmray_worker_https_to_server" {
|
|
|
- description = "VMRay worker communicates with the server."
|
|
|
type = "egress"
|
|
|
+ description = "HTTPS - VMRay worker communicates with the server."
|
|
|
from_port = 443
|
|
|
to_port = 443
|
|
|
protocol = "tcp"
|