Restrict network access to CAST Imaging
Overview
A default CAST Imaging installation listens on every network interface, so any machine that can reach the host can also reach the internal components directly, bypassing the gateway. This page describes the host firewall rules that leave only the gateway reachable from the network, and is intended for administrators hardening an installation on Microsoft Windows or Linux via Docker/Podman.
No CAST Imaging configuration files are changed: the rules are applied in the host firewall, either with the sample scripts provided on this page or with your own tooling.
Network rules
| Port | Component | Reachable from |
|---|---|---|
8090 on the imaging-services machine |
Gateway | Any address: browsers and API clients |
8098 on the imaging-services machine |
Control Panel | Standalone (all components on one machine): this machine only. Distributed: the other CAST Imaging machines only, so that the analysis nodes, dashboards, viewer and MCP Server can register |
| Every other CAST Imaging port | Console, authentication service, SSO/Keycloak, internal broker, analysis node, dashboards, viewer, Neo4j | Standalone: this machine only. Distributed: the other CAST Imaging machines only |
- Browsers reach the SSO/Keycloak login pages through the gateway, so the SSO port never needs to be reachable from the network.
- The rules include ports that no user interface answers on, in particular
2381(Control Panel internal broker) and, on Microsoft Windows,9002(SSO Service). Restrict them like every other internal port. - On Linux, the embedded PostgreSQL instance (
DB_MODE=embeddedinconfiguration.conf, the default) is restricted like every other port, on2285. - The “other CAST Imaging machines” are the machines hosting the analysis nodes, dashboards and viewer, plus any machine hosting the CAST Imaging MCP Server, which also registers with the Control Panel on
8098. - Traffic from the machine itself (loopback) and, on Linux, between containers is not affected, so local access keeps working.
The rules do not cover:
- An external database: the PostgreSQL instance on Microsoft Windows (
2284), or on Linux withDB_MODE=external. Restrict it according to your own database security policy. - Operating system ports such as RDP, SMB, WinRM or SSH.
- The ports of the CAST Imaging MCP Server and the CAST MCP Server for Gatekeeper themselves, which are installed separately and have their own port requirements.
Ports to restrict
Restrict every port below except 8090. Only the ports of the components installed on a given machine are in use there. Where you changed a default port during the installation, use the value set in the installer configuration file used on the machine:
- Microsoft Windows:
config-all.confon a single machine. In a distributed installation, the file of the component installed on the machine:config-imaging-services.conf,config-analysis-node.conf,config-dashboards.conforconfig-imaging-viewer.conf. - Linux:
configuration.conf.
imaging-services
- 2381: Control Panel
- 8090: Gateway Service
- 8091: Console Service
- 8092: Authentication service
- 8096: SSO Service
- 8098: Control Panel
- 9002: SSO Service
analysis-node
- 8099: Analysis Node
imaging-viewer
- 5000: Neo4j (not required in >= 3.4.0-funcrel)
- 6372, 7483, 7484, 7697: Neo4j
- 8070: Viewer APIs (>= 3.4.0-funcrel)
- 8093: Viewer Frontend
- 8094: Viewer AI Manager
- 8286: GraphRAG Server
- 9010: Viewer Backend
- 9011: Viewer ETL
dashboards
- 8097: Dashboard Service
mcp-servers
- 8282: CAST Imaging MCP Server
- 8283: Gatekeeper MCP Server
PostgreSQL
- 2284: PostgreSQL
imaging-services
- 2285: PostgreSQL (embedded)
- 2381: Control Panel
- 8090: Gateway
- 8091: Console
- 8092: Authorization
- 8096: Keycloak
- 8098: Control Panel
analysis-node
- 8089: Analysis Node
imaging-viewer
- 5000: Neo4j (not required in >= 3.4.0-funcrel)
- 7473, 7474, 7687: Neo4j
- 8070: API service (>= 3.4.0-funcrel)
- 8082: AI
- 8083: Viewer front-end
- 8084: Login
- 8286: GraphRAG
- 9000: Viewer
- 9001: ETL
- 9980: Source code
dashboards
- 8097: Dashboards
mcp-servers
- 8282: CAST Imaging MCP Server
- 8283: Gatekeeper MCP Server
Requirements
- Administrator (Microsoft Windows) or
root(Linux) access on each CAST Imaging machine. - In a distributed installation, the IP address or host name of every other CAST Imaging machine. Host names must be resolvable (DNS or
hostsfile) from each machine.
You can apply the rules before or after installing CAST Imaging. Apply them again whenever a port changes, a CAST Imaging machine is added, or the IP address of a CAST Imaging machine changes.
Apply the rules
Use the sample scripts
CAST provides sample scripts that read the port numbers from the installer configuration file and apply the rules above. They are provided as samples: review what they will do with a dry run before applying them, and adapt them to your own process if needed.
| Platform | Files |
|---|---|
| Microsoft Windows | Run-ImagingPortFirewall.bat and Set-ImagingPortFirewall.ps1 |
| Linux via Docker/Podman | cast-imaging-firewall.sh |
Run the scripts on each CAST Imaging machine. They take the port numbers from the installer configuration file used on that machine, so that file must contain the port numbers that the installation uses:
- Microsoft Windows:
config-all.confon a single machine. In a distributed installation, the file of the component installed on the machine:config-imaging-services.conf,config-analysis-node.conf,config-dashboards.conforconfig-imaging-viewer.conf. - Linux:
configuration.conf.
In a distributed installation, list the other CAST Imaging machines as IP addresses, IP/CIDR ranges or host names, separated by commas, either in IMAGING_SERVERS at the top of the script or on the command line, as shown below. If a listed host name cannot be resolved, the script stops without changing anything. Machines named in the *_HOSTNAME entries of the configuration file are added automatically, so listing them again does no harm:
- On the analysis node, dashboards and viewer machines, these entries name the
imaging-servicesmachine, which is therefore allowed automatically. - On the
imaging-servicesmachine, the configuration file does not name the other machines: list every analysis node, dashboards, viewer and MCP Server machine explicitly, otherwise they cannot register with the Control Panel.
-
Copy both files to the installer folder, next to the configuration file.
-
Run a dry run, which changes nothing, passing the name of the configuration file used on this machine. The script requests administrator rights if needed:
Run-ImagingPortFirewall.bat dryrun config-all.conf "192.0.2.11,imaging-node1.corp.domain.com"Run without arguments, the script displays a menu and asks for the other CAST Imaging machines.
-
Review the output:
- Public (any machine) lists
8090only. - Restricted (local + servers) lists every port of the components installed on this machine, as given in Ports to restrict.
- Allowed Imaging servers lists every other CAST Imaging machine. The machine’s own addresses are always allowed.
- Any warning about Group Policy: a Group Policy that ignores local firewall rules, or a Block rule covering
8090, must be dealt with by your IT team.
- Public (any machine) lists
-
Apply the rules:
Run-ImagingPortFirewall.bat apply config-all.conf "192.0.2.11,imaging-node1.corp.domain.com"
The rules are created in the Windows Defender Firewall rule group CAST Imaging Ports. Windows Defender Firewall must be enabled, with the default inbound action set to Block. To revert, run Run-ImagingPortFirewall.bat remove.
-
Copy the script to the installer folder, next to
configuration.conf, and make it executable:$ chmod +x cast-imaging-firewall.sh -
Run a dry run, which changes nothing:
$ sudo ./cast-imaging-firewall.sh dryrun -n "192.0.2.11,imaging-node1.corp.domain.com" -
Review the output:
- Public (any machine) lists
8090only. - Restricted (local + servers) lists every port of the components installed on this machine, as given in Ports to restrict, including
2285when the embedded database is used. - Allowed Imaging servers lists every other CAST Imaging machine.
- A warning that a published container port is not restricted: if the port belongs to CAST Imaging, add it with
-p <port>.
- Public (any machine) lists
-
Apply the rules:
$ sudo ./cast-imaging-firewall.sh apply -n "192.0.2.11,imaging-node1.corp.domain.com"
The rules are written to /etc/cast-imaging/firewall.nft and loaded again at boot by the cast-imaging-firewall.service systemd unit. nftables and systemd must be installed. To display the active rules and the number of dropped connections, run sudo ./cast-imaging-firewall.sh status. To revert, run sudo ./cast-imaging-firewall.sh remove.
Use your own tooling
Use Windows Defender Firewall inbound rules:
- Ensure that Windows Defender Firewall is enabled on every profile, with the default inbound action set to Block.
- Block rules always win over Allow rules. A Block rule on the internal ports therefore also overrides any broad Allow rule, for example a Group Policy rule opening a whole port range. In a distributed installation, exclude the other CAST Imaging machines from the remote addresses of that Block rule rather than adding an Allow rule for them.
- Ensure that no Group Policy Block rule covers
8090, otherwise it stays closed. - If Group Policy is configured to ignore local firewall rules, rules created on the machine have no effect: ask your IT team to apply them in the Group Policy instead.
Docker and Podman publish container ports through NAT rules that bypass ufw and firewalld, so rules created with those tools do not protect the CAST Imaging ports. Instead, filter the traffic before the container NAT is applied, for example with a dedicated nftables table hooked into prerouting at a priority below -100:
table inet cast_imaging {
set internal_ports {
type inet_service
elements = { 2285, 2381, 8089, 8091, 8092, 8096, 8097, 8098 }
}
set nodes4 {
type ipv4_addr
flags interval
elements = { 192.0.2.11, 192.0.2.12 }
}
chain prerouting {
type filter hook prerouting priority -150; policy accept;
iifname "lo" accept
iifname "docker0" accept
iifname "podman*" accept
iifname "br-*" accept
iifname "cni*" accept
iifname "veth*" accept
fib daddr type != local accept
tcp dport @internal_ports ip saddr @nodes4 accept
tcp dport @internal_ports counter drop
}
}
internal_ports: the ports to restrict on this machine.nodes4: the IP addresses of the other CAST Imaging machines. In a standalone installation, remove theelementsline.- The
iifnamerules leave loopback and container-to-container traffic unfiltered.
Load the table with nft -f <file> and make sure it is loaded again at boot, for example with a systemd unit.
Check the configuration
- From a machine that is not part of the CAST Imaging installation, test each port, for example with
nc -zv <host> <port>orTest-NetConnection <host> -Port <port>. Port8090must connect, and every other CAST Imaging port, including8098, must time out or be refused. - In a distributed installation, repeat the test from another CAST Imaging machine:
8098and the internal ports must connect. - Open
http://<host>:8090from a remote browser, log in, open an application in the viewer and the dashboards, then run an analysis. Each step must complete without an error.