Skip to content
~/ahmedeaygoren.dev
← Back to Projects
2026-10-25

Dehliz CTF

Multi-tenant cyber range infrastructure integrating a custom ctfd-dehliz plugin, WireGuard gateway, iptables micro-segmentation, dnsmasq, and Docker Swarm/Compose isolation.

Docker SwarmWireGuardCTFdPythondnsmasqiptablesAlpine Linux

Problem & Real-World Motivation

Running live Web Exploitation and Digital Forensics challenges for university competitions and hands-on training (GTU-CTF) exposed structural limits in traditional single-container and FRP port-forwarded CTFd setups:

Dehliz CTF was engineered to give every team or solo player an isolated, encrypted virtual lab environment where challenges are completely unreachable from the public internet yet feel like a real internal network.

Architecture & Network Isolation

Dehliz CTF pairs a customized CTFd control plane (plugins/ctfd-dehliz) with an Alpine-based WireGuard & DNS Gateway (gateway/) and a Docker Swarm overlay pool (dehliz_containers):

VPN CLIENTS Team 1 (10.13.1.0/24) Team 2 (10.13.2.0/24) UDP/51820 WireGuard wg0 GATEWAY PLANE dehliz_vpn_gateway (Alpine 3.20) dnsmasq (:53 *.dehliz.local) iptables (Cross-Team DROP) vpn_manager.py (API :5000) CONTROL PLANE CTFd + ctfd-dehliz Plugin challenge_type.py scheduler.py (TTL Cleanup) dehliz_bridge DATA PLANE Docker Swarm Overlay (dehliz_containers) Single-Service docker_manager.py Multi-Service compose_manager.py Docker Socket Routed via wg0 · Allowed Team
  1. Control Plane (ctfd-dehliz): When a player or team spawns an instance in CTFd, docker_manager.py (Swarm services) or compose_manager.py (multi-container Compose stacks) provisions isolated containers attached to the external dehliz_containers network, records expiration TTLs in the database, and calls vpn-gateway:5000 over dehliz_bridge.
  2. Gateway Plane (dehliz_vpn_gateway): vpn_manager.py assigns per-team WireGuard subnets, updates dnsmasq host mappings (SIGHUP reload) for *.dehliz.local, and applies iptables forwarding rules binding each instance strictly to its owning team subnet.
  3. Data Plane (wg0 → dehliz_containers): Traffic enters solely through encrypted WireGuard tunnels. Competitors resolve targets via *.dehliz.local, run standard nmap scans, and receive direct reverse shells to their own VPN IP without NAT obstacles.

Key Engineering Decisions

Production Validation (GTU-CTF)

Dehliz CTF serves as the deployment backbone for the Gebze Technical University Cybersecurity Club (GTU-CTF) challenge repository—supporting 22 production scenarios across Web Exploitation (15 challenges) and Digital Forensics (7 challenges):