/go/block blocks an IP address on the server and, where possible, at Cloudflare. It: It is also the command that sshtop, sasltop, and other GoAdmio monitors call when they find a bad source. Run it yourself to block an IP by hand. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# Block an IP address
/go/block 203.0.113.45
Arguments
| Position | Argument | Required | Default | Notes |
|---|---|---|---|---|
| 1 | <ip> |
Yes | — | An IPv4 address, an IPv4 /24 range written as a.b.c.0/24, or an IPv6 address. |
| 2 | [type] |
No | log |
Why the IP is blocked. It changes the firewall action and the log file’s extension. See Block types. |
| 3 | [country] |
No | — | Saved in the IP’s log file. If the value contains a dot, it is treated as a hosted domain instead. See below. |
| 4 | [company] |
No | — | Saved in the IP’s log file. |
| 5 | [bot-name] |
No | — | Used only when type is bot. Saved in the log file. |
If the third argument contains a dot, GoAdmio looks up that domain’s account username and stores both in the block database. The same value is still written to the log file as Country.
Examples
# Block an IP by hand
/go/block 203.0.113.45
# Block an SSH attacker (dropped at the firewall, no Cloudflare step)
/go/block 203.0.113.45 ssh NL "Example Hosting B.V."
# Block a bad bot and record its name
/go/block 203.0.113.45 bot NL "Example Hosting B.V." "ExampleBot"
# Block a /24 range
/go/block 203.0.113.0/24
# Block an IPv6 address
/go/block 2001:db8::1
# Review the log of past runs
tail -n 20 /var/log/go/block.log
Output
The command prints what it is doing, then a blank line. Messages depend on the firewall and the number of hosted domains.
| Message | Meaning |
|---|---|
Blocking IPv4 <ip> (<country>) [Local]... |
A new IPv4 firewall rule is being added. |
Blocking IPv6 <ip> (<country>) [Local]... |
A new IPv6 firewall rule is being added. |
Blocking IPv4 <ip> (<country>) [Local] (IP Found)... |
A rule for this IP already exists. Nothing is added, and Cloudflare is skipped. |
[<n>/<total>] Blocking IP <ip> (<country>) [<domain>] | <result> |
One line per hosted domain for the Cloudflare step. |
Cloudflare results
| Result | Meaning |
|---|---|
Success. |
The block rule was created in the domain’s Cloudflare zone. |
Already Exists. |
The zone already blocks this IP. |
Failed. |
Cloudflare rejected the request. |
No Zone ID. |
The domain was not found in the configured Cloudflare account. |
Proxy Off. |
The domain points straight at this server, so a Cloudflare rule would not help. |
Proxy Off | Too Many | Break |
More than 5 such domains were found. The Cloudflare step stops. |
Subdomain. |
Only main domains have zones. Subdomains are skipped. |
Exit status
The command exits with status 1, and blocks nothing, in the cases below.
| Message | Cause |
|---|---|
Cannot block server IP address. |
The IP is this server’s own IPv4 or IPv6 address. |
Invalid IP "<ip>" |
The first argument is not a valid IP or range. |
IP <ip> is from whitelisted |
The IP matches an entry in /var/go/etc/white. |
<ip> access whitelisted file (<file>) |
The IP requested a file listed in /var/go/etc/whitefiles. |
IP <ip> (<country>) From Whitelisted Countries (<list>) |
The IP’s country is a whitelisted country. |
Can not Detect a Country Code |
Whitelisted countries are configured, but the IP’s country could not be detected. |
See the full reference at /go/block and the GoAdmio command index.
GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.
