Skip to content

PaaS firewall rules and ACLs — ingress restriction without breaking healthchecks

How to lock ingress to known sources without making your platform's healthcheck the next casualty. Common deny-all patterns and the loopback exception that keeps the LB green.

You harden a PaaS environment by denying all ingress except your office IP, an SSO provider’s IPs, and a partner’s webhook source. The next morning the platform’s healthcheck is failing, the LB has marked all your containers down, and traffic is 502ing. The healthcheck wasn’t in your allow-list because nobody told you the IP it comes from. Locking down ingress on PaaS without enumerating the healthcheck path is the single most common cause of self-inflicted outages on managed PaaS — and it’s avoidable in fifteen minutes.

What’s happening

On Jelastic-class PaaS, your container reachability has three layers:

  1. Platform LB to container. The LB calls your container on a known port (typically 80 or 8080) on a known network path. The source IP is inside the platform’s network — usually a 10.x.x.x range you have to ask for. The LB also runs an HTTP healthcheck against a configurable URL (default /) and if it fails, the container is yanked out of rotation. This is the one most people forget.
  2. Internal network between your containers. Containers in the same environment can reach each other on private IPs by default. You usually want this — your app talks to its database internally.
  3. Public ingress. Anything from outside the platform — clients, monitoring, partner webhooks — arrives at the LB and is forwarded to the container.

When you write firewall rules, three rules of thumb keep the platform happy:

  • Always allow loopback. lo traffic is your container talking to itself. Process-supervisor checks, agent-to-agent IPC, ACME standalone challenge handlers. Deny it and you’ll spend an hour wondering why nothing works internally.
  • Always allow the platform LB’s source range. Get the CIDRs from the platform docs or support and put them in your rules explicitly. This is also where the healthcheck originates.
  • Healthcheck is its own path. If you rate-limit /, the healthcheck (also hitting / by default) gets rate-limited too. Either move the healthcheck to a dedicated /healthz endpoint or exempt the LB source from rate limits.

The deny pattern that does the right thing is “default deny, then allow loopback, then allow platform LB ranges, then allow named ingress sources, then drop the rest.” On Linux that’s iptables or nftables; on cPanel you’d lean on csf instead.

How to verify

What’s currently allowed:

sudo iptables -L INPUT -n -v --line-numbers
# Chain INPUT (policy ACCEPT)
# num  pkts bytes target prot opt in  out source         destination
# 1    1232 200K  ACCEPT all  --  lo  *   0.0.0.0/0      0.0.0.0/0
# 2    8420 1.5M  ACCEPT tcp  --  *   *   10.150.0.0/16  0.0.0.0/0 tcp dpt:80
# 3      45 5400  DROP   tcp  --  *   *   0.0.0.0/0      0.0.0.0/0 tcp dpt:22

# Or with ufw, which is friendlier
sudo ufw status numbered

Is the platform healthcheck currently passing:

# Look at the LB's view of your backend
# (exact path depends on the platform — Jelastic dashboard, JCS API, etc.)

# From inside the container, what gets logged when the LB calls?
tail -F /var/log/nginx/access.log | grep " /healthz "
# 10.150.0.7 - - [14/May/2026:14:23:11 +0000] "GET /healthz HTTP/1.1" 200 ...

If you see no 10.150.0.x (or whatever your platform’s LB range is) hitting your container, your healthcheck is being blocked at the firewall before it lands. The container will show as “down” in the LB even though the application is healthy.

Test from outside — what does a stranger see:

# From a machine NOT in your allow-list
curl -v -o /dev/null https://app.example.com/  2>&1 | grep -E "Connected|connect"
# Connected to ... port 443 (#0)   ← request reaches the LB, then the firewall has to do its job
# curl: (28) Failed to connect ...   ← LB itself is unreachable (different problem)

The LB will usually always be reachable from anywhere on the internet — the firewall lives at the container layer. So “I can connect” doesn’t mean ingress is open; it means the LB accepted the TCP. The 200/403/etc comes from the container.

The fix

A baseline iptables policy that doesn’t lock you or the platform out. Put it in a script you can re-run idempotently:

#!/usr/bin/env bash
set -euo pipefail

# === ingress allow list — edit per environment ===
PLATFORM_LB_CIDRS=("10.150.0.0/16" "10.151.0.0/16")   # ask the platform for these
OFFICE_CIDRS=("198.51.100.0/24")
PARTNER_WEBHOOK_CIDRS=("203.0.113.50/32" "203.0.113.51/32")
SSO_PROVIDER_CIDRS=("203.0.113.100/30")
ADMIN_SSH_CIDRS=("198.51.100.0/24")
# =================================================

