Skip to content

Firewall Rules

This chapter covers MSST-Net firewall rules.

What Are Firewall Rules

Firewall rules control which devices can access which ports and services on your device.

Each rule specifies:

  • Principal: Who can (or cannot) access
  • Protocol and port: Which traffic to allow or deny
  • Action: Allow (allow) or deny (deny)
  • Direction: Inbound (inbound) or outbound (outbound)

Connection Tracking

The MSST-Net firewall has stateful connection tracking.

When your device initiates an outbound connection, the system automatically records the connection state. Return packets from the peer are automatically allowed — no additional rule is needed.

This means:

  • Connections you initiate do not require rules for return traffic
  • Rules only control inbound connections initiated by the peer

Rule Priority

When multiple rules match the same packet, the system uses the first matching rule in this priority order:

  1. Device-level Deny (highest priority)
  2. Device-level Allow
  3. User-level Deny
  4. User-level Allow
  5. Room-level Deny
  6. Room-level Allow (lowest priority)

Device-level rules take priority over user-level rules; user-level rules take priority over room-level rules.


Principal

The principal in a rule specifies which devices, users, or room members the rule applies to.

Principal Types

TypeDescription
DeviceRule applies only to the specified device
UserRule applies to all devices under this user
Room (space)Rule applies to all members currently in the same room as this device

Principal Identifiers

Principals can be specified by:

MethodExampleDescription
Device IDdevice-a7f29b3eExactly match the specified device
User IDuser-1a2b3c4dMatch all devices under this user
Device mnemonicarchlinuxMatch the device with this mnemonic under the current user
Combined mnemonicarchlinux.abjustMatch the specified device under the specified user
User mnemonicabjustMatch all devices under the specified user
Wildcard*Match all devices or all users
Room wildcard (space-*)space-*Match all members in any currently shared room

Room-level (space) rules do not require a specific ID — the system dynamically matches current room members when packets arrive.

For more on identifiers, see:

Identifiers


Protocol and Port

Rules can match specific protocols and ports.

Protocol

Supported protocols:

ValueDescription
tcpTCP traffic only
udpUDP traffic only
tcp+udpBoth TCP and UDP (stored as two separate rules)

Port

Ports can be specified as:

FormatExampleDescription
Single port25565Match only the specified port
Port range8000-9000Match all ports in the range
Wildcard*Match all ports (1–65535)

Common Services

MSST-Net includes built-in presets for common service protocol/port combinations:

Games

ServiceProtocol / Port
Minecraft (Java Edition)tcp/25565
Minecraft (Bedrock Edition)udp/19132
Rusted Warfaretcp/5123
MSST Card Battletcp/9178
Terrariatcp/7777
Factorioudp/34197

Web Services

ServiceProtocol / Port
HTTPtcp/80
HTTPStcp/443
HTTP/3 (QUIC)udp/443

File Services

ServiceProtocol / Port
FTPtcp/21
FTPStcp/990
NFStcp/2049
SMB/CIFStcp/445

Databases

ServiceProtocol / Port
MySQLtcp/3306
PostgreSQLtcp/5432
MongoDBtcp/27017
Redistcp/6379
MSSQLtcp/1433
Oracle DBtcp/1521

Remote Access

ServiceProtocol / Port
SSHtcp/22
RDPtcp/3389
VNCtcp/5900

Action

Each rule's action is one of:

ActionDescription
allowAllow matching packets through
denyDeny matching packets

Direction

Each rule's direction is one of:

DirectionDescription
inboundControl inbound traffic from peers
outboundControl outbound traffic to peers

In most cases, only inbound rules need to be configured.


Expiry

Rules can have an expiry time — they automatically expire and are removed from the list after the set time.

If no expiry is set, the rule is permanent.

Expiry is commonly used for temporary authorization (e.g., temporary rules created via Interactive Authorization).


Rule Matching Flow

When an inbound packet arrives, the system processes it in this order:

  1. Check if it is a return packet for a tracked connection → if so, allow immediately
  2. Iterate through all active rules by priority and find the first match
  3. If a matching rule is found, allow or deny per the rule's action
  4. If no rule matches, trigger Interactive Authorization

See:

Interactive Authorization


Designed by MSST-Net Dev Team, built with Claude Code