iac.htora.dev · security templates

Home/Templates/An analysis machine that cannot reach production

An analysis machine that cannot reach production

A clean-room virtual machine for looking at suspicious files, with no route to anything live, on four clouds.

Terraform

Why bother

Opening malware or reviewing a disk image on a machine that can reach production turns one incident into two. This builds a workstation with no way out and a snapshot taken when it shuts down.

How you know it worked

From the workstation, try to reach a production subnet. It should fail.

How it works

1Evidence arrivesa disk snapshot or files in the evidence bucket2The isolated workstationno route to production or the internet3Analysisreached through a broker, never a public address4Anything reaching out is refusedand alerted, at Standard
Step by step, from the thing that happens to the result you want.

Set it up

Pick your platform, then open the level you want. Each level is complete on its own. Read the comments in the files as you go. Anything with a real consequence is explained on the line where it happens.

Terraform. An isolated VPC with no internet gateway, reached through Session Manager only

What you need first

  • An account for forensics, kept separate from production if you can.
  • The evidence bucket, such as the evidence capture template's.
  • For Standard, the analysts' roles and an SNS topic for the alerts.

What it creates

  • A VPC with no internet gateway, NAT, or peering, and private endpoints for Session Manager
  • An S3 endpoint whose policy allows reads from the evidence bucket and the Amazon Linux package repository only
  • A workstation with no inbound rules, an encrypted disk, and read access to the evidence
  • DNS limited to AWS's own names, flow and query logs, and alarms when anything on it tries to reach out (Standard)
  • A policy letting analysts open sessions on it and attach evidence volumes to it (Standard)

See the two alerts this creates

The code

Quick startReadyone file, 248 lines
One file. The isolated VPC, its endpoints, and a workstation reached through Session Manager.
Change these first
  • evidence_bucket = "your-evidence-bucket" main.tf, line 19
Run it
  1. aws sts get-caller-identity
    Shows the account and role you are signed in as. Check it before every apply.
  2. terraform init
    Downloads the provider. Run it once per folder.
  3. terraform plan
    Shows what will be created. Changes nothing. Read it.
  4. terraform apply
    Shows the plan again and waits for you to type yes.
  5. terraform destroy
    When you have finished. If it refuses, How to undo it below explains why.
Download main.tf
Checks

Formatting passedValid passedLint passed

Security scan: 64 checks passed, and two rules flagged, each with a written reason:

Last run 2026-10-02 with OpenTofu v1.12.6 against hashicorp/aws 6.66.0.

outcomes/forensic-workstation/aws/t0
main.tf
Open main.tf as plain text
StandardReadyfive files, 497 lines
Adds DNS limited to AWS's own names, flow and DNS query logs with alarms on any attempt to reach out, a disk key of its own, and an analyst policy.
Change these first
  • evidence_bucket. The bucket evidence is read from, such as the evidence capture template's.
  • analyst_role_arns. Roles allowed to open sessions on the workstation and attach evidence volumes to it.
  • alert_topic_arn. SNS topic told when something on the workstation tries to connect out, or looks up a name outside AWS.
Run it
  1. aws sts get-caller-identity
    Shows the account and role you are signed in as. Check it before every apply.
  2. # terraform.tfvars
    evidence_bucket = ""
    analyst_role_arns = ""
    alert_topic_arn = ""
    Create this file beside the others and fill in your values. Terraform reads it on its own.
  3. terraform init
    Downloads the provider. Run it once per folder.
  4. terraform plan
    Shows what will be created. Changes nothing. Read it.
  5. terraform apply
    Shows the plan again and waits for you to type yes.
  6. terraform output verify
    Prints the commands that prove it worked.
Download all five files as a zip
Checks

Formatting passedValid passedLint passed

Security scan: 120 checks passed, and four rules flagged, each with a written reason:

Last run 2026-10-02 with OpenTofu v1.12.6 against hashicorp/aws 6.66.0.

outcomes/forensic-workstation/aws/t1
network.tf
Open network.tf as plain text
outputs.tf
Open outputs.tf as plain text
variables.tf
Open variables.tf as plain text
versions.tf
Open versions.tf as plain text
workstation.tf
Open workstation.tf as plain text
HardenedReadysix files, 217 lines
Standard as a module. Plan rules refuse any gateway, peering, or default route, security groups open to the internet, a public IP, and IMDSv1 or an unencrypted disk. They also refuse flow logs narrowed, silent alarms, and the DNS firewall or logs deleted. A daily plan reports drift, and the scan fails on any unexplained finding.
Change these first
  • evidence_bucket. The bucket evidence is read from, such as the evidence capture template's.
  • analyst_role_arns. Roles allowed to open sessions on the workstation and attach evidence volumes to it.
  • alert_topic_arn. SNS topic told when something on the workstation tries to connect out, or looks up a name outside AWS.
Run it
  1. aws sts get-caller-identity
    Shows the account and role you are signed in as. Check it before every apply.
  2. # terraform.tfvars
    evidence_bucket = ""
    analyst_role_arns = ""
    alert_topic_arn = ""
    Create this file beside the others and fill in your values. Terraform reads it on its own.
  3. terraform init
    Downloads the provider. Run it once per folder.
  4. terraform plan
    Shows what will be created. Changes nothing. Read it.
  5. terraform apply
    Shows the plan again and waits for you to type yes.
  6. terraform output verify
    Prints the commands that prove it worked.
Download all six files as a zip
Checks

Formatting passedValid passedLint passed

Security scan: 110 checks passed, and none flagged.

Last run 2026-10-02 with OpenTofu v1.12.6 against hashicorp/aws 6.66.0.

outcomes/forensic-workstation/aws/t2
.checkov.yml
Open .checkov.yml as plain text
guard.yml
Open guard.yml as plain text
main.tf
Open main.tf as plain text
outputs.tf
Open outputs.tf as plain text
variables.tf
Open variables.tf as plain text
versions.tf
Open versions.tf as plain text

How to check it worked

In a session on the workstation, try to reach the internet and a production address. Both fail. Listing the evidence bucket works, and writing to it is refused.

What catches people

Without Standard's DNS Firewall, the workstation can still look up any name through the VPC resolver, which security groups do not filter and flow logs do not record. A sample under examination could leak data that way.

Volumes made from snapshots encrypted with a key the workstation cannot use will not attach. Grant the workstation's role that key, or copy the snapshot under one it can use.

The Amazon Linux package bucket is allowed by name in the endpoint policy. If dnf stops working, check the bucket name AWS documents for your region.

Mount evidence read-only, with -o ro,noload for ext4, or even mounting can change it.

How to undo it

terraform destroy removes the workstation, its network, and its logs. Detach and delete any evidence volumes first.

What it costs

The workstation's hourly rate while it runs, about 20 dollars a month per interface endpoint, and DNS Firewall charges per million queries.

Good to know

  • Malware under examination may try to call home. On this workstation that attempt is refused, and at Standard it becomes an alert and a lead.
  • Evidence comes in through snapshots and the evidence bucket, and nothing goes out. Findings leave through the analyst's own session, never through a copy tool on the machine.

Registry 0.23.0. Built 2026-11-17.

Made by Habibullah Tora. Source on GitHub. Code under the MIT licence, writing under CC BY 4.0.