Security 7 min read

Plesk Firewall: Set Rules Without Locking Yourself Out

Most Plesk firewall mistakes happen in the minute after you click Apply. Here is the order of work that keeps your own connection alive.

By BashPilot Team
BashEdge WAF & DDoS protection Stop Layer 7 floods and malicious requests before they reach the app. Explore BashEdge

The Plesk Firewall is simple to switch on and surprisingly easy to get wrong. One rule aimed at the wrong port can close the panel on 8443, cut off SSH or stop mail for every subscription on the server, and you usually find out from the terminal that just froze. The safe approach is mostly about order: know what is listening, save a copy of the rules, change one thing, then test from a machine outside the server.

Find out what the server is exposing

Start on the server with a list of everything that is listening. This takes a few seconds and often turns up something nobody meant to publish, like a database on all interfaces or an old FTP service.

listening TCP and UDP services
sudo ss -tulpn

An address of 0.0.0.0 or [::] means the service accepts connections on every interface. 127.0.0.1 means only the server itself can reach it, so the firewall has nothing to protect there. Compare what you see with the ports Plesk documents and decide who needs each one.

ServicePortWho usually needs it
Plesk panelTCP 8443, UDP 8443, TCP 8880Admins and customers who log in. 8880 is the plain HTTP version
WebsitesTCP 80, TCP 443, UDP 443Everyone
SSHTCP 22Your team, ideally from known addresses
FTPTCP 21Only customers who still use it
SMTPTCP 25, TCP 465Other mail servers and your mail users
POP3 and IMAPTCP 110, 995, 143, 993Mail users, if the server hosts mailboxes
MySQL or MariaDBTCP 3306Often nobody outside the server
PostgreSQLTCP 5432Often nobody outside the server
DNSUDP 53, TCP 53The internet, if this server is authoritative for your domains

The database rows are the usual quick win. Websites on the same machine talk to the database locally, so a public 3306 tends to serve only attackers and the one developer who set it up years ago. Check with that developer before closing it.

Check for a second firewall before you start

Plesk's firewall documentation carries a clear caution: the Plesk Firewall and firewalld both manage iptables, and using them at the same time can close ports Plesk needs. On AlmaLinux and Rocky Linux servers, firewalld is often already there.

is firewalld active?
systemctl is-active firewalld

If that prints active, pick one tool. Copy across any custom rules first, because a rule that only lives in firewalld disappears from your protection when you stop it. Containers need their own check as well. The same Plesk page notes that Docker's firewall rules are not added to the Plesk Firewall rule list, so a published container port will not appear there.

Enable the firewall and back up the rules

  1. 1

    Install the extension

    If Firewall is missing under Tools & Settings, install it from the Plesk Extensions Catalog.

  2. 2

    Open a second SSH session

    Leave it connected for the whole job. If a change goes badly, an established session is your way back in, and it costs nothing to keep open.

  3. 3

    Confirm you have console access

    Find your provider's web or VNC console now and check that it logs in. That is your route back if both SSH sessions die.

  4. 4

    Turn it on

    Go to Tools & Settings, then Firewall under Security, and set Firewall protection to Enabled.

  5. 5

    Export the current rules

    Save a copy off the server too, so a bad change is one import away from being undone.

keep a dated copy of the rules
plesk ext firewall --export > /root/plesk-firewall-$(date +%F).json

Change one service at a time

Plesk separates two ideas. Policies affect all connections to or from the server, and rules govern incoming connections to individual services. Rules override policies, which is what lets you run a strict default and still open specific ports.

To add a custom rule, use the Firewall page and set Match direction to Incoming, choose an Action of Allow or Deny, enter the port such as TCP 3306, and fill in Sources with the address or range it applies to. Save, click Apply Changes, then Apply. Nothing takes effect until that last step.

Limiting SSH or the panel to fixed addresses is one of the strongest changes you can make, and the riskiest if your office IP changes. Keep a backup route, such as a VPN address or a second known IP, in the allowed Sources. Country rules exist as well, using two-letter ISO codes, but they catch real customers who travel or use a VPN, so save them for traffic you can show you do not want.

