ACLClouds
ACLClouds

Open a port without exposing the whole VPS

Allow the necessary protocol and source in the panel firewall and in Linux. An application can be blocked by two layers.

An application can be blocked by two layers: the ACLClouds firewall in the panel and UFW, nftables or iptables in the VM. Both must allow the same traffic.

Step-by-step procedure

  1. Check that the port is listening

    Before the firewall, check with ss -lntup that the application is listening on 0.0.0.0 or the desired interface.

  2. Choose protocol and source

    Only open TCP or UDP depending on the application. Limit the source address for SSH, database and administration.

  3. Add the panel rule

    In "Additional tools" > "Firewall", add an ACCEPT rule with the protocol and the port, then check in "Firewall options" that the firewall is enabled.

  4. Add the Linux rule

    Allow the same port in UFW or nftables, then test from an outside machine.

UFW examples

ufw allow 80/tcp
ufw allow 443/tcp
ufw allow from 203.0.113.10 to any port 22 proto tcp
ufw status numbered

Enable UFW without losing SSH

ufw allow 22/tcp
ufw default deny incoming
ufw default allow outgoing
ufw enable
ufw status verbose

Before you start

The panel firewall is in "Additional tools" > "Firewall", and its general settings are in "Firewall options". It filters traffic before it reaches the VM. As long as "Firewall enabled" is off, the panel rules have no effect.

  • Note the exact port and protocol: 25565/TCP for Minecraft Java, 19132/UDP for Bedrock, 30120 over TCP and UDP for FiveM.
  • Allow port 22/TCP before enabling a firewall that blocks everything else.

Understanding the panel firewall

Each rule applies to incoming traffic and has an "Action" (ACCEPT, DROP or REJECT), a "Protocol" (TCP, UDP or TCP+UDP), a "Port" and an optional "Source". The port accepts a single value (22), a list (80,443) or a range (8000-9000), up to 15 ports per rule, a range counting as two.

The "Input policy" in the options applies to everything no rule has accepted. With DROP, only allowed ports stay reachable: it is the safest setting, provided port 22 was allowed first.

Check that everything works

From an outside machine, test a TCP port with nc -vz IP PORT. A successful connection confirms it is open, Connection refused means nothing is listening, and a timeout points to filtering. For UDP, this test is not reliable: try with the application client.

Frequently asked questions

I enabled the panel firewall and SSH no longer answers, how do I roll back?

The DROP input policy blocks port 22 because no rule allows it. The panel does not go through SSH: add an ACCEPT TCP rule on port 22 in "Firewall", or temporarily turn off "Firewall enabled" in "Firewall options", then reconnect.

The port is allowed everywhere but I get Connection refused, why?

The packet arrives, but no program is listening on that address. If ss -tlnp shows 127.0.0.1:3000, the application only accepts local connections: configure it to listen on 0.0.0.0, or put a reverse proxy in front of it.

The panel rejects the rule with Port invalide, what should I fix?

The input does not match the expected format: a port between 0 and 65535, values separated by commas, a range whose first value is the smaller one, and 15 ports at most. Split a long list into several rules.

Why is a Docker port still reachable while UFW blocks it?

Docker adds its own iptables rules for published ports, ahead of the UFW ones. Publish the port on 127.0.0.1:8080:80 if it should only serve locally behind a proxy, or filter it with the panel firewall, which acts before the VM.