
Full Stack Challenge: VPN Fortress Secure Remote Access with Real-Time Threat Detection on AWS
A single-command AWS deployment that provisions a SoftEther VPN with integrated Wazuh SIEM, AlienVault threat intelligence, automated IP blocking, traffic anomaly detection, and pre-built dashboards; enterprise-grade security monitoring through Infrastructure as Code, without the enterprise complexity.
Vision and What It Does
Organizations face a recurring challenge: providing secure remote access while maintaining visibility into who connects, from where, and what they do. Most solutions fall into two extremes: a simple VPN with zero visibility, or expensive enterprise suites that are complex to deploy and maintain.
VPN Fortress bridges that gap. It's a single-command deployment that provisions a complete security stack on AWS: encrypted VPN access, real-time threat detection, automated incident response, traffic anomaly monitoring, and pre-built dashboards: all through Infrastructure as Code.
The problem it solves: teams get a VPN running in minutes but have no idea who's connecting, no alerting on brute-force attacks, no blocking of known malicious IPs, and no visibility into traffic patterns that could indicate data exfiltration or scanning.
Who it's for: cloud engineers, DevSecOps practitioners, security-conscious startups, and small teams who need enterprise-grade visibility without the enterprise price tag or complexity.
What it does:
- Deploys a multi-protocol VPN server (L2TP/IPsec, SSTP, OpenVPN-compatible)
- Integrates a full SIEM (Wazuh) for log correlation and alerting
- Pulls daily threat intelligence from AlienVault OTX to identify malicious IPs
- Automatically blocks attackers via active response (no human intervention)
- Monitors per-session bandwidth to detect data exfiltration and port scanning
- Ingests VPC Flow Logs for network-level traffic analysis
- Provides pre-built dashboards with geographic maps, auth tables, and traffic breakdowns
Full Stack Breakdown
This project connects across the full lifecycle of building and shipping a product:
Pitch: The idea started from a real pain point. I set up VPNs for clients but had zero visibility into what happened after users connected. The pitch was simple: what if deploying a VPN automatically gave you a security operations center?
Prototype: The first version was two separate CloudFormation templates; one for SoftEther, one for Wazuh. They worked but required manual wiring. The prototype proved the concept: SoftEther logs could be parsed by Wazuh with custom decoders.
MVP: I unified the templates into a single stack with conditional resources (internal/external modes). Added the deploy script with interactive prompts, AZ auto-detection, and password validation. This became usable by someone other than me.
UX: The experience of deploying security infrastructure is usually painful. I focused on making the deploy script feel like a product: a clean menu, smart defaults, helpful error messages, version selectors, and recovery options when things go wrong (wrong AZ, unavailable instance type). The dashboards are auto-imported, so there's zero post-deployment configuration.
Launch: The project ships as a public GitHub repo with a comprehensive README, architecture diagrams for both deployment modes, and a one-command deployment story.
How You Built It
Development process:
I started by solving my own problem: deploying SoftEther manually and realizing I had no idea what was happening on the VPN. I added Wazuh, then realized the real value was in the integration: custom decoders that parse SoftEther's unique log format, rules that correlate events, and an active response that acts on them.
Key decisions:
- Single unified template over separate stacks: Managing dependencies between stacks was fragile. A single template with CloudFormation Conditions (
IsInternal/IsExternal) keeps everything self-contained while supporting two architectures.
- Persistent EBS volumes with DeletionPolicy: Retain: VPN user accounts, and Wazuh rules must survive instance replacement. Dedicated encrypted EBS volumes with first-run detection logic solve this elegantly.
- Interactive deploy script over raw CLI: Passing 15+ parameters with special characters in passwords through the CLI is error-prone. A script that validates inputs, auto-detects AZs, checks instance type availability, and writes parameters as JSON eliminates deployment failures.
- Cron-based traffic monitoring over real-time streaming: SoftEther doesn't export metrics natively. A 5-minute cron job that queries session data, calculates deltas from a baseline, and logs anomalies to a file that Wazuh ingests was the pragmatic solution.
Challenges and how I overcame them:
- Parsing SoftEther logs for Wazuh: SoftEther uses a proprietary log format with no standard syslog structure. I wrote multiple PCRE2 decoders to extract timestamps, IPs, usernames, OS info, and session IDs from different log types (authentication, session creation, client details).
- Making configuration persistent: I needed VPN user accounts to survive stack updates. The solution: a dedicated EBS volume mounted at boot. On first run, the VPN is configured and backed up. On subsequent boots, config is restored from the volume — zero user intervention.
- Special characters in passwords: CloudFormation password parameters with characters like
+,?, and*broke shell escaping. I switched to writing all parameters to a temporary JSON file using Pythonjson.dumpsfor proper escaping.
- AZ mismatches: EBS volumes must be in the same AZ as their instance. The deploy script auto-detects the AZ from the selected subnet and validates that the instance type is available there before deploying.
AWS Services / Architecture
AWS Services used:
Service | Purpose |
|---|---|
AWS CloudFormation | Infrastructure as Code — full stack provisioning |
Amazon EC2 | SoftEther VPN server + Wazuh SIEM instance |
Amazon EBS | Encrypted persistent volumes for configuration |
Amazon S3 | VPC Flow Logs storage (30-day lifecycle) |
Amazon VPC | Networking with public/private subnets |
VPC Flow Logs | Network traffic metadata capture |
Elastic Load Balancing (NLB) | Internet-facing load balancer (external mode) |
AWS Certificate Manager | TLS 1.3 certificate (external mode) |
Amazon Route 53 | DNS for the VPN domain (external mode) |
AWS IAM | Instance roles with least-privilege policies |
AWS Systems Manager | AMI resolution + instance management |
Architecture overview:
Internal mode:

External mode:

Both modes include:
- Security groups scoped per component (VPN ports, Wazuh agent ports, internal-only dashboard access)
- IAM role with SSM, S3 read, and EC2 DescribeFlowLogs permissions
- Encrypted EBS volumes with a retained deletion policy
- Wazuh agent on SoftEther forwarding security + traffic logs to the manager
What You Learned
- CloudFormation Conditions are powerful but require discipline: Supporting two deployment modes in one template works well with
Condition:each resource, but testing both paths takes twice the effort. Worth it for the reduced maintenance.
- Persistence is a first-class concern: In a disposable infrastructure world, some state (user accounts, SIEM rules) must survive. Designing for persistence from day one (EBS volumes + first-run detection) prevents the "oops, I lost all my users" moment.
- Security monitoring is only as good as your parsers: Wazuh is powerful but useless without decoders that understand your log format. Writing PCRE2 decoders for SoftEther's non-standard format was the hardest and most valuable part.
- UX matters even for infrastructure tools: An interactive script with validation, auto-detection, and recovery options turns a 15-parameter deployment into a guided experience. Infrastructure tools deserve the same UX thinking as user-facing products.
- Active response changes the game: Going from "detect and alert" to "detect and block" automatically is a fundamental shift. When rule 100305 fires and
firewall-dropexecutes within seconds, that's security operations without a SOC.
- VPC Flow Logs are underutilized: Most teams enable them and never look at the data. Piping them into a SIEM with dashboards makes rejected connections, targeted ports, and suspicious IPs immediately visible.
Link to Repo
The repository includes:
- Full CloudFormation templates (VPC + unified SoftEther/Wazuh stack)
- Interactive deploy script with validations
- Pre-built Wazuh dashboards (NDJSON export)
- Architecture diagrams for both deployment modes
- Comprehensive documentation
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article