sshd Linux auth.log / journal Triage: low

sshd "drop connection": Maxstartups Limit and PerSourcePenalties Drops

Published

sshd's listener refused a new connection before any authentication could happen — either because the source address is serving a PerSourcePenalties penalty for how an earlier connection ended, or because too many unauthenticated connections were already in progress (MaxStartups).

What it looks like

Nov 12 03:51:11 api1 sshd[812]: drop connection #3 from [203.0.113.7]:51904 on [192.0.2.10]:22 penalty: failed authentication

  1. 1Time — When it was logged; this format has no year or time zone
  2. 2Host — The server’s host name
  3. 3Program — sshd and its process ID
  4. 4Source address — The client’s IP address

Example lines as /var/log/auth.log shows them (/var/log/secure on RHEL and Fedora):

Nov 12 03:51:11 api1 sshd[812]: drop connection #3 from [203.0.113.7]:51904 on [192.0.2.10]:22 penalty: failed authentication
Nov 12 03:51:12 api1 sshd[812]: drop connection #4 from [198.51.100.22]:40118 on [192.0.2.10]:22 penalty: connections without attempting authentication
Nov 12 04:02:37 api1 sshd[812]: drop connection #12 from [203.0.113.44]:33120 on [192.0.2.10]:22 Maxstartups
Nov 12 04:02:38 api1 sshd[812]: PerSourcePenalties logging rate-limited: additional 37 connections dropped

On our own server, the 30 days to 23 November 2026

drop connection #… from […]:… on […]:…

258

lines · about 8.6 a day · 14 source addresses

Last seen 23 November 2026

… logging rate-limited: additional … connections dropped

15

lines · about 0.50 a day

Last seen 23 November 2026

LogTriage's production API server (Hetzner, Germany): port 22 open to the internet, key-only since 6 October 2026 (password and keyboard-interactive authentication off); nginx in front of the API on ports 80 and 443. Counted weekly from the sshd journal; no address ever leaves the server. More in the monthly attack report; which free blocklists already list these attackers is measured in the IP blocklist report, and you can check the addresses in your own log.

Where the line comes from

Format strings as written in the source of OpenSSH 10.2p1 — the versions this server runs. Each links to the exact line.

drop connection #… from […]:… on […]:…

  • drop connection #%d from [%s]:%d on [%s]:%d %s message · sshd.c:624 (OpenSSH)
  • reason = "Maxstartups"; reason when MaxStartups is full · sshd.c:616 (OpenSSH)
  • penalty: failed authentication reason · srclimit.c:378 (OpenSSH)
  • penalty: connections without attempting authentication reason · srclimit.c:382 (OpenSSH)
  • penalty: exceeded LoginGraceTime reason · srclimit.c:390 (OpenSSH)

… logging rate-limited: additional … connections dropped

  • %s logging rate-limited: additional %u connections dropped message · sshd.c:632 (OpenSSH)
  • reason = "PerSourcePenalties"; reason when a source address is penalised · sshd.c:609 (OpenSSH)

What it means

Both lines are written by sshd’s listener process, in the code that decides whether a new TCP connection is accepted at all. The connection is refused before a session is forked, so nothing about a user name, key or password appears. sshd writes Not allowed at this time\r\n to the socket as a best-effort notification and drops it.

Read the drop line left to right: # and the number of concurrent unauthenticated connections sshd was tracking at that moment, the client’s address and source port in brackets, then the local address and port the connection arrived on, then the reason.

