GoAdmio

checkfirewall

Check that ports 80, 443, 21, and 22 are open in the server firewall, and if any is closed, reinstall the firewall and alert the administrator by email and WhatsApp

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/checkfirewall makes sure the firewall has not been left blocking the ports that a GoAdmio server needs. It:

Ports checked

Port Used for
80/tcp HTTP
443/tcp HTTPS
21/tcp FTP
22/tcp SSH

Other ports, such as mail ports or the panel ports, are not checked.

Supported systems

Operating system Firewall
AlmaLinux, Rocky, CentOS, Red Hat, Fedora firewalld
Debian, Ubuntu UFW

On any other system, the command does nothing.


Quick start

/go/checkfirewall

Syntax

/go/checkfirewall

The command takes no options or arguments. Run it as root.


Options

None. Any arguments you pass are ignored.


Output

The command prints nothing when all four ports are allowed. Otherwise it prints one line for each missing port:

Port 443 is not allowed in UFW.

On firewalld systems the line ends with in FIREWALLD. instead.

Message Meaning
Port <n> is not allowed in UFW. or ... in FIREWALLD. The port is not in the firewall rules. The firewall is reinstalled and the administrator is alerted.
UFW is not active. UFW is turned off. The command stops, and nothing is repaired or sent.
FIREWALLD is not active. firewalld is not running. The command stops, and nothing is repaired or sent.

Each run also adds a line to /var/log/go/checkfirewall.log.

Alert

When a port is missing, the administrator receives a message titled Firewall Checker that lists each missing port, for example:

- Port 443 is not allowed in UFW.

It is sent by email and by WhatsApp. The message lists the problems found before the firewall was reinstalled. The command does not check the ports again afterwards.


Examples

# Check the firewall
/go/checkfirewall
# See the rules the command looks at (Ubuntu/Debian)
ufw status
# See the rules the command looks at (AlmaLinux/Rocky/CentOS)
firewall-cmd --list-ports
# Open a port by hand with an explicit protocol
ufw allow 443/tcp

Troubleshooting

Symptom Likely cause Fix
Nothing is printed All four ports were found in the rules, or the operating system is not supported. Nothing to do.
UFW is not active. or FIREWALLD is not active. The firewall is turned off. With no firewall, ports are not blocked by it. Install and start the firewall with firewall.
A port is reported as closed, but it works The rule does not look like <port>/tcp. For UFW, ufw allow 80 is listed as 80, not 80/tcp. For firewalld, a port opened as a service (such as http) is not in the port list, and ranges and other zones are not checked. Add an explicit rule such as ufw allow 80/tcp, or use allow.
A port is reported as open, but it is not The check matches part of the text, so 8080/tcp counts as 80/tcp, and 8443/tcp counts as 443/tcp. Check the rules by hand.
The same alert arrives on every run The rule is still missing after the firewall is reinstalled. Open the port by hand, and check the rules again.
No email or WhatsApp message arrives The administrator's email, mobile number, or WhatsApp settings are missing in GoAdmio. Check them with config and email.
An error from ufw or firewall-cmd The command was run without root. Run it as root.

Details

What it does, in order

  1. Logs the run to /var/log/go/checkfirewall.log.
  2. Reads the operating system name.
  3. If the firewall for that system is not active, prints a message and stops.
  4. Looks for 80/tcp, 443/tcp, 21/tcp, and 22/tcp in the firewall rules. For UFW, the rule must also show ALLOW.
  5. If any port is missing, runs firewall, then sends the alert by email and WhatsApp.

Known issues


See also

Command Description
firewall Install a firewall on a GoAdmio server
allow Open a port in your server's firewall
deny Block incoming traffic on a TCP port
checkimap Check the IMAP port and SSL certificate
checksmtp Check the SMTP port and SSL certificate
email Change the server's main GoAdmio contact email