Rules

The Rules tab of the Edge Firewall. How rules are ordered, which rule types and presets exist, and how to add, reorder, switch off and delete a rule.

PlaySafe Team · Firewall Management · Updated

Rules

This page describes the rule editor of the Edge Firewall, the firewall every PlaySafe VPS has (one per VPS). It is the Rules tab of the firewall page.

Open it from Security > Firewalls, click the firewall and open Rules. You also get there from your VPS: Network tab, then Open firewall.


How rules are checked

  • The rules are an ordered list, checked from top to bottom. The first rule that matches a packet decides what happens to it.
  • Traffic that no rule matches reaches the server. The firewall allows by default.
  • There are no priority numbers. The order is the position in the list.
  • A firewall can have up to 50 rules. Rules created by protections count too.

Each rule shows a small XDP or Kernel tag, so you can see where it runs. Almost everything runs in XDP with moat, before the Linux network stack. The SYN proxy is the one that runs in the kernel, right after.


The rule list

Each row shows:

  • The rule name, or its type if it has no name. Rules created by a protection show “From” and the protection name.
  • The XDP or Kernel tag.
  • How many packets the rule dropped (or limited, or allowed) since the firewall started running on moat. Hover the number to see packets, bytes and the date the count started.
  • An on/off switch.
  • A menu with Edit and Delete.

Add a rule

  1. Click Add rule.
  2. Pick a type, or start from a preset (see below).
  3. Fill in the fields. Name is optional.
  4. Save. The rule is applied to the server right away.
TypeWhat it doesFields
PortAllows or drops traffic to a portAction Allow or Drop; protocol TCP and UDP, TCP or UDP; port (one port like 30120, a range like 30120-30130, blank for all ports); optional From address (IPv4 or range) and From port
Country blockDrops traffic from the countries you pickOne or more countries
Country allowOnly the countries you pick can reach the server; everything else is droppedOne or more countries
IP blockDrops addresses or rangesIPv4 addresses or CIDR ranges
IP allowAddresses that always get throughIPv4 addresses or CIDR ranges
Payload matchDrops or allows packets whose payload contains a textAction Drop or Allow; protocol TCP or UDP; port (required); text to match (up to 128 characters); optional From address and From port
TCP flagsDrops SYN+RST, SYN+FIN, FIN+RST, packets with no flags and packets with every flag setNo settings
!

Allowing 0.0.0.0/0

An **IP allow** rule for `0.0.0.0/0` lets everything through, so no rule below it will drop traffic.

Presets

Presets only fill the form. You can change every field before saving.

PresetWhat it fills in
Allow a FiveM serverPort rule, Allow, TCP and UDP 30120
Allow a Minecraft serverPort rule, Allow, TCP 25565
Allow a Rust serverPort rule, Allow, UDP 28015
Allow a CS2 serverPort rule, Allow, UDP 27015
SSH only from one IPAllows port 22 from the address you enter and adds a second rule that drops port 22 for everyone else
Block countriesCountry block
Only allow some countriesCountry allow
Block an IP or rangeIP block
Always allow an IPIP allow

Change the order

Drag a rule up or down the list. On phones, use the up and down arrows on the rule. The new order is applied to the server right away.

Put specific rules above broad ones. For example, a rule that allows your own IP must sit above a rule that drops that port or country for everyone else.


Edit, switch off or delete a rule

  • Edit in the rule’s menu opens the same form with the current values.
  • The on/off switch turns a rule off without deleting it. A rule that is off stays in the list but does nothing.
  • Delete in the rule’s menu removes the rule after you confirm.

Locked rules

  • Rules created by a protection show “From” and the protection name and are locked in this list. Manage them from the Protections tab: turn the protection off or change its settings there.
  • Rules managed by PlaySafe staff show a lock. You cannot change or delete them.

Applying changes

Every change is applied to the server right away. While that happens the rule shows Applying and the page shows a banner; once the server confirms, the rule shows as active. If something fails, the panel shows the error and a Try again button. The rules that were already running keep running.

✦

Export before big changes

**Export rules** in the firewall page menu saves your rules to a JSON file you can bring back later with **Import rules**. **Remove all rules** in the same menu deletes every rule; you confirm by typing `PURGE`.

Examples

Only your IP can use SSH

Pick the SSH only from one IP preset and enter your address. You get two rules in this order:

OrderTypeActionProtocolPortFrom address
1PortAllowTCP22203.0.113.10 (your IP)
2PortDropTCP22(any)

A game server for players in a few countries

  1. Add a rule that lets you in, for example SSH only from one IP.
  2. Add a Country allow rule with your players’ countries and keep it below the rules from step 1.

Traffic from every other country is dropped. Do not put an Allow rule for the game port above the Country allow rule: it would match first and let players from every country in.

Drop a known attacker

Add an IP block rule with the address (198.51.100.50) or the range (198.51.100.0/24).


Next steps