Skip to content

Firewall Rules ​

Overview ​

FlashPanel allows you to manage your server's firewall (UFW) from the Security > Firewall menu on the server management page. You can create, duplicate, and delete firewall rules to control which incoming and outgoing traffic is allowed or blocked on your server.

Firewalls are used to open or close ports on your server to the Internet. For example, when using FTP, you may need to open port 21. For added security, you can restrict opened ports to specific IP addresses or subnets.

Service Status & Controls ​

At the top of the Firewall Rules page, the page displays the current status of the firewall:

  • Active (green badge): The firewall is enabled.
  • Inactive (grey badge): The firewall is disabled.

Next to the status badge, the following buttons are available:

  • Config: View the UFW configuration file (/etc/ufw/ufw.conf).
  • Log: View the UFW log file (/var/log/ufw.log).
  • Disable Firewall (only while the firewall is enabled): Turns the firewall off after you confirm. Your rules are kept, and the firewall stays off after the server restarts.

Servers With a Firewall Outside UFW

Some images ship iptables rules that block all incoming connections, for example Oracle Cloud's Ubuntu images only allow port 22. On these servers, disabling UFW would also block the SSH and Agent ports and disconnect FlashPanel. FlashPanel therefore leaves the firewall enabled and reports the blocking rule in the event.

Enable the Firewall Again ​

While the firewall is disabled, the page shows a yellow warning: every port on the server is open and the rules table is empty. Your rules are kept.

  1. Click Enable Firewall in the warning.
  2. Before enabling, FlashPanel allows the SSH port and the FlashPanel Agent port (2022) if no rule allows them yet, so it stays connected to your server. Rules you restricted to specific IPs for these ports are kept as they are.
  3. Once enabled, your rules take effect again and appear in the table.

Firewall Rules List ​

The rules table displays all firewall rules, by default in the order the firewall applies them, with the following columns:

ColumnDescription
#Order of evaluation. The firewall uses the first rule that matches the traffic. This number is always the rule's real position and does not change when you sort or filter.
TypeRule type and direction, shown as a color-coded badge (e.g. ALLOW IN, DENY OUT, LIMIT IN). Rules bound to a network interface also show its name (e.g. eth0); rules with logging show a document icon, hover it to see the logging mode.
SourceSource IP address and port, or Anywhere when unrestricted. Click a value to copy it.
DestinationDestination port and IP address (or Anywhere), with the rule's comment right below. Click a value to copy it.
ProtocolThe protocol the rule applies to (TCP, UDP, or TCP & UDP when not specified).
(last)Buttons to duplicate or delete the rule.

Click a column header to sort (the Destination column sorts by port number). Above the table you will find:

  • Search: matches the port, IP address, comment, type, protocol or network interface.
  • Type (Allow, Deny, Reject, Limit), Direction (Inbound, Outbound) and Protocol (TCP only, UDP only, Both) filters, each option showing how many rules it matches.
  • Clear filters: shown while searching or filtering, click it to show every rule again.

Rule Type Colors ​

  • Allow (green): Permits traffic matching the rule.
  • Deny (red): Blocks traffic matching the rule.
  • Reject (orange): Blocks traffic and sends a rejection response to the source.
  • Limit (blue): Allows traffic but rate-limits connection attempts (useful for SSH brute-force protection).

