Access and networking
A firewall change that broke things 28 hours later
Two incidents on our self-hosted access gateway, which runs on ECS Fargate. Both came down to the same idea: long-lived connections hide the effect of a change until something restarts.
- Stack
- Teleport, ECS Fargate, Network Load Balancer, security groups, DynamoDB, EFS
- My role
- Incident investigation and the follow-up design
- Outcome
- Both root causes found from logs and ECS events. A change-checklist rule was added, and a safer deploy setting and HA design were proposed.
Background
Teleport is our single way in to servers, Kubernetes clusters, databases and internal web apps. It runs as one all-in-one task on Fargate, behind an internet-facing Network Load Balancer. Agents on the servers and clusters keep reverse tunnels open to the gateway, so the servers don’t need any inbound access.
Incident one: most servers disappear
- Day 1, morningAs part of moving to VPN-only access, the load balancer’s security group rule allowing 443 from anywhere was replaced with two allowed addresses.
- Day 1, all dayEverything kept working.
- Day 2, eveningThe gateway task was replaced. Most servers disappeared from Teleport, and only a handful were left.
- FixAdd the agents’ egress ranges back to the rule so their tunnels can reconnect.
Why the delay: security groups track connections, and removing a rule doesn’t cut a tracked connection the rule had already allowed. The agents were holding tunnels they had opened weeks earlier, under the old rule. When the task restarted, every tunnel dropped and had to reconnect as a new connection. Only agents whose traffic left through one of the two allowed addresses could get back in.
This is now a line on our change checklist. If you restrict access in front of anything that holds connections open (tunnels, VPNs, message brokers), the impact appears at the next reconnect, not when you make the change. So force a reconnect on purpose, inside the change window, and watch what comes back.
Incident two: “Access Denied” during maintenance
During an AWS-initiated task replacement, users opening internal apps through the gateway got “Access Denied: unable to serve application requests” for about seven minutes. Then it fixed itself.
The service was set to minimumHealthyPercent 100 and maximumPercent 200, so the new task started before the old one stopped. The old task then stayed up for the target group’s 300-second deregistration delay. For those minutes, two gateway processes shared the same data directory and host identity on EFS, and app sessions were split between them. The logs showed “failed to match applications” and session-not-found errors.
An early theory was that cluster state stored on EFS was to blame. Reading the config showed the state was already in DynamoDB. The shared data directory, which holds each process’s host identity and keys, was the real problem.
What I proposed:
- While it runs as a single task: use min 0 and max 100. A short, clean restart is better than seven minutes of split-brain.
- Before running two tasks: remove the shared data-directory mount first, then use min 50 and max 100, so a deploy never briefly runs four. I checked the prerequisites first: S3 versioning, DynamoDB streams, and the audit backend order.
What I’d do differently
- Give agent tunnels their own listener. Agents and people shared port 443 on one load balancer, so a “VPN-only” rule meant for people also cut off servers. With a separate listener for reverse tunnels, user access can be locked down without touching agent connectivity.
- Alert on the agent count. A sudden drop in connected agents is a clear signal. Here it was a person noticing missing servers.
What I took from it
- Stateful firewalls make a change look safe until the next reconnect.
- Rolling-deploy settings that are right for stateless web apps can be wrong for anything that keeps an identity on disk.
- When something “fixes itself”, find out what ended. Here it was the old task finally exiting.