Skip to content

14. Firewalls and Port Blocking

“A door is only open when every guard on the way agrees.”

It was a Sunday morning when the phone rang. A parent from the dance academy wanted to know whether the summer batch fee had gone through. The money had left her account the night before, and the academy’s app still said pending. She had a fair question. You had an unfair problem: the Razorpay dashboard said the payment was captured, and your app had never heard about it.

You opened the site on your laptop. It hung for thirty seconds and gave up. You tried your phone on mobile data, and it hung too. Then you SSHed into the VPS and got a prompt back instantly, which felt like good news until you realised it was the wrong kind. The machine was alive. The website was not reachable from the street.

The Razorpay dashboard, which retries webhooks with a patient little spinner, had the clue. Every failed delivery said the same thing: timed out. Not a 500. Not a refusal. Silence.

Then you remembered Friday. You had read a hardening checklist, turned on the host firewall, set the default to deny incoming, and allowed port 22 and port 80, because the site is just HTTP, right? It isn’t. Almost every address you care about starts with https. A plain http address only bounces you to https after the browser has reached port 80 and the server has answered, and a browser that has remembered the secure version never touches port 80 at all. Port 443 had been dropped without a word since Friday afternoon.

Caddy was fine. The app was fine. The database was fine. A guard at the door had been told to ignore anything not on his list, and he was doing exactly that. Once you asked the right question, the fix took four minutes. The question was never “is my app broken?” It was “which guard stopped this packet?”

That question is the spine of this chapter. Every request you have ever made has walked the mantra, and you have now met all of it: Name → Address → Route → Door → Guard → Receptionist → App. The Guard rung is the one that goes silent most often, and it is the one people blame last, because from the client’s side a silent guard looks exactly like a dead app. By the end of this chapter you should be able to ask the right question of any port on any machine you touch, and to read the client’s error like a doctor reads a cough.

Before we go further, one honest note. Everything in this chapter is about the stuff you control: your rules, your bind addresses, your cloud console. There are also guards you do not control, like your ISP and the coffee-shop network, and we will meet them later. Most of the time, though, the guard in the way is one you can open in a browser tab, and that is good news.

A firewall is a clerk with a clipboard standing at a door. Every packet is checked against a numbered rule list from the top down, and the first rule that matches decides what happens. The clerk then does one of three things.

Allow lets the packet through to whatever sits behind the door.

Drop throws the packet away and says nothing. The sender retransmits, waits, and eventually gives up. From outside, a drop looks exactly like a machine that is switched off.

Reject also throws the packet away, but it sends a no back: a TCP reset for a TCP connection, or an ICMP error for other traffic. The sender hears it at once.

Drop and reject both stop the packet. The difference is whether the sender is told, and that difference is the most useful clue in this chapter.

The clerk can look at the source address, the destination address and port, the protocol (TCP, UDP or ICMP), and, on a stateful firewall, the state of the connection the packet belongs to. Stateful matters more than it sounds. A stateless guard treats every packet as a stranger, so the replies to your outgoing requests would each need a rule of their own. A stateful guard notes each conversation when it starts and lets the replies in without a rule. Nearly every host and cloud firewall you will meet is stateful. The gate guard in the gated society works the same way: he writes down who went out, so the replies can get back in.

Two directions matter. Ingress is traffic coming in. Egress is traffic going out: your app calling a payment API, or a compromised process phoning home. People think about ingress and get surprised by egress.

Finally there is the default policy, the answer when nothing matches. A default-allow firewall says whatever I have not forbidden may come in. A default-deny firewall says whatever I have not permitted stays out. For a server, default deny is almost always right, because the list of things you serve is short and the list of things that might knock is endless.

How a firewall decidesA packet arrives and is checked against a numbered rule list from top to bottom. The first matching rule sends it to allow, drop or reject. If no rule matches, the default policy decides.Packetport 443, TCPfrom the internetRule list1 allow tcp 222 allow tcp 4433 drop anyfirst match winsno match: default policyallowthe packet goes on to the appdropsilence; the sender times outrejecta reset or ICMP error goes back
Figure 14.1. One packet, one rule list, one answer. The first matching rule wins; with no match, the default policy decides.

A port on your VPS is guarded in three places, stacked from the outside in. Each keeps its own clipboard, and each can say no without asking the others.

