sasltop
Report the top 20 sources of SASL LOGIN failures and optionally block them
- Command:
/go/sasltop - Category: Security
- Required option: None
- Output: Table of the 20 most active sources (plus an email and WhatsApp alert when IPs are blocked)
- Last updated: 2026-11-19
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also
Overview
/go/sasltop finds the IP addresses with the most failed mail logins (SASL LOGIN authentication failures) and, in block mode, blocks the persistent offenders. It:
- counts
SASL LOGIN authentication failedentries per IPv4 address in/var/log/maillog - lists the 20 busiest sources with their country, city, and company
- skips the server's own IPs and well-known search and CDN companies
- blocks any other IP with 500 or more failures, using
block - sends an email and WhatsApp alert listing every IP it blocked
No setup is needed. GoAdmio's default cron jobs already run sasltop block every hour.
Quick start
# Show the top SASL failure sources (changes nothing)
/go/sasltop
# Show them and block every IP over the limit
/go/sasltop block
Syntax
/go/sasltop [block]
The command takes one optional argument and has no -- options. The limits are fixed in the script, as shown in Details.
Arguments
| Argument | Effect |
|---|---|
| (none) | Report only. Nothing is blocked and no alert is sent. |
block |
Report, then block each qualifying IP and send the alert. Takes the lock. |
robot |
Takes the lock and reports, but never blocks. |
underattack |
Takes the lock and reports, but never blocks. |
| Anything else | Treated like no argument: report only. |
Only the first argument is read.
Output
The command prints one table, sorted by failures, highest first. It is printed in every mode, including block.
| Column | Meaning |
|---|---|
IP |
Source address of the failed logins. |
VISITS |
Number of SASL LOGIN authentication failed lines from that IP in /var/log/maillog. |
COUNTRY |
Country of the IP. |
CITY |
City of the IP. May be empty. |
COMPANY |
Owner or network name of the IP. |
Example (addresses are placeholders):
IP VISITS COUNTRY CITY COMPANY
203.0.113.45 8120 NL Amsterdam Example Hosting B.V.
198.51.100.7 1304 US Dallas Sample Networks LLC
192.0.2.19 212 DE Frankfurt Demo Cloud GmbH
Alerts
When at least one IP is blocked, the command sends the same message by email and WhatsApp with /go/sendmail and /go/sendwhatsapp.
| Item | Value |
|---|---|
| Subject | Urgent: SASL LOGIN Authentication Failure (<N> IPs) |
| Body | A greeting, one line per blocked IP, a closing note, and a "do not reply" notice. |
| Line format | SASL Failed <IP> (<visits> Visits) - Country: <country>, Company: <company>. |
| Sent when | At least one IP was blocked in this run. |
The alert text notes that repeated failures can come from misconfigured email clients as well as attacks.
Exit status
| Situation | Result |
|---|---|
| Normal run | Prints the table and exits. |
Another block, robot, or underattack run is active |
Prints Instance (<name>) already running. and exits with status 1. |
Examples
# See who is failing mail logins right now
/go/sasltop
# Block every source over the limit, as the hourly cron job does
/go/sasltop block
# Review the log of past runs
tail -n 20 /var/log/go/sasltop.log
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Instance (<name>) already running. |
A block, robot, or underattack run started in the last 60 seconds. |
Wait a minute, then run again. |
| The table is empty | No SASL LOGIN authentication failed lines in /var/log/maillog, for example after log rotation. |
Nothing to do. The count restarts with the new log file. |
| An IP is listed but not blocked | See When an IP is blocked. | Check each condition. |
Nothing is blocked when you run /go/sasltop |
Report mode never blocks. | Run /go/sasltop block. |
| An IPv6 source is missing from the table | Only IPv4 addresses are counted. | Check /var/log/maillog directly. |
| No alert email or WhatsApp message | Alerts are sent only when an IP was blocked in that run. | Check block and the files in /var/log/go/block/. |
COUNTRY or CITY is empty or differs between runs |
From a terminal the values come from lookup functions. From cron they come from the whois record, which may have no city. | Run from a terminal for fuller results. |
| A legitimate user or office was blocked | A mail client with a wrong saved password can pass 500 failures. | Run unblock, fix the client's password, and consider white. |
Details
When an IP is blocked
An IP is blocked only when every condition is true:
| # | Condition |
|---|---|
| 1 | The command was run with block. |
| 2 | The IP is one of the 20 with the most failures. |
| 3 | The IP has 500 or more failures. |
| 4 | The IP is not the server's own IPv4 or IPv6 address, or 127.0.0.1. |
| 5 | The company name does not contain google, bing, or cloudflare (see the note below). |
| 6 | No file named /var/log/go/block/<IP>.* exists, meaning it has not already been blocked. |
[!NOTE] The company check for
bingandcloudflarematch lowercase text only.
The block itself is done with /go/block <IP> sasl <country> <company>.
Fixed limits
| Setting | Value |
|---|---|
| Source log | /var/log/maillog |
| Entries counted | Lines containing SASL LOGIN authentication failed |
| Address format | IPv4 addresses in square brackets, such as [203.0.113.45] |
| IPs listed | 20 |
| Block threshold | 500 failures |
| IP lookup services | checkip.amazonaws.com (IPv4) and icanhazip.com (IPv6), to identify the server's own addresses |
The counts cover only what is in the current /var/log/maillog, so rotation resets them.
Locking
block, robot, and underattack runs share the lock file /usr/local/goadmio/lock/block.lock, which holds the name of the running command. If the file was modified within the last 60 seconds, the new run exits. An older lock is treated as stale and replaced. The lock is removed when the command exits.
Report-only runs do not use the lock.
Logging
Every run appends its arguments with a timestamp to /var/log/go/sasltop.log.
What a run does
flowchart TD
A["sasltop [block]"] --> B{"block, robot, or underattack?"}
B -- "Yes" --> C{"Lock younger than 60 s?"}
C -- "Yes" --> X["Exit: already running"]
C -- "No" --> D
B -- "No" --> D["Count SASL failures per IPv4"]
D --> E["Take the top 20, skip own IPs"]
E --> F["Look up country, city, company"]
F --> G{"block mode, 500+ failures, not allowlisted, not already blocked?"}
G -- "Yes" --> H["Run block for the IP"]
G -- "No" --> I["Add row to table"]
H --> I
I --> J["Print table"]
J --> K{"Any IPs blocked?"}
K -- "Yes" --> L["Send email and WhatsApp alert"]
K -- "No" --> M["Remove lock, finish"]
L --> M
See also
| Command | Description |
|---|---|
sshtop |
Report top SSH brute-force sources and optionally block them |
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 |
fail2ban |
Install and configure Fail2ban to ban brute-force sources |
mailtop |
Check the most active email accounts in GoAdmio |
incoming |
Report today's inbound mail sessions |
troubleshoot |
Troubleshoot email problems in GoAdmio |
cron |
Set up main cron jobs in GoAdmio |