See Ash Code logo See Ash Code

I drew the network path before changing the firewall

Ashlynn Antrobus
• • 3 min read

My October inventory listed Caddy routes, host listeners and Docker-published ports. Read separately, each list looked reasonable. Put together, they showed more than one route to the same application.

A request could enter through Caddy on HTTPS, or try to reach a published backend port directly. Configuring the reverse proxy didn’t automatically remove the second path.

I drew the hops before changing the rules

For the Flask bridge in the automation stack, the intended route had this shape:

Client -> HTTPS :443 -> Caddy on the host
                         -> 127.0.0.1:5050
                              -> Docker mapping
                                   -> Flask container :5000

The alternate path was a connection to the host’s published port 5050. If that mapping listened on every host interface, a caller could bypass Caddy’s route handling and any policy attached there.

A general diagram shows a firewall between a LAN and a WAN.

A general firewall diagram by Bruno Pedrozo, CC BY-SA 3.0; unmodified. It illustrates a network boundary, not the Docker forwarding rules discussed below.

This wasn’t the same question as whether Flask could talk to PostgreSQL inside its Docker network. External ingress, host-to-container forwarding and container-to-container traffic crossed different boundaries.

Docker publishing needed its own inspection

The host used UFW, but a familiar-looking host firewall policy wasn’t enough evidence about a bridge-networked container. Docker’s NAT and forwarding rules can divert published-port traffic before the host chains UFW normally uses. Docker documents this interaction.

The October 20 changes addressed bindings as well as filtering:

SurfaceRecorded change
n8n and its auxiliary HTTP/model/vector servicesPublish their host ports explicitly on 127.0.0.1
Credentials PostgreSQLBind host port 54920 to loopback
CockpitBind its socket to the LAN address and loopback; restrict access to the home subnet
Jellyfin and Samba direct accessRestrict the direct service paths to the LAN
Forwarded Docker trafficAdd the physical-interface policy in DOCKER-USER

Jellyfin used host networking, so it didn’t belong in the same bridge-forwarding explanation as the n8n containers. Its direct listener needed the host-side policy.

The forwarding rule had a specific scope

The recorded DOCKER-USER sequence first accepted established or related traffic, then dropped traffic arriving on the physical interface, and otherwise returned to the remaining rules. It wasn’t a blanket denial of every packet exchanged with a container.

That distinction preserved return traffic and left the host proxy’s local connection and internal bridge traffic on their intended paths. Persistence was recorded in the UFW rules files. These are the dated configuration changes, not results from a new external reachability test.

I also kept the router’s SSH forwarding separate from the host listener. An external port mapping says nothing by itself about another interface, particularly IPv6.

The drawing gave me a way to ask who could reach each service I’d listed in the dependency audit.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.