The outermost is the cloud network firewall. It runs in the provider’s network, before a packet reaches your machine at all. AWS calls it a security group. Oracle calls it a security list, or a network security group (NSG) in the newer model. Azure has NSGs too. The names change, but the job is the same: a rule list the provider enforces on the virtual network card that faces the internet. You edit it in a web console or through an API. You never log in to it, and it does not care what is running on your box.

Inside the machine is the host firewall. On Linux this is netfilter, the packet-filtering part of the kernel, and you talk to it through iptables or nftables. UFW and firewalld are friendlier front-ends that write rules into those tools for you. Whichever you use, the rules live on the box and apply to every packet that arrives on the interface.

The innermost layer is the bind address, and it is not a firewall at all. When your app starts listening, it names the addresses it will accept connections on. 0.0.0.0 means “any address on this machine”. 127.0.0.1 means “only callers already on this machine”. A process bound to loopback is invisible to the network, whatever the firewalls say. It is the office whose door opens only onto the back corridor. Many frameworks listen on every address by default, which is handy on your laptop and a surprise on a VPS.

The three layers in front of one portA request from the internet passes the cloud firewall, then the host firewall, then the app’s bind address, and reaches the app only if each layer allows it.Internetany addresson the streetCloudfirewallsecurity listHostfirewalliptablesBindaddress127.0.0.1Apphello-pipesport 3000Each box can stop the packet. A drop or a reject at any one ends the story.Read left to right. The first box that says no is the one to blame.
Figure 14.2. A port is reachable only if every box lets it through.

The order matters for debugging as much as for security. A packet from your laptop crosses the cloud firewall first, then the host firewall, and only then reaches whichever process is listening on that port and address. If the cloud firewall drops it, the host firewall never sees it. Your ufw status can look perfect while the site hangs. If the host firewall is fine but your app is bound to loopback, the packet has reached the building and found every office door shut.

Most people have only ever looked at one of the three. Cloud consoles show the rule list in plain sight, so that layer is easy to inspect. The host firewall hides behind a shell prompt, and the bind address hides inside an app’s config. That is why the outage in the story lasted until someone asked which guard was on duty.

Reading the symptom: refused, timed out, or connected

Section titled “Reading the symptom: refused, timed out, or connected”

Most of the time the client has already told you which guard was on duty. You only have to listen. Chapter 3 gave you the error trio, and this chapter adds a fourth. Put them side by side and the question mostly answers itself.

The client says What usually happened Suspect first
Connected Every guard passed the packet, and something answered. The app, the proxy, or the name. Stop blaming the firewall.
Connection timed out The packet was dropped silently, or never came back. A cloud rule that does not allow the port, or a host DROP rule.
Connection refused A reset came back at once. Something said no in a hurry. Nothing listening, a listener on 127.0.0.1, or a host REJECT with tcp-reset.
No route to host An ICMP “host prohibited” reply came back from a guard. A host firewall REJECT that uses ICMP, before any routing theory.

Refused is the fast, honest no. The packet reached a machine, the machine’s network stack looked at the port, and it answered at once: nobody is here for that door. Refused tells you that you are talking to the building. The door may be open, but nothing is behind it, or the thing behind it is only listening on the back corridor. So the first question is about the service: is something listening on that port, on an address that can see you? A listing of listening sockets on the box answers it in a second. If the only listener is on 127.0.0.1, no firewall rule will help you, because the bind address is the culprit.

Timed out is the quiet no. The client sent its first packet, heard nothing, sent it again, heard nothing, and gave up after a wait that feels like a year. A silent drop looks exactly like a switched-off machine or a wrong address, so do not trust it on its own. Check the outermost guard first, which is the cloud rule, and then the host’s DROP policy.

No route to host sounds like a routing fault, a missing wire somewhere on the Route rung, and sometimes it is one. But on most Linux and macOS clients, this message appears when a host firewall answers with an ICMP “administratively prohibited” reply. The guard has spoken, politely, and named the type of rule he used. Read the rule before you go poking at routes. It is the fourth error, and it is the one that most often sends people on a wild goose chase through their routing table.

The symptom depends on the rule’s action, not on the port. A rule that drops gives you timeouts. A rule that rejects gives you refused or no route, depending on what the reject sends back. Same port, same app, three different messages, and the difference lives entirely on the guard’s clipboard. Figure 14.3 lays out four attempts so you can see the pattern.

