ddos
Report the busiest IP addresses in the access log and block those that exceed a request limit
- Command:
/go/ddos - Category: Security
- Required option: None
- Output: Plain text table (plus email and WhatsApp alerts when IPs are blocked)
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Arguments · Configuration · Output · Examples · Troubleshooting · Details · See also
Overview
/go/ddos finds the IP addresses sending the most requests to your web server and, if you ask it to, blocks the ones that go over a limit. It:
- counts requests per client IP in the server's access log
- ignores the server's own IPs and any whitelisted IPs
- shows the top 25 IPs with their country, city, and company
- with
block, blocks every IP in that list whose request count reaches the limit (default20000) - emails and sends a WhatsApp message to the administrator when it blocks something
It never blocks IPs belonging to Google, Bing, or Cloudflare (see Protected companies).
Quick start
# Show the top 25 IPs. Nothing is blocked.
/go/ddos
# Show the top 25 IPs and block any that reach the limit
/go/ddos block
Syntax
# Report only
/go/ddos
# Report and block
/go/ddos block
# Look up one IPv4 address
/go/ddos <ipv4>
| Form | Behavior |
|---|---|
/go/ddos |
Reports the top 25 IPs from the access log. Blocks nothing. |
/go/ddos block |
Same report, and blocks IPs that reach the limit. |
/go/ddos <ipv4> |
Looks up one address. It shows country, city, and company. The visit count is always 1, and nothing is blocked. |
Any other first argument is treated like no argument, so it only reports. The command has no -- options.
Arguments
| Argument | Required | Notes |
|---|---|---|
block |
No | Turns on blocking. Also takes the lock so two blocking runs don't overlap. |
<ipv4> |
No | A dotted IPv4 address such as 203.0.113.7. IPv6 addresses are not recognized. |
Configuration
| File | Purpose | Default |
|---|---|---|
/var/go/etc/ddos |
The request limit. A single whole number. | 20000 |
/var/go/etc/white |
Whitelist. IPs here are left out of the report and never blocked. See white. |
None |
# Block IPs that reach 5000 requests
echo 5000 | sudo tee /var/go/etc/ddos
If /var/go/etc/ddos is missing or contains anything other than digits, the limit falls back to 20000.
A whitelist entry is matched as a prefix of the IP, and a * is removed first. So 192.168.1.* covers the whole 192.168.1. range. Only lines that contain a dot are used, so IPv6 entries have no effect here.
Output
The report is a table, sorted by visits, highest first. The example below is illustrative.
IP VISITS COUNTRY CITY COMPANY
-- ------ ------- ---- -------
203.0.113.7 48210 US Ashburn Example Hosting LLC
198.51.100.23 22544 DE Frankfurt Sample Cloud GmbH
192.0.2.88 1310 EG Cairo Example Telecom
| Column | Meaning |
|---|---|
IP |
The client IP address. |
VISITS |
Number of requests from that IP in the access log. |
COUNTRY |
Country of the IP. |
CITY |
City of the IP. |
COMPANY |
Owner of the IP, from a whois lookup. |
Country and city come from a different source depending on how you run the command, so they can differ between a terminal and cron. See Country and city lookup.
When another run is active
Instance (ddos) already running.
The command exits with status 1. See Locking.
Alerts
If at least one IP was blocked in this run, the administrator receives an email and a WhatsApp message titled:
DDoS Attack Mitigated on Your Server (<n> IPs)
The message lists each blocked IP with its visit count, country, and company. IPs that already have a block record are not blocked or reported again.
Examples
# Check who is hitting the server right now, without blocking
/go/ddos
# Look up a suspicious address
/go/ddos 203.0.113.7
# Lower the limit, then block
echo 3000 | sudo tee /var/go/etc/ddos
/go/ddos block
# Example cron entry: check and block every 5 minutes
*/5 * * * * /go/ddos block
Check whether cron has already scheduled this command before adding your own entry.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Instance (ddos) already running. |
Another blocking run updated block.lock in the last 60 seconds. |
Wait a minute and run again. A lock older than 60 seconds is ignored. |
| The report is empty | The access log is empty, or the server could not look up its own public IP (see Own-IP removal), or a whitelist entry matches every IP. | Check the log and /var/go/etc/white. Confirm the server has outbound internet access. |
| An IP over the limit was not blocked | See Why an IP is not blocked. | Check each reason in order. |
| A legitimate crawler or office IP was blocked | Its traffic reached the limit. | Unblock it with unblock, add it with white, or raise the limit. |
| Country and city are blank or differ from the terminal | Cron runs use whois data instead of the geolocation lookup. | Expected. See Country and city lookup. |
| Limit changes have no effect | /var/go/etc/ddos holds something other than a whole number. |
Put only digits in the file. |
| No email or WhatsApp alert | Delivery is handled by the sendmail and sendwhatsapp helpers. |
Check the administrator email, mobile number, and WhatsApp settings in GoAdmio. |
| The command is slow | It runs a whois lookup for each of the 25 IPs and reads every access log file to count total requests. | Run it from cron rather than waiting on it. |
/go/ddos <ip> shows 1 visit |
Single-IP mode only looks up the address. | Use the report to see real counts. |
Details
How it works
flowchart TD
A["ddos [block or ip]"] --> L["Append the call to /var/log/go/ddos.log"]
L --> K{"Action is block?"}
K -- "Yes" --> K1{"block.lock updated in last 60 s?"}
K1 -- "Yes" --> X["Print Instance already running, exit 1"]
K1 -- "No" --> K2["Take the lock"]
K -- "No" --> S
K2 --> S{"Action is an IPv4?"}
S -- "Yes" --> S1["Use only that IP"]
S -- "No" --> S2["Read all client IPs from the access log"]
S1 --> F
S2 --> F["Remove the server's own IPs and whitelisted IPs"]
F --> T["Count requests per IP and keep the top 25"]
T --> E["Look up whois, company, country, and city for each"]
E --> B{"block, over limit, not protected, not already blocked?"}
B -- "Yes" --> B1["Run /go/block and add the IP to the alert"]
B -- "No" --> P
B1 --> P["Print the table"]
P --> N{"Any IP blocked?"}
N -- "Yes" --> N1["Send email and WhatsApp alerts"]
N -- "No" --> R
N1 --> R["Save the total request count to the config database"]
R --> Z["Release the lock"]
Where the IPs come from
The access log is read as pipe-separated fields. For each line the command uses field 4 when it is not -, and field 3 otherwise. Counting ignores letter case.
Own-IP removal
The server looks up its own public IPv4 and IPv6 addresses (through checkip.amazonaws.com and icanhazip.com) and removes any line that starts with either one. Two consequences:
- The match is a prefix match, so an own IP of
1.2.3.4also removes1.2.3.45. - If a lookup returns nothing, for example on a server with no IPv6 connectivity, the removal pattern is empty and can remove every line. The report is then empty and nothing is blocked.
Protected companies
IPs are never blocked when the company name contains google, bing, or cloudflare. The google check ignores letter case. The bing and cloudflare checks are case-sensitive, so a company name such as Cloudflare, Inc. may not be protected, depending on how the company lookup writes it.
Why an IP is not blocked
An IP is blocked only when all of these are true:
- The command was run with
block. - The IP is in the top 25.
- Its visits are greater than or equal to the limit.
- It is not the server itself,
127.0.0.1, or a whitelisted IP. - Its company is not protected.
- It has no existing block record in
/var/log/go/block/.
Country and city lookup
| How it runs | Country and city come from |
|---|---|
| In a terminal | The geolocation lookups. |
| From cron or any non-interactive run | The whois record, which can leave them blank. |
Locking
Only block runs use the lock. It is the file /usr/local/goadmio/lock/block.lock, and its name suggests it is shared with other blocking commands. The command rewrites it for every IP it checks, so a long run keeps it fresh. A lock older than 60 seconds is treated as stale. The lock is removed when the command exits.
A run without block also removes the lock file at the end, even if a blocking run is still using it.
Side effects
- Every call is logged to
/var/log/go/ddos.log. - The working list is written to
/usr/local/goadmio/tmp/ddos.db. It uses a fixed name, so two runs at the same time can overwrite each other, and the file is left behind afterward. - Blocking is done by
block, called as/go/block <ip> ddos <country> <company>. - At the end of every run, the total number of requests across the current and rotated access logs is saved to the
Requestsfield of the GoAdmio config database.
See also
| Command | Description |
|---|---|
block |
Block an IP address on a GoAdmio server |
unblock |
Unblock an IP address on a GoAdmio server |
white |
Add an IP to the whitelist |
iptop |
Track the most visited IP addresses on a server |
bottop |
Block bad bots from visiting your server |
posttop |
Track and check IPs making POST requests |
underattack |
Enable Cloudflare Under Attack Mode for a domain |
waf |
Block IPs via Cloudflare WAF |
cron |
Set up main cron jobs in GoAdmio |