# Flush only the chains we manage
iptables -F INPUT
iptables -X SH-INGRESS  2>/dev/null || true
iptables -N SH-INGRESS

# Loopback always
iptables -A INPUT -i lo -j ACCEPT

# Established and related (return traffic for connections we initiated)
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# ICMP — at minimum allow echo, often useful from inside the platform
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT

# === Platform-internal: the LB and healthchecks ===
for cidr in "${PLATFORM_LB_CIDRS[@]}"; do
  iptables -A INPUT -s "$cidr" -p tcp --dport 80   -j ACCEPT
  iptables -A INPUT -s "$cidr" -p tcp --dport 8080 -j ACCEPT
  iptables -A INPUT -s "$cidr" -p tcp --dport 443  -j ACCEPT
done

# === Office HTTP/HTTPS (e.g. for staging environments not on the public LB) ===
for cidr in "${OFFICE_CIDRS[@]}"; do
  iptables -A INPUT -s "$cidr" -p tcp --dport 80  -j ACCEPT
  iptables -A INPUT -s "$cidr" -p tcp --dport 443 -j ACCEPT
done

# === Partner webhooks (HTTPS only) ===
for cidr in "${PARTNER_WEBHOOK_CIDRS[@]}"; do
  iptables -A INPUT -s "$cidr" -p tcp --dport 443 -j ACCEPT
done

# === SSO callback ===
for cidr in "${SSO_PROVIDER_CIDRS[@]}"; do
  iptables -A INPUT -s "$cidr" -p tcp --dport 443 -j ACCEPT
done

# === SSH for ops, from known networks only ===
for cidr in "${ADMIN_SSH_CIDRS[@]}"; do
  iptables -A INPUT -s "$cidr" -p tcp --dport 22 -j ACCEPT
done

# === Drop everything else ===
iptables -A INPUT -j LOG --log-prefix "IPT-DROP: " --log-level 4
iptables -A INPUT -j DROP

# Persist (Almalinux/RHEL)
iptables-save > /etc/sysconfig/iptables
systemctl enable --now iptables 2>/dev/null || true

The iptables -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT rule is the second most-commonly-forgotten one. Without it, you can outbound-connect to anywhere, but the return packets get DROPPED at INPUT — your container can’t talk to its database, its DNS, anything.

If you’re on Ubuntu and prefer ufw:

ufw default deny incoming
ufw default allow outgoing

# Platform LB ranges
ufw allow from 10.150.0.0/16 to any port 80
ufw allow from 10.150.0.0/16 to any port 8080
ufw allow from 10.150.0.0/16 to any port 443

# Office + partners
ufw allow from 198.51.100.0/24 to any port 443
ufw allow from 203.0.113.50 to any port 443
ufw allow from 203.0.113.51 to any port 443

# SSH from admin networks only
ufw allow from 198.51.100.0/24 to any port 22

ufw enable
ufw status verbose

The healthcheck-vs-rate-limit trap. If your application returns 200 on / and the LB’s healthcheck uses /, you’ve probably also rate-limited / somewhere because customers hit it. The LB hits it 6 times a minute, your rate limiter throttles it, and the LB starts pulling the container out of rotation during a campaign. The clean fix is splitting:

# Inside the container's nginx
location = /healthz {
  access_log off;
  return 200 "ok\n";
  add_header Content-Type text/plain;
}

location / {
  # rate-limited customer endpoint
  limit_req zone=api burst=200 nodelay;
  proxy_pass http://app_upstream;
}

And reconfigure the LB healthcheck to call /healthz. Now the healthcheck has its own dedicated path that’s always 200, isn’t rate-limited, and is cheap to serve.

After you push the rules, watch the access log for one healthcheck cycle (typically 10–30 seconds) and confirm the LB is still seeing your container. If not, ssh in via your allow-listed admin IP and tail the firewall log:

dmesg | grep "IPT-DROP" | tail -50
# May 14 14:25:02 srv01 kernel: IPT-DROP: IN=eth0 OUT= SRC=10.150.0.7 ...

If the LB IP shows up in the drop log, your allow CIDRs are wrong and you need to update them.

We harden ingress on PaaS environments with allow-listed source ranges, healthcheck-aware rules, and the same change control as the rest of the platform — part of our environment management offering. Ask for a firewall audit if you suspect your current ruleset has a self-inflicted hole or a self-inflicted block.