KIKOMONO

HOSTING GUIDE

New VPS firewall check: close every port your site does not use

Webmaster Toolbox

A new VPS should start closed and open only on purpose: SSH for administration, HTTP and HTTPS for the site, and nothing else unless a service you actually run needs it. Check both firewall layers, not just one screen, and never lock yourself out while fixing the rules — keep your current SSH session open and test a new one before you close the old.

New VPS firewall check: Check both firewall layers; Open SSH, HTTP and HTTPS only; Databases stay off the public internet; Test a new session before closing the old one

The short answer

A firewall rule decides whether a port answers the internet. Most new servers have two of them in front of every port: the provider's cloud firewall, set in the hosting panel, and the firewall running on the server itself, such as UFW, firewalld, or iptables rules. A port is reachable only when both layers allow it — so a port the panel shows as closed can still be open if the other layer allows it, and a port the server allows can still be closed by the panel. Checking one layer and assuming the other matches is the most common way this check fails.

Do not assume a fresh server ships closed. Defaults differ between providers and images: one image may start with only SSH open, another may leave a control panel or a database reachable. The check below takes minutes, costs nothing, and belongs in the same first-week routine as our IP blocklist check and backup restore test — cheap before launch, expensive after, because an open port found by a scanner is found by everyone.

1. List what is actually listening

Start on the server, not in the panel. The listening list is the truth about which services are waiting for connections, whether or not anyone wrote a firewall rule for them:

Do this before installing extra software, so the baseline is clean, and again after each install. A panel or an application installed later can add a listening service you never asked the firewall about.

2. Decide the shortlist: what stays open

For a typical small site, the open list is short. Everything not on it should be closed or bound to localhost:

PortServicePublic or not
22 (SSH)Server administrationOpen, but limited to your addresses if the panel allows it
80 (HTTP)Web traffic, and redirects to HTTPSOpen
443 (HTTPS)Encrypted web trafficOpen
Database portsMySQL, PostgreSQL, Redis and similarNever public — localhost or private network only
Control panel portHosting panel, if you use oneOnly from your own address, never from everywhere
Everything elseAnything you did not deliberately publishClosed

Two entries deserve emphasis. A database port open to the internet invites automated password guessing against your data, and a guessed database password costs you the data, not just a defaced page. And a control panel reachable from everywhere is a login page offered to the whole internet; if you use one, restrict it to your own address in the provider's firewall, even if the panel itself also asks for a password.

Mail ports are the exception that proves the rule: only open them if this server actually sends or receives mail, and only the ones your mail setup uses. Our blocklist guide covers the reputation side of that decision; this check covers only whether the port should answer at all.

3. Check both layers, then test from outside

With the listening list in hand, check each layer in turn:

  1. Provider cloud firewall. In the hosting panel, read the firewall or security-group rules attached to this server, not just the account defaults. Confirm that only the shortlist is allowed in, and that any panel or database rule is restricted to your address. A rule attached to a different server, or an account-level default you assumed applied, does not protect this one.
  2. Server firewall. Check the on-server firewall's active rules with the tool your image uses — UFW, firewalld, or iptables — and confirm they match the same shortlist. If the server has no firewall running at all, the provider layer is your only layer, and that is a fact to fix rather than assume away.
  3. Test from outside. From your own machine, try to reach each port that should be closed and each port that should be open. A closed port should not answer; an open port should answer only for the services on the shortlist. Test only a server you own or are authorised to test — never scan someone else's server to practise.

If the inside list and the outside test disagree — a port listens but does not answer, or answers though you thought it closed — believe the outside test for reachability and the inside list for the cause. A listening service behind a closed firewall is safe but still worth knowing about; a service you thought closed that answers from outside is the fix to make now.

4. Close it without locking yourself out

The one way this check hurts you is a firewall change that cuts off your own SSH session with no way back. Avoid it with a fixed order:

  1. Keep your current SSH session open. Do not close it while you edit rules. It is your way back in if a new rule is wrong.
  2. Add the allow rule for SSH before you add any deny rule. The allow for your administration access goes in first, and only then the rules that close the rest.
  3. Open a second, new SSH session and confirm it connects. Only when the new session works is the change proven safe.
  4. Then close the old session. If the new session fails, the old one is still there to fix the rule — that is the whole point of the order.

If you do lock yourself out, the recovery route is the provider's console access — the browser-based terminal in the hosting panel, which does not go through the firewall. Know where that console is before you need it; finding it during a lockout, while stressed, is the wrong time to learn the panel. And note the refund-window angle: if a provider image ships with ports exposed that you did not ask for, that is worth raising with support inside the window our refund window guide explains how to find, before the server accumulates data that makes a rebuild painful.

5. Recheck after every change

A firewall is a snapshot, not a permanent state. Recheck — inside list plus outside test — after every install, every panel added, every application deployed, and every rule edited by hand. A single recheck after a change costs minutes; a port opened by an install and left open for months costs whatever the first scanner to find it decides to try.

Keep the record short: the date, the listening list, and the outside result. When something later goes wrong — a service unreachable, a login attempt from an odd address — that record tells you what changed since the last known-good state, instead of leaving you to guess from a panel you have not looked at since launch day.

What not to do

Do not move SSH to an unusual port and call the server secured, and do not scan servers you do not own. A moved SSH port only quiets the log noise; key-only login and a restricted firewall rule are the actual protection. And a port scan is a probe: run it only against your own server, where the outside test belongs.

Do not leave a database or a panel open "temporarily" while you set things up and plan to close it later. Temporary openings are the ones that get forgotten, and a scanner does not know your intentions — it only knows the port answered. Open a port when the service that needs it is ready, not before, and close it the day that service stops needing it.

Checked 2026-11-04. Firewall tools, panel layouts, and provider defaults differ and change; confirm the rule locations on your own provider's and image's documentation before you act on a result.

← All guides · How we verify offers

Frequently asked questions

If the provider panel says a port is closed, can it still be reachable?

Yes, if another layer allows it — or no, if either layer blocks it: a port is reachable only when every layer in front of it allows it. That is why this check covers both the provider's cloud firewall and the firewall on the server itself, instead of trusting one screen.

Does moving SSH off port 22 make a server secure?

No. Moving the port only reduces the noise in the logs from automated scans. Real SSH security comes from key-only login, a firewall rule that limits who can reach the port, and keeping the software updated. Treat a moved port as tidiness, not as protection.

Why must a database port never be open to the public internet?

Because an open database port invites automated password guessing against your data, and a guessed password gives the attacker the data itself, not just a web page. A database should listen on localhost or a private network only, and be reached through the application or over SSH, never directly from the internet.

Can I check my firewall without installing a port scanner?

Yes, for your own server. List what is listening on the server itself, then test from outside whether those ports answer. That pair — inside list plus outside test — is the whole check, and you should only ever scan a server you own or are authorised to test.

How often should I recheck the firewall after the first check?

After every change that can open a port: a new service installed, a control panel added, an application deployed, or a rule edited by hand. A firewall is a snapshot of the day you checked it, and a later install can quietly add a listening service behind it.