The reason comes from one of two checks, in this order:

  • PerSourcePenalties. If the source is currently being penalised, sshd logs the detailed subreason from srclimit.c: penalty: failed authentication, penalty: connections without attempting authentication, penalty: exceeded LoginGraceTime, penalty: caused crash, or penalty: connection prohibited by RefuseConnection. Each corresponds to how an earlier connection from that source ended. Penalties are enabled by default; the manual’s defaults are authfail 5s, noauth 1s, grace-exceeded 10s, crash 90s, refuseconnection 10s, accumulating up to max (10m), with enforcement only once min (15s) has accrued. The refusal covers the source address “and any others in the same network, as defined by PerSourceNetBlockSize” — default 32:128, each address individually.
  • MaxStartups. With no penalty in force, sshd drops when too many unauthenticated connections are already in progress. The default is 10:30:100: random early drop begins at 10 concurrent unauthenticated connections with a 30% probability, rising linearly until all are refused. PerSourceMaxStartups (default none) applies on top. The reason logged here is the word Maxstartups.

The second message limits the logging, not the connections. Each reason has its own log rate limiter; while it is active each drop is logged at DEBUG3 — invisible at the default LogLevel INFO — and sshd then emits <reason> logging rate-limited: additional N connections dropped. That summary prints the reason variable, so it reads PerSourcePenalties or Maxstartups, never a penalty subreason.

Is it an attack?

PatternReading
penalty: failed authentication from one address, with Failed password or Invalid user lines just before itCredential guessing; sshd is now throttling that source
penalty: connections without attempting authentication from your monitoring or CI rangeHealth checks or ssh-keyscan, not an attack — exempt the range
penalty: connections without attempting authentication from unknown addressesInternet-wide port scanning and banner grabbing
penalty: exceeded LoginGraceTimeClients that opened a connection and never finished authenticating — stalled sessions, or slots deliberately held open
Maxstartups in burstsThe unauthenticated connection slots filled up. Legitimate clients are refused too, so this is an availability signal as much as a security one
Maxstartups during a deploy window onlyA legitimate fan-out (parallel automation) hitting the limit
… logging rate-limited: additional N connections droppedDrops are arriving faster than sshd will log them individually

A penalty line proves sshd’s own defence fired; it does not prove the source failed on this connection, only on an earlier one. The companion srclimit penalise line records the moment the penalty was applied and is the better starting point for “why is this address blocked?”.

How to investigate

# Debian/Ubuntu unit is ssh; on RHEL/Fedora use -u sshd (log file /var/log/secure)
sudo journalctl -u ssh --since "24 hours ago" | grep -E 'drop connection|logging rate-limited'

# Which reason is doing the dropping?
sudo grep 'drop connection' /var/log/auth.log | sed 's/.*\]:22 //' | sort | uniq -c | sort -rn

# Top dropped sources
sudo grep 'drop connection' /var/log/auth.log \
  | sed -n 's/.*from \[\([^]]*\)\].*/\1/p' | sort | uniq -c | sort -rn | head

# What did that source do before the penalty? (failures, disconnects, grace timeouts)
sudo grep '203.0.113.7' /var/log/auth.log

# The limits actually in effect
sudo sshd -T | grep -Ei 'maxstartups|persource|logingracetime|permitrootlogin'

If Maxstartups drops cluster at a time when people complained they could not log in, the limit is costing you availability. If the penalty subreasons dominate, group an exported auth.log by source in the browser log analyzer and feed the worst offenders to the SSH brute-force rule.

How to stop it

These lines are sshd refusing traffic, so the goal is fewer hostile connections or limits that fit your own traffic — not silence.

# /etc/ssh/sshd_config — see man.openbsd.org/sshd_config#PerSourcePenalties
PerSourcePenalties authfail:2m grace-exceeded:1m max:30m
PerSourcePenaltyExemptList 192.0.2.10/32,198.51.100.0/24
PerSourceMaxStartups 4
LoginGraceTime 30
  • Keep penalties on and lengthen them. Raising authfail and max keeps a guessing source away for longer; the defaults are deliberately short.
  • Exempt what you trust. PerSourcePenaltyExemptList takes wildcards and CIDR ranges and by default exempts nothing.
  • Cap one source instead of everyone. PerSourceMaxStartups (default none) stops a single address filling the unauthenticated slots that MaxStartups counts; PerSourceNetBlockSize decides how wide “a source” is.
  • Shorten LoginGraceTime (default 120 seconds) so abandoned connections free their slot sooner, which reduces Maxstartups drops.
  • Remove the reason to knock. Key-only authentication (PasswordAuthentication no, KbdInteractiveAuthentication no — both default to yes) and a tight AllowUsers list cut what a bot can achieve, though scanners will keep connecting and keep earning noauth penalties. Firewalling port 22 to known ranges is what actually removes the traffic.
