Security Architecture Diagram
LightYear firewall groups let you define inbound and outbound traffic rules that are applied at the network level, before traffic reaches your server. This guide explains how to create and manage firewall groups.
Understanding Firewall Groups
A firewall group is a named set of rules that can be attached to one or more servers. Changes to a group apply to all attached servers immediately.
Default behaviour: All inbound traffic is denied unless explicitly allowed. All outbound traffic is allowed by default.
Step 1 — Create a Firewall Group
- Navigate to Networking → Firewall Groups.
- Click Create Firewall Group.
- Enter a descriptive name (e.g.,
web-servers).
Step 2 — Add Inbound Rules
Click Add Rule and configure each rule:
Essential Rules for a Web Server
| Protocol | Port | Source | Description |
|---|---|---|---|
| TCP | 22 | Your IP | SSH access |
| TCP | 80 | Anywhere | HTTP traffic |
| TCP | 443 | Anywhere | HTTPS traffic |
| ICMP | — | Anywhere | Ping/diagnostics |
[!WARNING] Never open port 22 (SSH) to
0.0.0.0/0(anywhere) in production. Restrict SSH access to your office or home IP address to prevent brute-force attacks.
Restrict SSH to a Specific IP
| Protocol | Port | Source | Description |
|---|---|---|---|
| TCP | 22 | 203.0.113.10/32 | SSH from office |
Step 3 — Attach the Firewall Group to a Server
- Navigate to Servers → Your Server → Settings.
- Under Firewall Group, select the group you created.
- Click Save.
The rules take effect within 30 seconds.
Manage Rules via API
List Firewall Groups
$curl https://api.lightyear.host/v1/firewalls \$ -H "Authorization: Bearer YOUR_API_KEY"Add a Rule
$curl -X POST https://api.lightyear.host/v1/firewalls/FIREWALL_ID/rules \$ -H "Authorization: Bearer YOUR_API_KEY" \$ -H "Content-Type: application/json" \$ -d '{$ "ip_type": "v4",$ "action": "accept",$ "protocol": "tcp",$ "port": "443",$ "subnet": "0.0.0.0",$ "subnet_size": 0,$ "notes": "Allow HTTPS from anywhere"$ }'Common Rule Configurations
Database Server (MySQL/PostgreSQL)
Only allow database connections from your application servers:
| Protocol | Port | Source | Description |
|---|---|---|---|
| TCP | 22 | Your IP | SSH |
| TCP | 3306 | 10.0.0.0/24 | MySQL from private network |
Game Server (Minecraft)
| Protocol | Port | Source | Description |
|---|---|---|---|
| TCP | 22 | Your IP | SSH |
| TCP | 25565 | Anywhere | Minecraft Java Edition |
| UDP | 19132 | Anywhere | Minecraft Bedrock Edition |
[!NOTE] LightYear firewall rules are stateful — you do not need to add explicit outbound rules for established connections.
