How to configure the server firewall and open ports
The firewall decides which ports of the server can be reached from the internet. With port filtering on, everything that is not listed is dropped. It is turned on when the panel is installed.
Steps
- In the administrator panel (
https://<server>:2087), open Firewall (section Security). The heading shows Active or Port filtering off. - Tick Enable port filtering (drop everything not listed below).
- Open TCP ports — comma separated, ranges like
30000-30100. Ports22(SSH) and2087(admin panel) must always stay in the list. - Open UDP ports — for example
53,443. - Optional: tick Block brute-force attackers at the firewall (all services), not only at the login page. It is on by default.
- Click Save & apply and confirm.
- A yellow box says Confirm the new rules. If the page still loads, click Keep these rules within 90 seconds.
If you do not confirm, the previous rules come back by themselves. See firewall changes were rolled back.
The default ports
| Port | Service |
|---|---|
| 21, 30000–30049 | FTP (and its data ports) |
| 22 | SSH and SFTP (a different SSH port of the server is added at installation) |
| 25, 465, 587 | Mail delivery and sending |
| 53 (TCP and UDP) | DNS |
| 80, 443 (and UDP 443) | Websites |
| 110, 143, 993, 995 | POP3 and IMAP |
| 2083 | Control panel |
| 2087 | Admin panel |
| 2096 | Webmail |
| 2097 | Database tool |
Good to know
- Your own address is added to the allow list when you turn port filtering on, so you keep access.
- Allowed addresses reach every port, even those not in the list. Blocked addresses are blocked even with port filtering off.
- Remote MySQL: addresses customers allow in Remote MySQL get port
3306automatically. Do not open 3306 for everyone. - Ping (ICMP) is answered, with a rate limit.
- Other firewall tables on the server (for example fail2ban's) are not touched. The panel's rules are in
/etc/sahaab/firewall/sahaab.nft. - Every change is checked before it is applied; a ruleset with an error is refused and nothing changes.
Common questions
I added a port but the service is still unreachable.
Check that you clicked Keep these rules, that the service is running and listening on that port, and that your hosting provider's own network firewall (outside the server) allows the port too.
It says "TCP port 22 must stay open (SSH / admin panel access)."
Ports 22 and 2087 cannot be removed, so you always keep a way in. Put them back in Open TCP ports.
Can I close FTP if nobody uses it?
Yes. Remove 21 and 30000-30049 from Open TCP ports and save. SFTP keeps working on the SSH port.
Thank you — this helps us improve the article.
Still stuck?
Ask the AI about your exact situation — it answers from this knowledge base — or contact us.
Related articles
- How to block or allow an IP address in the firewall
Block an attacker's IP address or range on the whole server, or always allow a trusted address such as a billing server, permanently or for a set time.
- Firewall change was rolled back or locked you out
Why firewall changes come back after 90 seconds, how to confirm them with Keep these rules, and what to do if a firewall change cut off your access.
- How to block known attackers with public IP blocklists
Turn on public lists of attackers, spammers and botnets (Spamhaus DROP, blocklist.de, CINS Army, abuse.ch Feodo) so they are blocked before any service.
- SSH and email login bans (fail2ban): view and unban
How fail2ban bans addresses after failed SSH, IMAP, POP3, SMTP and FTP logins, the ban limits, and how to see and lift bans in the admin panel.