Endlessh is an SSH tarpit that slowly sends an endless random banner. It is designed to hold automated clients for hours or even days, moving abusive traffic away from a real SSH service. The implementation is intentionally small and does not use cryptographic libraries because the trap operates before the cryptographic exchange.
That simplicity makes Endlessh easy to deploy. It also makes its operational boundary easy to misread. Holding thousands of connections is the function, not a side effect. The surrounding host, network, firewall, and monitoring design must still decide how much resource the tarpit may consume.
Capacity is part of the control
The Endlessh documentation lists a default delay of 10,000 milliseconds, a default line length of 32 bytes, a default listener on port 2222, and a default maximum of 4,096 clients. Connections beyond the maximum are not immediately rejected. They wait in the queue.
Those values describe the tarpit's own limits, not a complete capacity budget. A busy host may need a smaller maximum so the tarpit leaves file descriptors, memory, and CPU for logging, monitoring agents, and administrative access. A dedicated edge host may support a larger value. The decision should come from measured connection counts and a documented failure mode.
Watch the listen queue and the rate of new connections. A sustained queue is not just a sign that the trap is working. It can delay legitimate diagnostics or hide a local resource problem. Add an out-of-band check for the host and a separate path for emergency administration.
The queue needs a network boundary
Endlessh does not forward accepted connections to a production application. It still accepts connections at the network edge, so it must be placed where the organization expects those sessions. Restrict the listener to the intended addresses and interfaces. If the tarpit is on a public IP, create explicit firewall rules for the port and confirm that IPv6 exposure is also intended.
Do not put the tarpit on a management network just because it is small. An exposed listener can become a probe target, a source of noisy logs, or a way to consume local connection state. Keep the tarpit away from control-plane endpoints and from networks that contain credentials or unrestricted packet capture.
The documentation recommends putting the real SSH server on another port and letting automated clients encounter the tarpit. That placement is a routing decision. It must be backed by monitoring, not only a service unit that starts successfully.
Log the evidence, not every packet
Endlessh produces no log messages by default. A single -v enables basic logging, while a second -v produces noisy debugging output. The program can write to standard output, or use syslog with -s. The sample service writes to the journal and uses several systemd hardening options.
Choose a log level that records connection events without filling the disk with debugging detail. Rotate or collect the journal before it is overwritten. Record configuration changes separately because the tarpit's own log should not contain credentials or unrelated host secrets.
A SIGTERM initiates a graceful shutdown that allows the daemon to write a complete log. A SIGHUP reloads the configuration file. A SIGUSR1 prints connection statistics. These controls are useful for maintenance, but they must be restricted to privileged operators who can explain a tarpit restart.
Test the fail-closed behavior
Run a controlled connection test from an expected address and verify that it is held rather than forwarded to SSH. Then verify that the real SSH service is still reachable through its intended path. Test the maximum-client case and confirm that the queue behavior is understood by the on-call team.
Stop the tarpit during a maintenance window and observe what happens to the edge listener. The replacement behavior must not send sessions to the real SSH daemon by accident. If a load balancer or firewall provides the redirection, its health check should distinguish tarpit availability from real SSH health.
Questions for the next review
Who owns the tarpit host? What is its connection budget? Which interfaces and address families accept traffic? What is the log retention period? Can an operator see queue pressure without logging into the tarpit? Does a configuration reload change the bind address or client limit without approval?
Endlessh is a useful decoy and a resource commitment. Give it a defined capacity, a narrow network path, and a recovery plan. The rest of the network should not depend on an unbounded tarpit to stay available.