output "workstation_id" { description = "The workstation, for bastion sessions and volume attachments." value = oci_core_instance.workstation.id } output "bastion_id" { description = "The bastion sessions are opened against." value = oci_bastion_bastion.forensics.id } output "connect" { description = "Open a session, then SSH through it." value = <<-EOT oci bastion session create-port-forwarding --bastion-id ${oci_bastion_bastion.forensics.id} \ --target-resource-id ${oci_core_instance.workstation.id} --target-port 22 \ --ssh-public-key-file ~/.ssh/id_ed25519.pub --session-ttl ${var.session_ttl_in_seconds} # The command the session prints opens the tunnel. Then, in another terminal: ssh -i ~/.ssh/id_ed25519 -p opc@localhost EOT } output "attach_evidence" { description = "Examine a backed-up volume here, attached read-only." value = <<-EOT # A boot volume backup restores to a boot volume, which attaches here as a data volume. oci bv boot-volume create --source-boot-volume-backup-id --availability-domain ${local.availability_domain} --compartment-id ${var.compartment_ocid} --wait-for-state AVAILABLE oci compute volume-attachment attach --type paravirtualized --instance-id ${oci_core_instance.workstation.id} --volume-id --is-read-only true --is-shareable true # Read-only is enforced by the platform, and it sticks: a volume attached # read-only can only be attached read-only until every attachment is gone. # Then, in the session: lsblk && sudo mkdir -p /mnt/evidence && sudo mount -o ro,noload,noexec,nodev /dev/sdb1 /mnt/evidence # noload matters: without it an ext4 mount replays the journal, which is a # write, and a read-only attachment refuses it. EOT } output "verify" { description = "Proof the workstation reaches the evidence and nothing else, and that trying is noticed." value = <<-EOT In the session: curl -m 5 -sI https://example.com # times out: no route out oci os object list -bn ${var.evidence_bucket} --auth instance_principal # lists the evidence oci os object put -bn ${var.evidence_bucket} --name x --file /etc/hostname --auth instance_principal # refused: read only curl -m 5 -sI https://1.1.1.1 # times out, and the refused-egress alert fires within minutes The alert reaches ${length(var.alert_emails)} address(es). Each has to confirm its subscription once before it will. Two things it does not cover, both worth knowing before you open a sample: Oracle's own services stay reachable on 443, because a bastion needs the service gateway and an instance principal needs the identity service. That includes Object Storage in any tenancy, and a pre-authenticated request carries no credentials, so anything running here can put a file in a stranger's bucket. That traffic is allowed, so no alert fires on it. Name lookups leave too. Oracle's resolver answers public names for instances with no internet access, so a query can carry data out. Turn on Query Response Logs for this VCN's private resolver in the Console, under Logging, and watch for entries whose data.path is "internet"; oci logging service list --all prints the strings Terraform would need. Pointing the subnet's DHCP options at a custom resolver closes the lookups, and closes the evidence bucket's own name with them. EOT }