Four symptoms and the guard behind eachFour rows. Each starts at a laptop, passes one guard, and ends in a symptom. A cloud firewall drop and a host DROP both time out. A host reset, or a port with nothing listening, is refused. A host ICMP reject reads as no route to host.LaptopCloud firewallno rule for port 443Timed outsuspect: cloud firewallLaptopHost firewallDROP for port 443Timed outsuspect: host, DROP modeLaptopHost firewallREJECT with tcp-resetConnection refusedsuspect: REJECT or no listenerLaptopHost firewallREJECT icmp-host-prohibitedNo route to hostsuspect: host firewall rejectRead each row left to right. The first box that stops the packet is the suspect.
Figure 14.3. Four symptoms, four guards. The message names the guard that answered.

If you have followed this book on Oracle Cloud, you have probably met the double firewall already, most likely at an unfriendly hour. Oracle gives you one place to say yes, the cloud firewall, and the image you launched gives you a second place to say no.

Here is the pattern on the Ubuntu images I have seen, as of the mid-2020s. Check your own image before you trust the details. The image ships with iptables rules saved in /etc/iptables/rules.v4 and loaded at boot by a service called netfilter-persistent. Those rules accept loopback traffic, replies to connections you started, ping, and port 22, then reject everything else with a message saying the destination is administratively prohibited. It is a sensible default. It is also invisible until the day you open port 443 in the console and nothing happens.

That is the trap in one sentence. Opening a port in the cloud firewall is only half of the decision. The other half lives in a file on the machine, and the console never shows you that file.

Which message you get depends on which guard spoke. If the security list drops the packet, nobody answers, and your client waits until it gives up. That is a timeout. If the security list lets the packet through and the host rejects it, the rejection comes back as an explicit reply, and your client says “No route to host”. That is the fourth error from the table, and it sends people off chasing routing and DNS when the cause is one line of iptables. Figure 14.4 sets the two cases side by side.

Two ways a port can fail on OracleTop row: the security list allows 443, then the host REJECT rule answers, so the client sees No route to host. Bottom row: the security list drops 443, the host is never reached, and the client times out.LaptopSecurity list443 open: passHost rulesREJECT line matchesClient: No route to host (a named refusal)LaptopSecurity list443 closed: dropHost rulesnever reachedClient: timed out (silence)Same port, same app. Only the guard that answered changes the message.
Figure 14.4. The same port, two different answers. Whichever guard spoke decides what your client prints.

The opposite mistake is just as common. You add an ACCEPT to the host, forget the security list, and the host would happily welcome the packet, but the cloud guard drops it first. You get a timeout again, which is why silence is such a poor clue on its own.

The fix on the host side is about order, not magic. iptables reads a chain from top to bottom, and the first matching rule decides. An ACCEPT appended below the REJECT never gets a look at the packet. Insert your rule above the REJECT, then save the rules so they survive a reboot. Check the live rules as well as the saved file. The file is what loads at boot, the live rules are what is happening now, and the two can disagree after a hand edit.

UFW makes this easier and also sneakier. It writes its own rules into the same chains and keeps its own idea of what those rules should be. If you run UFW and also hand-edit rules.v4, you have two landlords holding keys to one flat. My advice for a small production VPS: pick one tool to own the host firewall, write that choice into the server notes, and reorder the image defaults once, on purpose, so your allow rules sit above the reject.

Back in Chapter 7 you met the Docker surprise. You ran a container with a published port, you wrote a UFW rule that said deny, and the port answered anyway. Now you know why. When Docker publishes a port, it writes its own netfilter rules, and those rules sit in a part of the chain that your UFW deny never reaches. The guard with the clipboard at the front door was told to stop everyone, but a second door was cut into the wall behind him.

So the host firewall rule for a published Docker port is decorative. It looks like a decision, and it is not one. The decision was made when you wrote the publish flag. If you wrote it as a bare 3000:3000, Docker listens on every interface, and the port is open to the street.

The best way on a small production VPS is to stop publishing app ports to the world at all. Publish to loopback instead, so the container listens only on 127.0.0.1, and let Caddy or nginx on the same box be the only thing that talks to it. The receptionist can reach the office at the back. The street cannot. Your firewall now has less to get wrong, because there is no public door to forget about.

Every war story in this chapter has the same shape. Someone edited a firewall, lost their connection, and spent an hour doing something else. The widely told version involves a Friday evening, a ufw enable with no SSH rule, and a console login that nobody had tested. I will not repeat the swear words.