sudo sshd -t && sudo systemctl reload ssh

Validate before reloading, and keep an existing session open until a new one connects.

Does fail2ban ban it?

fail2ban’s sshd filter does not count this line as a failure in any mode.

  • normal (default)not counted
  • ddosnot counted
  • extranot counted
  • aggressivenot counted

fail2ban 1.1.1's sshd filter on the first example line above. Test your own lines in the fail2ban regex tester →

Lines you will see next to it

  • …: activating … penalty of … seconds for … sshd has accumulated enough penalty against one client address range to start refusing its connections, and the line names the address, the number of seconds left on the block and what the client did to earn it.
  • Timeout before authentication for …, pid = … A connection was accepted but did not finish authenticating inside the login grace period, so sshd terminated the pre-authentication process and the listener logged the client and that process's pid.
  • Connection closed by … The client at the other end of the SSH connection went away — closed it cleanly, or reset it — and sshd logged the address, port and (if the client had already named an account) the user it was trying before it quit.
  • maximum authentication attempts exceeded for … from … port … ssh2 One SSH connection used up every authentication attempt sshd allows it — the MaxAuthTries limit, 6 by default — so sshd logged the account name, source address and port and tore the connection down.

Detect it

MITRE ATT&CK: T1110T1595

Frequently Asked Questions

Does a "drop connection" line mean someone got in, or even tried a password?
Neither. The decision is made in the listener before a session process is forked, so no user name, key or password is ever offered on that connection. sshd writes the text "Not allowed at this time\r\n" to the socket as a best-effort notification and refuses the connection, which is why these lines carry an address and port but no account.
Why does the drop line say "penalty: failed authentication" but the summary line says "PerSourcePenalties"?
They print different variables. The per-connection line prints the penalty subreason when one is set, which is the detailed string from srclimit.c such as "penalty: exceeded LoginGraceTime". The rate-limited summary line prints the reason instead, and the reason is only ever "PerSourcePenalties" or "Maxstartups". Match the two by timestamp, not by text.
My monitoring host is being dropped with "penalty: connections without attempting authentication" — how do I fix it?
That penalty applies to clients that disconnect without attempting authentication, which is exactly what a TCP health check or ssh-keyscan does; sshd_config(5) warns that this timeout "may penalise legitimate scanning tools such as ssh-keyscan(1)". Either change the check so it authenticates, or list the prober's address or CIDR range in PerSourcePenaltyExemptList, which by default exempts no addresses.
Can I see the individual connections that the "additional N connections dropped" line is counting?
Not at the default log level. While the limiter is active sshd logs each drop at DEBUG3 instead of INFO, so the lines are suppressed and only the count survives. The manual says logging at a DEBUG level violates the privacy of users and is not recommended, so on a production host treat the count itself as the measurement of how heavy the flood was.

Run your own auth.log through it

Paste or drop /var/log/auth.log (or journalctl -u ssh output) into the free browser analyzer: brute force, password spraying, a successful login after failures and invalid-user sweeps are flagged with the evidence lines. Nothing is uploaded.

Investigating something right now? LogTriage checks every address in the file against threat intelligence and writes the incident report: 10 analyses a month free. The incident pack adds the in-depth AI analysis and files up to 100 MB: 25 analyses for $19, one payment, no subscription. Pricing

How this page was made. The official definitions, field names and examples on it are copied by script from the sources it links and re-checked against them on every build. The counts come from the logs of our own internet-facing server, refreshed weekly. The investigation advice was drafted with AI from those sources and passed a separate review before publishing. What is checked, and how · found a mistake? [email protected]