This guide provides pre-built firewall rule sets for common server configurations. Copy these rules directly into your Data Mammoth cloud firewall rule groups to secure your servers quickly. Each rule set follows the principle of least privilege — allowing only the traffic your services need while blocking everything else.
For instructions on creating and applying firewall rules, see How to Set Up Cloud Firewall Rules.
Web Server (HTTP/HTTPS)
The most common configuration for servers hosting websites or web applications.
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 80 | 0.0.0.0/0 | Allow | HTTP traffic |
| Inbound | TCP | 443 | 0.0.0.0/0 | Allow | HTTPS traffic |
All other inbound traffic is blocked by default deny.
Notes:
- Replace "Your IP/CIDR" with your actual IP address or range (e.g.,
203.0.113.50/32).
- If you use IPv6, add matching rules for your IPv6 addresses.
- Consider allowing ICMP if you use monitoring tools that rely on ping.
Database Server
For servers running MySQL, MariaDB, PostgreSQL, or other databases that should only be accessible from specific application servers.
MySQL / MariaDB
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 3306 | App server IP/CIDR | Allow | MySQL from app server |
PostgreSQL
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 5432 | App server IP/CIDR | Allow | PostgreSQL from app server |
MongoDB
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 27017 | App server IP/CIDR | Allow | MongoDB from app server |
Redis
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 6379 | App server IP/CIDR | Allow | Redis from app server |
Critical: Never expose database ports to the public internet (
0.0.0.0/0). Always restrict access to specific server IPs.
Web Application with Database
For servers that run both a web application and a database on the same machine.
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 80 | 0.0.0.0/0 | Allow | HTTP traffic |
| Inbound | TCP | 443 | 0.0.0.0/0 | Allow | HTTPS traffic |
No database port rule is needed because the database should listen on localhost (127.0.0.1) only when the application is on the same server.
Mail Server
For servers running email services (Postfix, Dovecot, etc.).
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 25 | 0.0.0.0/0 | Allow | SMTP (receiving mail) |
| Inbound | TCP | 465 | 0.0.0.0/0 | Allow | SMTPS (secure SMTP submission) |
| Inbound | TCP | 587 | 0.0.0.0/0 | Allow | SMTP submission (with STARTTLS) |
| Inbound | TCP | 993 | 0.0.0.0/0 | Allow | IMAPS (secure IMAP) |
| Inbound | TCP | 995 | 0.0.0.0/0 | Allow | POP3S (secure POP3) |
| Inbound | TCP | 80 | 0.0.0.0/0 | Allow | HTTP (for webmail, if used) |
| Inbound | TCP | 443 | 0.0.0.0/0 | Allow | HTTPS (for webmail, if used) |
Notes:
- Port 143 (IMAP) and port 110 (POP3) are unencrypted versions. Use the encrypted ports (993 and 995) instead.
- Only include ports 80 and 443 if you run a webmail interface on the same server.
Game Server — Minecraft
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 25565 | 0.0.0.0/0 | Allow | Minecraft Java Edition |
| Inbound | UDP | 19132 | 0.0.0.0/0 | Allow | Minecraft Bedrock Edition |
Add the Bedrock rule only if running a Bedrock server. Add the Java rule only if running a Java server.
Game Server — Generic
For other game servers, identify the specific ports your game needs. Common examples:
| Game | Protocol | Port |
|---|
| Counter-Strike 2 | TCP/UDP | 27015 |
| Valheim | UDP | 2456-2458 |
| Terraria | TCP | 7777 |
| ARK: Survival Evolved | UDP | 7777-7778, 27015 |
| Project Zomboid | UDP | 16261-16262 |
Create rules for SSH (restricted) plus the game-specific ports (open to all or restricted to your player community).
VPN Server
WireGuard
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | UDP | 51820 | 0.0.0.0/0 | Allow | WireGuard VPN |
OpenVPN
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | UDP | 1194 | 0.0.0.0/0 | Allow | OpenVPN |
Docker Host
For servers running Docker with web-facing containers:
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 80 | 0.0.0.0/0 | Allow | HTTP (container services) |
| Inbound | TCP | 443 | 0.0.0.0/0 | Allow | HTTPS (container services) |
Only add rules for ports your containers expose publicly. Internal container-to-container communication does not need firewall rules.
Monitoring / Admin Panel
For servers running monitoring tools (Grafana, Prometheus) or admin panels that should not be public:
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
| Inbound | TCP | 3000 | Your IP/CIDR | Allow | Grafana (restricted) |
| Inbound | TCP | 9090 | Your IP/CIDR | Allow | Prometheus (restricted) |
Never expose monitoring and admin dashboards to the public internet. Always restrict access to trusted IPs.
SSH Only (Management Server)
For servers that should only be accessible via SSH:
| Direction | Protocol | Port | Source | Action | Purpose |
|---|
| Inbound | TCP | 22 | Your IP/CIDR | Allow | SSH access (restricted) |
This is the most restrictive and secure configuration. Use it for servers that do not serve public traffic.
What to Do Next