FastPanel for administrators: firewall

This article is for the server administrator (user fastuser). The client login does not show these sections — if you need such a setting, contact support.

The firewall decides from which addresses and to which ports connections to the server are allowed. It is used to close the panel, SSH and databases to outsiders while keeping sites and email open.

"Management" → "Firewall". The list shows your rules: name, range of ports, protocol, type and policy. The "Global settings" button opens the general firewall options.

Firewall rules
Firewall rules

Rule fields

FieldWhat to enter
Namea clear name, for example "Panel from office only"
Range of portsone port (8888) or a range with a hyphen (4500-5500)
ProtocolTCP - sites, panel, email, SSH, MySQL; UDP - DNS and some VPNs; ALL - both
TypeINPUT - incoming connections to the server (needed almost always); OUTPUT - outgoing from the server
PolicyACCEPT - allow everyone; DROP - deny everyone; PARTIAL ACCEPT - allow only the listed IPs

Panel 8888 from your IP only

  1. "Firewall" → "New rule".
  2. Name - for example "Panel". Port 8888, TCP, type INPUT.
  3. Policy "PARTIAL ACCEPT" → "My IP" → "Add". Add the other addresses you work from the same way.
  4. "Save".
New rule
New rule

Check the result: from your address the panel opens as before, from another one (for example a phone on mobile data) it does not.

Other common rules

  • MySQL for an external application: port 3306, TCP, PARTIAL ACCEPT - only the IP of that application (remote MySQL access).
  • SSH from your addresses only: port 22, TCP, PARTIAL ACCEPT - if you have a static IP.
  • Close the port of a service you do not use: its port, policy DROP.

Which ports are needed

PortFor
80, 443sites (HTTP and HTTPS)
8888FastPanel
22SSH
21FTP
25, 465, 587email: receiving and sending (SMTP)
110, 995, 143, 993POP3 and IMAP - email programs
53DNS, if this server serves your domains
3306MySQL - open only for specific IPs

Do not close 80 and 443 (sites), 22 (SSH) and 8888 (panel) for your own address. If your IP changes (home internet without a static address, mobile data), a PARTIAL ACCEPT rule for the panel and SSH will lock you out the next time the address changes.

Common mistakes

  • Type OUTPUT instead of INPUT - incoming connections are not restricted, while outgoing ones (for example sending email) may stop working.
  • DROP on port 25 - the server stops receiving email for its domains.
  • Port 3306 open with ACCEPT - bots start guessing database passwords. Use PARTIAL ACCEPT with the addresses you need.

Frequently asked questions

Does the firewall protect against password guessing? No, it only lets addresses through to ports or not. Password guessing is handled by fail2ban, which already runs on the server.

How do I open the panel from a new address if access is restricted? Log in from an allowed address and add the new IP to the rule. That is why you should add all the addresses you work from in advance.