Four habits prevent it. Allow SSH before you change anything else, and check that the rule is live. Keep your current SSH session open while you make the change, and open a second session from a new terminal before you close the first. Know the console path before you need it: the provider’s web console or serial console is your way back when the network is gone. Write down the rollback. If the change breaks you, the rollback is the one-line command you already typed, reversed.

Notice what the console is not. It is not a backdoor past the firewall. It is a separate, provider-authenticated way to reach the machine, and it is the reason the console path belongs in your notes, not in your memory.

Sometimes the guard is not yours at all. You can do everything right on the VPS and still never see a packet, because somebody between you and the world made a decision you cannot see.

Your home ISP is the usual suspect. Many residential connections block outbound port 25, the old mail port, to slow spam from compromised home machines. Some block inbound 80 and 443 as well, which is why a site hosted on a home server works from your desk and fails for everyone else. Mobile networks and many public Wi-Fi networks do similar things.

Then there is CGNAT, which we met as the gated township. If your ISP shares one public address among many customers, you have no address of your own for anyone to knock on. Port forwarding on your router does nothing, because the router is not the one with the street address. The fix is a tunnel or a different ISP plan, not a cleverer router setting.

Corporate and campus networks often allow only a short list of ports outward. And many cloud providers block outbound SMTP by default on new accounts, as of the mid-2020s, which is why a mail server on a fresh VPS can connect to Gmail and hang forever. You are not wrong about your config. The provider made a policy call.

For the dance-academy app, the right answer is the one you probably already use: send mail through a transactional provider on the submission ports, 587 or 465, which are designed for exactly this. Your app talks to a service that talks to the big mailboxes. Your VPS never needs to be the mail server.

Blockers outside your own machineA packet from a laptop passes a home router with CGNAT, then the ISP, then the cloud provider edge, then the VPS guards. Each stop can silently block a port you thought was open.LaptopHome routerNAT / CGNATISPmay drop 25, 80, 443Cloud edgeyour guardsVPSA closed port upstream looks exactly like a closed port on your server.
Figure 14.5. Four places a packet can stop before your code ever sees it.

Rate limiting and fail2ban: firewalls that learn

Section titled “Rate limiting and fail2ban: firewalls that learn”

Everything so far has been a static rule list. Someone asks, the guard checks the list, and the answer is the same tomorrow. That is fine for a door that should always be closed to the world. It is not fine for SSH, which is always open and always being tried. Within a day of a new VPS getting a public address, the logs fill with login attempts from machines you have never heard of, all guessing usernames and passwords. These are the doorknob-rattlers. They are weather, not personal, and you cannot stop the weather. You can stop it from getting in.

That is where dynamic firewalling comes in. Instead of a fixed rule, the guard starts keeping notes.

Rate limiting says: a single source may open only so many new connections in a window. Normal people never hit the limit. A script trying a thousand passwords does. The firewall then drops or delays the excess, and the attacker’s script slows to a crawl without you touching anything.

fail2ban is a different kind of guard. It reads your logs, notices a pattern (say, ten failed SSH logins from one address in ten minutes), and writes a temporary rule that drops that address for an hour or a day. When the ban expires, the address is welcome again. It is a guard with a clipboard and a memory.

Here is the part people learn the hard way. Dynamic guards can ban the wrong people:

  • Your own mistyped key. You deploy from a café, fumble the key path five times, and fail2ban bans the café’s public address. Your next attempt, from the same café, times out. You will read that as a cloud problem for an hour. It is not. It is your own guard protecting you from yourself.
  • The shared gate. If your user is behind CGNAT (the gated township from earlier), a thousand neighbours share one public address. One neighbour’s failed logins can ban the whole society. This is why a ban list needs an allowlist for your own addresses, and why you check the ban list before you check anything else.
  • The CI runner. A widely told story, and a composite: a team’s deploy job used a stale key, failed a handful of times, and got its runner’s address banned. Every deploy failed for two hours, all with a timeout that looked like a network fault. Nobody thought to look at fail2ban until someone asked, at two in the morning, why only deploys were broken.

The rule I would put on the wall: a ban is a decision made by a program that cannot see your intentions. Keep your own addresses in the ignore list, and always know how to see and remove a ban.

The best way, for a small production VPS, is boring on purpose. Use key-only SSH (Ch 6). Turn on fail2ban with its SSH jail and an ignore list containing your home and tailnet addresses. If your app is public, put rate limiting where it belongs: at the proxy for simple cases, or at the edge (Ch 17) if a doorman is already screening visitors. Do not build a clever bespoke rule system on the box. The rules you forget are the ones that bite.

