Honeypot-Project icon indicating copy to clipboard operation
Honeypot-Project copied to clipboard

feat: add multi-region terraform module for honeypot deployment

Open R1sh0bh-1 opened this issue 4 months ago • 1 comments

Hey @adrianwinckles,

This PR introduces the foundational infrastructure-as-code layer required to deploy our honeypot fleet across multiple AWS regions simultaneously.

I built this as a reusable Terraform module so that spinning up a new region requires zero code duplication. We can add additional nodes in the future simply by adding a new provider alias.

Here is a breakdown of what has been implemented and tested:

Reusable Node Module (terraform/modules/honeypot-node)

  • EC2 and Elastic IP Configuration: Provisions an Ubuntu 24.04 LTS instance and attaches an Elastic IP. This ensures the public IP remains stable across reboots, which is critical for persona_watchdog.py to maintain a consistent Shodan Honeyscore.
  • Automated Bootstrap (userdata.sh): The instance automatically installs Docker and Git on its first boot. It clones our repository, injects a dynamically generated .env file containing the LOGSTASH_HOST, AWS_REGION, and HONEYPOT_NODE_ID, and spins up the WAF stack.
  • Log Shipping: Because the .env file is generated with the correct Logstash host during bootstrap, the pre-existing Filebeat container immediately starts shipping logs to our centralized Kibana instance upon startup.

Security and IAM

  • Least Privilege Profile: I replaced the overly permissive AmazonEC2FullAccess role from earlier project spikes with a strictly scoped IAM Instance Profile. The nodes are only granted s3:PutObject for log archival.
  • Security Group: The ingress rules strictly match our docker-compose port layout (80, 443, 8000, 8080, 8888), and SSH access is locked down to a configurable maintainer CIDR block.

Multi-Region Root Configuration

I have configured three initial provider aliases targeting the regions we discussed:

  • ap-south-1 (Mumbai) for dev, test, and South/East Asia traffic
  • us-east-1 (N. Virginia) for the highest attack surface baseline
  • eu-west-1 (Ireland) for European traffic and the GDPR research angle

Testing Performed

  • Validated the module and root configurations via terraform validate.
  • Ensured formatting compliance with terraform fmt.
  • Passed shellcheck for the bash bootstrap script.
  • Confirmed that all existing Docker stacks (waf_modsec, waf_elk, mds_elk) and Python scripts remain untouched and functional.

Please let me know if you think any changes are required.

R1sh0bh-1 avatar Jul 29 '26 06:07 R1sh0bh-1

Hey @fzipi, all the review comments are addressed. Added a dedicated VPC per node with its own IGW, subnet, and route table so the honeypot is fully isolated from any other workloads in the account. Moved the gitignore rules to the root, dropped the DynamoDB lock table since S3 handles that natively now in v6, bumped the provider to v6, and made persona and profile proper variables instead of hardcoded strings. Also removed the lock file from tracking.

I also added a quick commit to fix the failing mlogc_elk CI test. The upstream Debian image recently updated to Java 21 which crashed Logstash until I swapped out the deprecated GC flags.

Let me know if you have any other thoughts or if it looks good to you!

R1sh0bh-1 avatar Aug 01 '26 16:08 R1sh0bh-1