Restore a working configuration from the command line

This is where the export pays off. Plesk's import process uses two SSH sessions on purpose: one applies the rules, and the other confirms that you can still get in. If no confirmation arrives within 60 seconds of --apply, Plesk rolls back to the previous configuration.

  1. 1

    Session 1: enable the firewall

    Run plesk ext firewall --enable. Skip this step if the firewall is already on.

  2. 2

    Session 2: confirm it

    Check that SSH still works, then run plesk ext firewall --confirm.

  3. 3

    Session 1: import and apply

    Run the import command below.

  4. 4

    Session 2: confirm again

    Open a new login to prove access, then run plesk ext firewall --confirm before the 60 seconds are up.

the import command for step 3
plesk ext firewall --import -config /root/plesk-firewall-2026-11-22.json && plesk ext firewall --apply

Open a brand new SSH connection before you confirm. An existing session can survive a rule that would block the next login, so it proves very little. The exact command-line options vary by extension version, and plesk ext firewall --help lists what yours supports.

Test from outside the server

A rule that looks right in the panel is still a theory. Run the check from a laptop or another server, and from one address that should be allowed and one that should not.

run this from another machine
for p in 22 80 443 8443 3306; do nc -vz -w 5 203.0.113.10 $p; done

Then do the human checks: load a customer site over HTTPS, log in to the panel, and send and receive a test email if the server hosts mail. Mail is the one people forget, and a closed port 25 stays quiet until a customer calls about missing messages.

What the firewall cannot see

Ports 80 and 443 have to stay open, and that is where most attacks on a hosting server arrive. A SQL injection or a flood against wp-login.php looks like permitted traffic to a port rule. Plesk covers part of this with Fail2Ban, found under Tools & Settings, IP Address Banning (Fail2Ban). Add your own addresses on its Trusted IP Addresses tab before you tighten anything. For the request layer, What Is the Best Web Application Firewall for Plesk? explains what to look for, and Plesk Server Under DDoS covers the incident itself.

BashEdge for Plesk picks up where port rules stop. It is a native extension that combines a server firewall, a WAF, application-layer DDoS protection and intrusion prevention, and it keeps your current firewall rules intact. It starts in monitor mode, so you can see what it would do to real traffic before it blocks anything.

Share LinkedIn X
Questions

Frequently asked questions

Where is the firewall in Plesk?

Go to Tools & Settings and open Firewall under Security. If it is missing, install the Firewall extension from the Plesk Extensions Catalog. Turn on the Firewall protection toggle, and remember that rule changes only take effect after you click Apply Changes and then Apply.

Which ports does Plesk need open?

Plesk documents TCP 8443 and 8880 for the panel, 80 and 443 for websites, 22 for SSH, 21 for FTP, 25 and 465 for SMTP, 110, 995, 143 and 993 for POP3 and IMAP, and 53 for DNS. Open only what your server uses. Databases on 3306 and 5432 often need no public access.

Can I use firewalld and the Plesk Firewall together?

Plesk recommends using only one. Both tools manage iptables, and running them at the same time can cause conflicts that close ports Plesk needs to operate. Check with `systemctl is-active firewalld`, move any custom rules into the tool you are keeping, and stop the other.

How do I back up Plesk Firewall rules?

Run `plesk ext firewall --export > rules.json` and keep a copy off the server. To restore, run `plesk ext firewall --import -config rules.json && plesk ext firewall --apply`, then confirm from a second SSH session with `plesk ext firewall --confirm` within 60 seconds, or Plesk rolls the change back.

What should I do if the Plesk Firewall locks me out?

Use any SSH session that is still connected. If none is, log in through your hosting provider's web or VNC console, which does not depend on the firewall rules for port 22. Restore your exported rules from there, then test a new login from outside before you end the session.

Put your servers on autopilot.

Connect a server in about a minute. The first week is on us.