The demo below is a lab VPS in miniature. You are on your laptop, and you try to reach five ports on the lab box: 22, 80, 443, 3000 and 5432. Four guards stand between your request and the app: the cloud firewall, the host firewall, the door (the port and its bind address), and the app itself. Toggle any of them, pick a port, and press Connect.

The packet walks the guards left to right and stops at the first one that objects. The client’s message is the clue. A timeout means a guard dropped the packet in silence. A refusal means something answered and said no, either the host’s REJECT rule or a closed port on the machine. A success means every guard let it through.

Try it: which guard stopped me?

Pick a port, set the guards and the service, then connect from your laptop to the lab VPS.

    Static fallback: a packet passes the cloud firewall, then the host firewall, then the port and its bind address, then the app. The first guard that refuses decides the symptom. A silent drop looks like a timeout. A reset or a listener missing on that address looks like refused. An ICMP reject looks like no route to host. A Docker-published port skips the host firewall, which is why UFW can say no while the port still answers.

    Play with it until you can predict the answer before pressing Connect. Two things are worth trying specifically. First, set the host to DROP and then to REJECT with the same rule, and notice that the client’s message changes even though the request is blocked both times. Second, turn on the Docker-published port for 3000 and watch the host toggle stop mattering. That is the Ch 7 bypass, and you have now seen it on a diagram.

    Goal. Put the lab VPS into a deliberate default-deny posture, then break each layer in turn, and record what your laptop sees. By the end you should be able to name the guard from the symptom alone.

    The conceptual steps.

    1. Decide the allowed set. For this lab it is 22 for you, 80 and 443 for the public, and nothing else. Write it down before touching anything.
    2. Open the cloud firewall to exactly that set, and nothing more. Check from your laptop that the three ports answer.
    3. Make the host default-deny for inbound traffic, with the same three ports allowed. Keep the loopback interface and replies to your own connections allowed, or you will lock yourself out of your own answers. Check again from the laptop.
    4. Run the app (hello-pipes) on the loopback address only, with Caddy in front on 443. Confirm that a request through the domain works, and that a direct request to the app’s port from the laptop does not.
    5. Break the cloud layer: close 443 in the cloud firewall, leave the host alone. Record the symptom your laptop sees, and name the guard.
    6. Restore it. Break the host layer: remove the 443 rule on the host and keep the cloud open. Record the symptom again. Then change the host rule from reject to drop and record the symptom a third time.
    7. Stop Caddy and record the symptom. Start it again. Start the app bound to 0.0.0.0 instead, and check whether the direct port is now reachable. Put it back to loopback.

    Lockout safety. Before you change any firewall rule on the lab box, open a second SSH session and keep the first one alive. Know where the provider’s web console lives and how to log in there without SSH. Write down the rollback for each rule in one line before you apply it. A firewall change that breaks your own session is the most common self-inflicted outage in this chapter, and it is almost never the cloud’s fault.

    How you’ll know it worked. You have a small table: for each break, the symptom your laptop printed (timeout, refused, or connected), and the guard you blamed. Every row should match what the guard model in this chapter predicted. If a row surprised you, that is the most valuable row. Work out which assumption was wrong, and fix the model before you fix the box.

    A firewall is a guard with a clipboard. It reads each packet’s source, destination, port, protocol and connection state, then allows, drops or rejects it. Default deny means the clipboard starts empty, and every line on it is a decision someone made on purpose.

    A port is reachable only if every layer allows it: the cloud firewall, the host firewall, and the address the app binds to. When a connection fails, the error names the guard to suspect. Refused means something answered and said no. Timed out means silence, usually a drop. No route to host means an ICMP reject. Connected means every guard let you through.

    Your mantra still holds: Name → Address → Route → Door → Guard → Receptionist → App. The firewall is the fifth rung, and it is the one that most often says no without telling anyone why.

    Lockout safety is the habit that protects you. Keep your current SSH session open, test from a second one, know your provider’s console path, and write a one-line rollback before every change.

    1. A client gets “Connection refused” on port 443. Which guard do you suspect first?

    The host firewall or the app. Refused means a packet reached the machine and got a reset back, either from a REJECT rule or because nothing listens on that port. A cloud drop would have timed out instead.

    2. What is the difference between a stateless and a stateful rule?

    A stateless rule judges each packet on its own. A stateful rule remembers the connections already allowed, so replies to an outbound request can come back without a separate inbound rule.

    3. Why can an open cloud security list still leave a port unreachable on an Oracle image?

    The image’s own iptables rules still sit on the host. They usually REJECT everything except 22, so the packet fails there even though the cloud layer let it in. You need an ACCEPT above that REJECT as well.

    4. Why does a published Docker port ignore a UFW deny for that port?

    Docker’s published ports travel the forward path, not the INPUT chain where UFW’s rules live, so the deny never sees them. Publishing to 127.0.0.1 and fronting the app with Caddy or nginx closes that gap.

    5. Before changing the host firewall on a remote VPS, what two things protect you from a lockout?

    Keep your current SSH session open while you test from a second one, and know the provider’s web console path, which works without SSH. A one-line rollback written before the change is a useful third.

    Warm-up 1. Name the three layers. From outside in, list the three places a port must be allowed on a cloud VPS.

    Answer

    The cloud network firewall (security list, security group or NSG), the host firewall (iptables or nftables, often through UFW or firewalld), and the application’s bind address.

    Warm-up 2. Decode the symptom. A client shows “Connection timed out” on port 80. Name the two most likely guards.

    Answer

    The cloud firewall dropping the packet, or a host firewall rule that drops instead of rejecting. Silence is what a drop looks like from the client’s side.

    Warm-up 3. Why 127.0.0.1? In two sentences, explain why binding the app to 127.0.0.1 behind Caddy is safer than binding to 0.0.0.0.

    Answer

    A 0.0.0.0 bind lets anything that reaches the host talk to the app directly, skipping Caddy and any rule you forgot. Bound to 127.0.0.1, only processes on the box can reach the app, so the only street-facing door is Caddy’s.

    Lab 4. Close the cloud door. Remove the cloud rule for 443 and confirm that a client now sees a timeout, not a refusal. Record the symptom in your table.

    Hint

    Delete the 443 ingress rule in the provider console, then run curl -v --max-time 5 https://203.0.113.10 from your laptop. Silence with no reply at all points at the cloud guard.

    Lab 5. Make UFW say no politely. Change the host rule for 443 from drop to reject, and show that the client now gets refused.

    Hint

    On the lab VPS, remove any allow rule for 443, then run sudo ufw reject 443/tcp and sudo ufw status numbered. Retest with curl.

    Model solution: the client sees “Connection refused” because the host answers with a TCP reset. Compare that with the silence from exercise 4.

    Lab 6. Stop Caddy. With the cloud and host rules open, stop Caddy, record what the client sees, then start it again.

    Hint

    Run sudo systemctl stop caddy, retest with curl, then sudo systemctl start caddy. Nothing listens on 443 now, so the host answers with a reset.

    Lab 7. Hide the app behind Caddy. Bind the hello-pipes app to 127.0.0.1 only. Show that Caddy still serves it, while a direct request to port 3000 from outside is refused.

    Hint

    Change the app’s listen address to 127.0.0.1 and restart it. Then try curl -v http://203.0.113.10:3000 from your laptop, which should be refused, and curl -v --resolve pipeslab.in:443:203.0.113.10 https://pipeslab.in, which should work through Caddy.

    Model solution: the app is unchanged, but the only public door is Caddy’s, so the bind address is a guard of its own.

    Staff 8. Oracle’s double door. A teammate opened 443 in the Oracle security list, and clients still time out. Describe the two checks you would make and the fix.

    Model answer

    First, check the cloud layer actually saved the rule and that it covers the right source. Second, check the host: list the INPUT chain and look for a REJECT or DROP that sits above any ACCEPT for 443. Insert an ACCEPT for 443 above it, persist the rules so they survive a reboot, and confirm UFW is not fighting the change. Then retest from the laptop, since a timeout tells you the packet is still being dropped.

    Staff 9. Ban or allowlist? CI runners hit a login endpoint, fail2ban bans one runner IP, and deploys stall. Argue the fix in three sentences.

    Model answer

    Ban on the failing signal, not on request volume, and raise the threshold with a longer window. Allowlist the CI egress addresses through ignoreip so known runners are never banned. Check whether the runners share a CGNAT or cloud NAT address, because one ban then blocks everyone behind it.

    Book 2 of a series. Book 1: The Glue.