firewall
Install and configure the server firewall (firewalld or UFW) with GoAdmio's default open ports, and start, stop, or reset it
- Command:
/go/firewall - Category: Security
- Required arguments: None. With no argument it installs and configures the firewall.
- Optional argument:
[start|stop|reset] - Output: The package manager's and the firewall's output
- Last updated: 2026-11-19
On this page: Overview · Quick start · Syntax · Arguments · Output · Open ports · Examples · Troubleshooting · Details · See also
Overview
/go/firewall sets up the firewall that GoAdmio expects and can switch it on and off. It supports:
- firewalld on AlmaLinux, Rocky, CentOS, Red Hat, and Fedora
- UFW on Debian and Ubuntu
It has four forms: installing and configuring (the default), starting, stopping, and resetting.
[!WARNING] Any word other than
start,stop, orresetruns the full install. On Debian and Ubuntu that purges UFW and all its rules first. See Syntax.
Quick start
# Install and configure the firewall with the default open ports
/go/firewall
# Switch it off and on
/go/firewall stop
/go/firewall start
Syntax
/go/firewall [start|stop|reset]
| Form | Behavior |
|---|---|
/go/firewall |
Installs the firewall, opens GoAdmio's default ports, and starts it. |
/go/firewall start |
Starts the firewall and Fail2ban. |
/go/firewall stop |
Stops the firewall and Fail2ban. |
/go/firewall reset |
Resets the firewall to its defaults, removes the block records, reinstalls the default rules, then runs waf with reset. |
[!WARNING] There is no check on the argument. A typo or another word, such as
restart,status, orenable, runs the full install. On Debian and Ubuntu that removes every rule you added, including blocked IPs.
[!WARNING]
stopalso stops Fail2ban, and the server stays unprotected until you runstart.
Arguments
| Argument | Required | Default | Notes |
|---|---|---|---|
[start|stop|reset] |
No | Install and configure | Any other value is treated as no argument. |
Settings read from the panel
| Setting | Default | Effect |
|---|---|---|
RemoteMariaDB |
0 |
If 1, opens the MySQL service and port 3306. |
SSHPort |
22 |
If not 22, opens that port as well. |
Output
| Outcome | What you get |
|---|---|
start or stop |
Nothing is printed. The exit code is 1, even on success. |
Install or reset |
Installing Firewall, then the output of dnf or apt and of firewall-cmd or ufw. |
| Unsupported operating system | Unknown operating system. and exit code 1. |
Logging
Every run is appended to /var/log/go/firewall.log.
Open ports
The install adds the following rules to the public zone (firewalld) or to UFW. Rules are not limited to particular source addresses.
| Group | Ports and services |
|---|---|
| SSH | 22, and the SSH port from the panel if it is different |
| Web | 80, 443, and 8443 (firewalld only) |
25, 26 (firewalld only), 465, 587, 110, 995, 143, 993 |
|
| FTP | 20, 21, passive 30000-31000, and 990 (UFW only) |
| DNS | 53 TCP and UDP |
| Databases and cache | PostgreSQL (the postgresql service), 11211 (Memcached); 3306 and the MySQL service only if RemoteMariaDB is 1 |
| VPN and remote access | 1194 TCP and UDP (OpenVPN), 3389 (RDP), 1883 (MQTT), 1080 |
| GoAdmio | 2020 to 2027, including the panel on 2020 and webmail on 2024 |
| MinIO | 3333, 3334 |
Services: ssh, http, https, postgresql, ftp, smtp, smtps (firewalld), pop3, pop3s, imap, imaps. UFW also uses the profiles Nginx HTTP, Postfix, and OpenSSH.
TCP ports: 20, 21, 22, 25, 26 (firewalld), 33, 44, 53, 80, 110, 143, 443, 465, 587, 993, 995, 1080, 1194, 1883, 2000-2005, 2020-2027, 2030, 2080, 2082, 2083, 2086, 2087, 2095, 2096, 2222, 3333, 3334, 3389, 4433, 4444, 4567, 4568, 5432 (through the postgresql service), 8005, 8070, 8080, 8443 (firewalld), 8891, 8893, 9090, 10040, 11211, 22222, 30000-31000, and 990 (UFW)
UDP ports: 53, 1194
The script does not say what 33, 44, 4433, 4444, 4567, 4568, 8005, 8070, 8080, 8891, 8893, 9090, 10040, and 22222 are used for. Several of the others (2082, 2083, 2086, 2087, 2095, 2096, 2222) are the ports of other hosting panels.
A port being open does not mean the service is running. Services that aren't installed simply don't answer.
Examples
# Install and configure the firewall
/go/firewall
# Stop it for a migration, then start it again
/go/firewall stop
/go/firewall start
# Reset to the defaults and rebuild
/go/firewall reset
# Open one more port afterwards
/go/allow 8081
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Locked out of SSH | A custom SSH port is not set in the panel, so it wasn't opened. On Debian and Ubuntu, the firewall is also removed and reinstalled during a run. | Use the provider's console, run allow for the port, or set the port in the panel and run /go/firewall. |
| Blocked IPs and custom rules disappeared | On Debian and Ubuntu, every run purges UFW. reset removes them on every system. |
Block the IPs again with block, and add custom rules with allow. |
Running /go/firewall restart reinstalled everything |
Only start, stop, and reset are recognized. |
Use start or stop. |
| A needed port is closed | It isn't in the default list. | Open it with allow. On Debian and Ubuntu, rules added by hand are removed the next time /go/firewall runs. |
| Fail2ban stopped too | stop stops both the firewall and Fail2ban. |
Run /go/firewall start. |
| Remote MariaDB isn't reachable | RemoteMariaDB is not 1 in the panel. |
Enable remote MariaDB in the panel, then run /go/firewall. |
| PostgreSQL is reachable from the internet | The postgresql service is always opened. |
See Notes for maintainers. |
Could not find a profile matching 'Nginx HTTP' |
The Nginx profile exists only when Nginx is installed. | Usually harmless, because other HTTP rules are added too. |
Bad port '0' or a similar error |
The SSH port setting is 0. |
Set the SSH port in the panel, or use 22. |
Exit code 1 after start or stop |
By design. | Ignore the exit code for those forms. |
Details
What it does
- Logs the call, then loads the helper file
/go/function(it sets the operating system name and theProgressBarfunction). - Reads
RemoteMariaDBandSSHPortfrom the panel configuration. - For
startorstop: runssystemctl <start|stop>for the firewall (firewalldorufw) and forfail2ban, hides the output, and exits with code1. - For
reset: deletes/var/log/go/block/*, resets the firewall (firewall-cmd --reset-to-defaultsorufw reset), and reloads it. - Installs and configures the firewall (this step also runs for
reset):- firewalld: installs
firewalld, starts and enables it, adds the services and ports as permanent rules, and reloads. - UFW: purges
ufw, installs it again, adds the rules, starts and enables it, and runsufw --force enable.
- firewalld: installs
- For
reset: runswafwithreset.
flowchart TD
A["firewall action"] --> B{"Action"}
B -- "start or stop" --> S["systemctl on firewall and fail2ban, exit 1"]
B -- "reset" --> R["Remove block records, reset firewall"]
B -- "anything else or none" --> I["Install and configure"]
R --> I
I --> W{"reset?"}
W -- "Yes" --> WR["waf reset"]
W -- "No" --> Done["Done"]
WR --> Done
Differences between the systems
| firewalld (RPM systems) | UFW (Debian and Ubuntu) | |
|---|---|---|
| Existing rules on a normal run | Kept; new rules are added. | Removed, because UFW is purged first. |
| Extra ports | 26, 8443 |
990 |
| Rule storage | Permanent rules in the public zone |
UFW rules |
Notes for maintainers
| Issue | Why it matters | Suggested fix |
|---|---|---|
| Any unrecognized argument runs the full install | A typo reinstalls the firewall, and on Debian and Ubuntu purges all rules. | Accept only start, stop, reset, and an explicit install, and print usage otherwise. |
| UFW is purged on every normal run | Blocked IPs and custom rules vanish, and the server has no firewall while it runs. | Don't purge. Add rules idempotently. |
| About 70 ports are opened to everyone, whether or not the service is installed | Larger attack surface than needed. | Open ports for installed services only, and restrict admin ports by source address. |
postgresql is always open, while MariaDB depends on RemoteMariaDB |
The database is exposed to the internet by default. | Add a RemotePostgreSQL setting, and open the port only when it is on. |
Port 11211 (Memcached) is open |
If Memcached is ever bound to a public address, it can be abused for attacks. | Close it. Memcached is meant to listen on localhost only. |
3389, 1883, 1080, and 1194 are open by default |
Remote access and VPN ports that most servers don't use. | Open them only when the matching service is installed. |
| The firewalld and UFW lists differ | 26 and 8443 open on one system only, and 990 on the other. |
Build both from one list. |
SSHPort becomes 0 when the row is missing |
$(($(sqlite3 ...))) turns an empty result into 0, and the default of 22 is not used. |
Check for a value greater than 0, and default to 22. |
start and stop exit with 1 and hide errors |
Callers can't tell success from failure. | Exit 0 on success, and print failures. |
stop also stops Fail2ban |
The server is open to brute-force attacks while stopped. | Add a separate option, or restart Fail2ban at the end of migrations. |
reset removes the rules before the SSH rule is added again |
A failure in between can lock you out. | Add the SSH rule first, and reset last. |
reset also deletes /var/log/go/block/* and runs waf reset |
Side effects that this command doesn't announce. | Document them, or ask for confirmation. |
AccountID and APIToken (Cloudflare) are read but never used |
A secret is loaded for no reason. | Remove them. |
The public zone is hard-coded |
If the network interface is in another zone, the rules don't apply. | Use the default zone. |
yes | ufw reset has no sudo, and there is no root check |
Fails when not run as root. | Re-run through sudo at the top. |
Services and ports are duplicated (http and 80/tcp, ssh and 22/tcp, ftp and 20/21) |
Noise and a long script. | Loop over a list. |
| No check of the final rules | The result isn't confirmed. | Run checkfirewall at the end, or print the active rules. |
See also
| Command | Description |
|---|---|
allow |
Open a port in your server's firewall |
deny |
Block incoming traffic on a TCP port |
checkfirewall |
Verify that important required ports are open on your server |
block |
Block an IP address on a GoAdmio server |
unblock |
Unblock an IP address on a GoAdmio server |
fail2ban |
Install and configure Fail2ban to ban brute-force sources |
waf |
Block IPs via Cloudflare WAF |
port |
Change the default SSH port (22) to another port |