Firewall & network zones
Split the network into zones and say exactly what may cross between them; drop the rest.
The CityScript
This is all there is to it. Change it in the editor and the city redraws.
%% F · Firewall & network zones
%% Three zones, two firewalls: only the listed ports cross, and every other packet is dropped.
city 48x32
district dmz "DMZ" 3,3..16,14
district app "App zone" 21,3..34,13
district data "Data zone" 39,3..46,13
building fw-edge tower at 17,5 "DMZ firewall"
floor fw-edge.f "Rules"
room fw-edge.in config "Allow 443 in"
room fw-edge.deny config "Deny the rest"
building fw-core tower at 35,5 "Core firewall"
floor fw-core.f "Rules"
room fw-core.db config "Allow 5432 from apps"
room fw-core.deny config "Deny the rest"
building proxy factory in dmz "Reverse proxy"
floor proxy.f "Proxy"
room proxy.nginx proxy "nginx" port=80,443
room proxy.waf proxy "WAF" port=443
building bastion depot in dmz "Bastion"
floor bastion.f "Admin access"
room bastion.ssh proxy "SSH jump host" port=22 secret=host-key
room bastion.audit storage "Session recordings"
building web factory in app "App servers"
floor web.f "Apps"
room web.app service "App" port=3000
room web.cache cache "Session cache" port=6379
building db factory in data "Databases"
floor db.f "Data"
room db.pg database "Postgres" port=5432
room db.backup worker "Backups"
boundary dmz-zone "DMZ" members=proxy,bastion
boundary app-zone "App zone" members=web
boundary data-zone "Data zone" members=db
boundary internal "Internal network" members=app-zone,data-zone
gate public at 0,8 port=443 "Public"
link proxy.nginx -> fw-edge.in -> web.app "allowed: 443" variant=security
link web.app -> fw-core.db -> db.pg "allowed: 5432" variant=security
link bastion.ssh -> web.app "SSH" variant=security