2019-02-03 04:38:59 +01:00
|
|
|
# Endlessh: an SSH tarpit
|
|
|
|
|
2019-02-03 14:26:42 +01:00
|
|
|
Endlessh is an SSH tarpit that *very* slowly sends an endless, random
|
|
|
|
SSH banner. It keeps SSH clients locked up for hours or even days at at
|
|
|
|
time. The purpose is to put your real SSH server on another port and
|
2019-02-03 18:04:23 +01:00
|
|
|
then let the script kiddies get stuck in this tarpit instead of
|
|
|
|
bothering a real server.
|
2019-02-03 04:38:59 +01:00
|
|
|
|
2019-02-03 18:04:23 +01:00
|
|
|
Since the tarpit is in the banner before any cryptographic exchange
|
2019-02-03 04:38:59 +01:00
|
|
|
occurs, this program doesn't depend on any cryptographic libraries. It's
|
|
|
|
a simple, single-threaded, standalone C program. It uses `poll()` to
|
|
|
|
trap multiple clients at a time.
|
|
|
|
|
2019-02-03 17:59:11 +01:00
|
|
|
## Usage
|
2019-02-03 04:38:59 +01:00
|
|
|
|
|
|
|
Usage information is printed with `-h`.
|
|
|
|
|
|
|
|
```
|
2019-02-03 17:47:20 +01:00
|
|
|
Usage: endlessh [-vh] [-d MS] [-f CONFIG] [-l LEN] [-m LIMIT] [-p PORT]
|
2019-02-03 04:38:59 +01:00
|
|
|
-d INT Message millisecond delay [10000]
|
2019-02-03 18:00:35 +01:00
|
|
|
-f Set and load config file [/etc/endlessh/config]
|
2019-02-03 04:38:59 +01:00
|
|
|
-h Print this help message and exit
|
2019-02-03 15:34:41 +01:00
|
|
|
-l INT Maximum banner line length (3-255) [32]
|
2019-02-03 04:38:59 +01:00
|
|
|
-m INT Maximum number of clients [4096]
|
|
|
|
-p INT Listening port [2222]
|
|
|
|
-v Print diagnostics to standard output (repeatable)
|
|
|
|
```
|
|
|
|
|
2019-02-03 18:04:23 +01:00
|
|
|
Argument order matters. The configuration file is loaded when the `-f`
|
|
|
|
argument is processed, so only the options that follow will override the
|
|
|
|
configuration file.
|
|
|
|
|
2019-02-03 14:09:21 +01:00
|
|
|
By default no log messages are produced. The first `-v` enables basic
|
2019-02-03 18:04:23 +01:00
|
|
|
logging and a second `-v` enables debugging logging (noisy). All log
|
2019-02-03 14:09:21 +01:00
|
|
|
messages are sent to standard output.
|
|
|
|
|
|
|
|
endlessh -v >endlessh.log 2>endlessh.err
|
|
|
|
|
2019-02-03 04:38:59 +01:00
|
|
|
The purpose of limiting the number of clients (`-m`) is to avoid tying
|
|
|
|
up too many system resources with the tarpit. Clients beyond this limit
|
|
|
|
are left in the accept queue, not rejected instantly.
|
2019-02-03 15:18:28 +01:00
|
|
|
|
|
|
|
A SIGTERM signal will gracefully shut down the daemon, allowing it to
|
|
|
|
write a complete, consistent log.
|
2019-02-03 17:47:20 +01:00
|
|
|
|
|
|
|
A SIGHUP signal requests a reload of the configuration file (`-f`).
|
2019-02-03 17:59:11 +01:00
|
|
|
|
|
|
|
## Sample Configuration File
|
|
|
|
|
|
|
|
The configuration file has similar syntax to OpenSSH.
|
|
|
|
|
|
|
|
```
|
2019-02-03 23:35:03 +01:00
|
|
|
# This is a comment
|
2019-02-03 17:59:11 +01:00
|
|
|
Port 22
|
|
|
|
Delay 30000
|
|
|
|
MaxLineLength 8
|
|
|
|
MaxClients 512
|
2019-02-04 00:44:24 +01:00
|
|
|
LogLevel 1
|
2019-02-03 17:59:11 +01:00
|
|
|
```
|