Add a Firewall Rule ​

  1. On the Firewall Rules page, click the Add Firewall button. The button is disabled while the firewall is disabled: enable the firewall first (see Enable the Firewall Again).

  2. In the New Firewall Rule dialog, configure the following:

    • Rule Type: Choose one of:

      • Allow — permit traffic
      • Deny — block traffic silently
      • Reject — block traffic and notify the source
      • Limit — permit traffic but rate-limit repeated connection attempts
    • Direction: Select Inbound (incoming traffic) or Outbound (outgoing traffic).

    • Port: Enter the destination port. You can:

      • Type a single port (e.g. 22, 3306).
      • Type a port range using a colon (e.g. 8000:8010).
      • Select a known port from the dropdown list (e.g. 22 - SSH, 80 - HTTP).
    • Source IP Address (optional): Restrict the source to a specific IP address or subnet (e.g. 1.2.3.4 or 1.2.3.4/16). Leave blank for "any".

    • Advanced (collapsed by default, click to expand):

      • Source Port (optional): Restrict the source port. Leave blank for "any".
      • Destination IP Address (optional): Restrict the destination to a specific IP address. Leave blank for "any".
    • Comment (optional): Add a label to help you identify the rule (e.g. SSH, MySQL).

    • Protocol: Defaults to TCP only, which fits most services (web, databases, applications). Choose UDP only or Both (TCP & UDP) for DNS, VPN or game servers.

    • Logging: Choose whether traffic matching this rule is written to /var/log/ufw.log:

      • Do not log: nothing is logged.
      • New connections only: one line for each new connection that matches the rule.
      • Every packet: every packet that matches the rule is logged. Avoid this on busy ports such as 80 or 443, because the log can fill up the disk quickly.
  3. Click Add Firewall to create the rule.

Rule Order

New rules are always added to the end of the list, and the firewall applies the first rule that matches the traffic. So if an Allow rule already exists for a port, a Deny or Reject rule added later for the same port may have no effect. Delete the matching Allow rule before adding the blocking rule.

Duplicate a Rule ​

To quickly create a new rule based on an existing one:

  1. In the rules table, click the duplicate icon (two overlapping squares) next to the rule you want to clone.
  2. The New Firewall Rule dialog opens with all fields pre-filled from the selected rule.
  3. Adjust any fields as needed, then click Add Firewall to create the new rule.

Delete a Rule ​

  1. In the rules table, click the trash icon next to the rule you want to remove.
  2. The Delete Firewall Rule dialog appears with the message "Are you sure you want to remove?".
  3. Click Confirm to permanently delete the rule.

Deleting the SSH or Agent Port Rule

When you delete a rule that allows the SSH port FlashPanel uses to connect, or the FlashPanel Agent port (2022), the dialog explains the consequences and asks you to type the port number to confirm. If no other rule allows that port, FlashPanel loses its connection to your server and cannot reopen it from the panel; you would have to open your VPS provider's console and run ufw allow <port>.

Default Firewall Rules ​

When a server is provisioned, FlashPanel automatically configures 3 rules:

  • SSH: Allows inbound TCP access to the server's SSH port (22 by default) from any IP address
  • HTTP: Allows inbound TCP access to port 80 from any IP address
  • HTTPS: Allows inbound access to port 443 from any IP address, over both TCP and UDP (UDP is used by HTTP/3)

Never Remove the SSH Rule

Although the SSH port is open to any IP address, by default the server only accepts SSH connections that use SSH Keys. Therefore, attackers cannot brute-force a password to log in to your server over SSH.

You should never remove the rule that allows SSH access to your server; otherwise, FlashPanel will not be able to connect to or manage your server.

Recovering a Deleted SSH Rule ​

If you have removed the firewall rule for the SSH port (22 by default) from the FlashPanel interface or directly on the server, FlashPanel will not be able to connect to the server and will not be able to recreate this rule for you.

To fix this, you will need to access the server directly through your provider's console (e.g. DigitalOcean, AWS, Linode) and manually re-add the SSH port.

FlashPanel uses ufw for the firewall, so once you are connected to the server, run the following as root (replace 22 with your SSH port if you changed it):

bash
ufw allow 22

Notes & Warnings ​

  • Note: The rules list is read directly from the server. ufw rules added manually on the server (outside of FlashPanel) also appear once you reload the page.
  • Warning: Stopping the UFW service will disable all firewall rules. Your server will be fully exposed to the Internet until the service is restarted.
  • Tip: Use the Limit rule type instead of Allow for the SSH port to protect against brute-force attacks.