Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions terraform/aws/modules/generic-server/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ resource "aws_instance" "this" {
private_ip = var.private_ip
vpc_security_group_ids = [aws_security_group.this.id]
user_data = var.user_data
metadata_options {
http_tokens = "required"
}

root_block_device {
volume_type = var.root_volume_type
Expand All @@ -58,14 +61,11 @@ output "instance" {

resource "aws_ec2_traffic_mirror_session" "zeek_session" {
for_each = var.zeek_monitor ? { zeek = true } : {}

description = "Zeek Mirror Session for ${var.server_name}"
depends_on = [aws_instance.this]
traffic_mirror_filter_id = var.zeek_traffic_mirror_filter_id
traffic_mirror_target_id = var.zeek_traffic_mirror_target_id
network_interface_id = aws_instance.this.primary_network_interface_id
session_number = var.zeek_session_number
}



11 changes: 7 additions & 4 deletions terraform/aws/modules/router/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,20 @@ resource "aws_instance" "router" {
subnet_id = var.subnet_id
private_ip = var.private_ip
vpc_security_group_ids = [aws_security_group.default.id]
metadata_options {
http_tokens = "required"
}

associate_public_ip_address = true

root_block_device {
volume_type = "gp3"
volume_size = "30"
volume_type = "gp3"
volume_size = "30"
delete_on_termination = "true"
encrypted = "true"
encrypted = "true"
}

tags = {
Name = "ar-router-${var.attack_range_id}"
}
}
}
47 changes: 25 additions & 22 deletions terraform/aws/modules/zeek-server/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ resource "aws_security_group" "zeek_server" {
}

resource "aws_instance" "zeek_sensor" {
count = var.zeek_server ? 1 : 0
ami = var.ami_id
instance_type = "m5.2xlarge"
key_name = var.key_name
subnet_id = var.subnet_id
count = var.zeek_server ? 1 : 0
ami = var.ami_id
instance_type = "m5.2xlarge"
key_name = var.key_name
subnet_id = var.subnet_id
vpc_security_group_ids = [aws_security_group.zeek_server[0].id]
private_ip = var.private_ip
private_ip = var.private_ip
metadata_options {
http_tokens = "required"
}

tags = {
Name = "ar-${var.server_name}-${var.attack_range_id}"
Expand All @@ -47,34 +50,34 @@ resource "aws_instance" "zeek_sensor" {
}

resource "aws_ec2_traffic_mirror_target" "zeek_target" {
count = var.zeek_server ? 1 : 0
count = var.zeek_server ? 1 : 0
description = "VPC Tap for Zeek"
network_interface_id = aws_instance.zeek_sensor[0].primary_network_interface_id
}

resource "aws_ec2_traffic_mirror_filter" "zeek_filter" {
count = var.zeek_server ? 1 : 0
count = var.zeek_server ? 1 : 0
description = "Zeek Mirror Filter - Allow All"
}

resource "aws_ec2_traffic_mirror_filter_rule" "zeek_outbound" {
count = var.zeek_server ? 1 : 0
description = "Zeek Outbound Rule"
count = var.zeek_server ? 1 : 0
description = "Zeek Outbound Rule"
traffic_mirror_filter_id = aws_ec2_traffic_mirror_filter.zeek_filter[0].id
destination_cidr_block = "0.0.0.0/0"
source_cidr_block = "0.0.0.0/0"
rule_number = 1
rule_action = "accept"
traffic_direction = "egress"
destination_cidr_block = "0.0.0.0/0"
source_cidr_block = "0.0.0.0/0"
rule_number = 1
rule_action = "accept"
traffic_direction = "egress"
}

resource "aws_ec2_traffic_mirror_filter_rule" "zeek_inbound" {
count = var.zeek_server ? 1 : 0
description = "Zeek Inbound Rule"
count = var.zeek_server ? 1 : 0
description = "Zeek Inbound Rule"
traffic_mirror_filter_id = aws_ec2_traffic_mirror_filter.zeek_filter[0].id
destination_cidr_block = "0.0.0.0/0"
source_cidr_block = "0.0.0.0/0"
rule_number = 1
rule_action = "accept"
traffic_direction = "ingress"
destination_cidr_block = "0.0.0.0/0"
source_cidr_block = "0.0.0.0/0"
rule_number = 1
rule_action = "accept"
traffic_direction = "ingress"
}