• Stars
    star
    6,762
  • Rank 5,605 (Top 0.2 %)
  • Language
    C
  • License
    The Unlicense
  • Created over 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SSH tarpit that slowly sends an endless banner

Endlessh: an SSH tarpit

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 a time. The purpose is to put your real SSH server on another port and then let the script kiddies get stuck in this tarpit instead of bothering a real server.

Since the tarpit is in the banner before any cryptographic exchange 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.

Usage

Usage information is printed with -h.

Usage: endlessh [-vhs] [-d MS] [-f CONFIG] [-l LEN] [-m LIMIT] [-p PORT]
  -4        Bind to IPv4 only
  -6        Bind to IPv6 only
  -d INT    Message millisecond delay [10000]
  -f        Set and load config file [/etc/endlessh/config]
  -h        Print this help message and exit
  -l INT    Maximum banner line length (3-255) [32]
  -m INT    Maximum number of clients [4096]
  -p INT    Listening port [2222]
  -s        Print diagnostics to syslog instead of standard output
  -v        Print diagnostics (repeatable)

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.

By default no log messages are produced. The first -v enables basic logging and a second -v enables debugging logging (noisy). All log messages are sent to standard output by default. -s causes them to be sent to syslog.

endlessh -v >endlessh.log 2>endlessh.err

A SIGTERM signal will gracefully shut down the daemon, allowing it to write a complete, consistent log.

A SIGHUP signal requests a reload of the configuration file (-f).

A SIGUSR1 signal will print connections stats to the log.

Sample Configuration File

The configuration file has similar syntax to OpenSSH.

# The port on which to listen for new SSH connections.
Port 2222

# The endless banner is sent one line at a time. This is the delay
# in milliseconds between individual lines.
Delay 10000

# The length of each line is randomized. This controls the maximum
# length of each line. Shorter lines may keep clients on for longer if
# they give up after a certain number of bytes.
MaxLineLength 32

# Maximum number of connections to accept at a time. Connections beyond
# this are not immediately rejected, but will wait in the queue.
MaxClients 4096

# Set the detail level for the log.
#   0 = Quiet
#   1 = Standard, useful log messages
#   2 = Very noisy debugging information
LogLevel 0

# Set the family of the listening socket
#   0 = Use IPv4 Mapped IPv6 (Both v4 and v6, default)
#   4 = Use IPv4 only
#   6 = Use IPv6 only
BindFamily 0

Build issues

Some more esoteric systems require extra configuration when building.

RHEL 6 / CentOS 6

This system uses a version of glibc older than 2.17 (December 2012), and clock_gettime(2) is still in librt. For these systems you will need to link against librt:

make LDLIBS=-lrt

Solaris / illumos

These systems don't include all the necessary functionality in libc and the linker requires some extra libraries:

make CC=gcc LDLIBS='-lnsl -lrt -lsocket'

If you're not using GCC or Clang, also override CFLAGS and LDFLAGS to remove GCC-specific options. For example, on Solaris:

make CFLAGS=-fast LDFLAGS= LDLIBS='-lnsl -lrt -lsocket'

The feature test macros on these systems isn't reliable, so you may also need to use -D__EXTENSIONS__ in CFLAGS.

OpenBSD

The man page needs to go into a different path for OpenBSD's man command:

diff --git a/Makefile b/Makefile
index 119347a..dedf69d 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ endlessh: endlessh.c
 install: endlessh
        install -d $(DESTDIR)$(PREFIX)/bin
        install -m 755 endlessh $(DESTDIR)$(PREFIX)/bin/
-       install -d $(DESTDIR)$(PREFIX)/share/man/man1
-       install -m 644 endlessh.1 $(DESTDIR)$(PREFIX)/share/man/man1/
+       install -d $(DESTDIR)$(PREFIX)/man/man1
+       install -m 644 endlessh.1 $(DESTDIR)$(PREFIX)/man/man1/

 clean:
        rm -rf endlessh

More Repositories

1

w64devkit

Portable C and C++ Development Kit for x64 (and x86) Windows
C
2,216
star
2

elfeed

An Emacs web feeds client
Emacs Lisp
1,371
star
3

skewer-mode

Live web development in Emacs
Emacs Lisp
1,066
star
4

enchive

Encrypted personal archives
C
617
star
5

branchless-utf8

Branchless UTF-8 decoder
C
568
star
6

hash-prospector

Automated integer hash function discovery
C
425
star
7

pixelcity

Shamus Young's procedural city project
C++
359
star
8

scratch

Personal scratch code
C
327
star
9

optparse

Portable, reentrant, getopt-like option parser
C
308
star
10

pdjson

C JSON parser library that doesn't suck
C
248
star
11

interactive-c-demo

Demonstration of interactive C programming
C
247
star
12

emacs-aio

async/await for Emacs Lisp
Emacs Lisp
214
star
13

webgl-particles

WebGL particle system demo
JavaScript
203
star
14

fantasyname

Fantasy name generator
C
180
star
15

lstack

C11 Lock-free Stack
C
172
star
16

resurrect-js

JavaScript serialization that preserves behavior and reference circularity.
JavaScript
169
star
17

passphrase2pgp

Generate a PGP key from a passphrase
Go
168
star
18

pure-linux-threads-demo

Pthreads-free Linux threading demo
Assembly
135
star
19

memdig

Memory cheat tool for Windows and Linux games
C
130
star
20

ptrace-examples

Examples for Linux ptrace(2)
C
127
star
21

dosdefender-ld31

DOS Defender (Ludum Dare #31)
C
125
star
22

dotfiles

My personal dotfiles
Shell
124
star
23

Prelude-of-the-Chambered

Notch's Prelude of the Chambered 48-hour game
Java
124
star
24

sort-circle

Colorful sorting animations
C
121
star
25

.emacs.d

My personal .emacs.d
Emacs Lisp
119
star
26

growable-buf

Growable Memory Buffer for C99
C
113
star
27

youtube-dl-emacs

Emacs youtube-dl download manager
Emacs Lisp
103
star
28

opengl-demo

Minimal OpenGL 3.3 core profile demo
C
97
star
29

getopt

POSIX getopt() as a portable header library
C
96
star
30

Minicraft

Notch's Ludum Dare 22 entry.
Java
95
star
31

igloojs

Low-level, fluent, OOP WebGL wrapper
JavaScript
89
star
32

webgl-game-of-life

WebGL Game of Life
JavaScript
88
star
33

trie

C99 trie library
C
86
star
34

hastyhex

A blazing fast hex dumper
C
85
star
35

elisp-ffi

Emacs Lisp Foreign Function Interface
C++
83
star
36

bmp

24-bit BMP (Bitmap) ANSI C header library
C
82
star
37

rng-js

JavaScript seedable random number generation tools.
JavaScript
82
star
38

mandel-simd

Mandelbrot set in SIMD (SSE, AVX)
C
81
star
39

sample-java-project

Example Ant-based Java project
Java
78
star
40

nasm-mode

Major mode for editing NASM assembly programs
Emacs Lisp
76
star
41

vulkan-test

Test if your system supports Vulkan
C
72
star
42

u-config

a smaller, simpler, portable pkg-config clone
C
71
star
43

at-el

Prototype-based Emacs Lisp object system
Emacs Lisp
71
star
44

gap-buffer-animator

Gap buffer animation creator
C
71
star
45

skeeto.github.com

Personal website/blog
HTML
64
star
46

ulid-c

ULID Library for C
C
59
star
47

xf8

8-bit Xor Filter in C99
C
59
star
48

race64

World's fastest Base64 encoder / decoder
C
58
star
49

devdocs-lookup

Quick Emacs API lookup on devdocs.io
Emacs Lisp
58
star
50

webgl-path-solver

WebGL shortest path solver
JavaScript
57
star
51

javadoc-lookup

Quickly lookup Javadoc pages from Emacs
Emacs Lisp
55
star
52

x86-lookup

Quickly jump to x86 documentation from Emacs
Emacs Lisp
54
star
53

am-i-shadowbanned

Online reddit shadowban test
JavaScript
53
star
54

fun-liquid

Physics engine liquid in Java.
Java
53
star
55

minimail

Embeddable POP3 + SMTP server.
C
49
star
56

emacs-memoize

Elisp memoization functions
Emacs Lisp
48
star
57

simplegpg

Simplified, signify-like interface to GnuPG signatures
Shell
46
star
58

autotetris-mode

Automatically play Emacs Tetris
Emacs Lisp
45
star
59

fiber-await

Win32 Fiber async/await demo
C
44
star
60

webgl-fire

WebGL fire effect
JavaScript
43
star
61

lorenz-webgl

Lorenz System WebGL
JavaScript
42
star
62

elisp-json-rpc

JSON-RPC library for Emacs Lisp
Emacs Lisp
39
star
63

hashtab

Simple C hash table
C
37
star
64

asteroids-demo

Asteroids Clone for Windows
C
36
star
65

pgp-poisoner

PGP key poisoner
Go
36
star
66

wisp

Wisp, a lisp programming language
C
33
star
67

binitools

Bini file translator for the game Freelancer
C
32
star
68

bf-x86

x86_64 brainfuck compiler
C
32
star
69

double-pendulum

JavaScript double pendulum simulation with RK4 integration
JavaScript
30
star
70

purgeable

Purgeable memory allocations for Linux
C
29
star
71

predd

Multimethods for Emacs Lisp
Emacs Lisp
29
star
72

atomkv

In-memory, JSON, key-value service with compare-and-swap updates and event streams
Go
27
star
73

goblin-com

Goblin-COM roguelike game for 7DRL 2015
C
27
star
74

lqueue

C11 + Pthreads Atomic Bounded Work Queue
C
27
star
75

jekyll-deck

Template for Jekyll / deck.js presentations
27
star
76

uuid

UUID generator for Go
Go
26
star
77

rlhk

Roguelike Header Kit
C
26
star
78

voronoi-toy

WebGL interactive Voronoi diagram
JavaScript
26
star
79

transcription-mode

Emacs mode for editing transcripts.
Emacs Lisp
25
star
80

october-chess-engine

Java Chess Engine
Java
25
star
81

boids-js

HTML5 boids (skewer-mode demo)
JavaScript
25
star
82

geohash

Fast, lean, efficient geohash C library
C
24
star
83

bitpack

Emacs Lisp structure packing
Emacs Lisp
23
star
84

connect4

Connect Four AI and Engine
C
22
star
85

lean-static-gpg

Lean, static GnuPG build for Linux
Shell
22
star
86

blowpipe

Authenticated Blowfish-encrypted pipe
C
22
star
87

markov-text

Markov chain text generation in Emacs Lisp
Emacs Lisp
22
star
88

joymacs

Joystick support for Emacs
C
21
star
89

optparse-go

GNU style long options for Go
Go
21
star
90

emacs-rsa

RSA cryptography in Emacs Lisp
Emacs Lisp
20
star
91

live-dev-env

A live CD of my personal development environment
Shell
20
star
92

dynamic-function-benchmark

Benchmark for three different kinds of dynamic function calls
C
19
star
93

utf-7

UTF-7 encoder and decoder in ANSI C
C
18
star
94

elisp-fakespace

Emacs Lisp namespaces (defpackage)
Emacs Lisp
18
star
95

siphash

Incremental SipHash in C
C
18
star
96

bencode-c

Bencode decoder in ANSI C
C
17
star
97

british-square

British Square Engine (Analysis and Perfect AI Player)
C
17
star
98

xxtea

100% XXTEA authenticated, chunked file encryption
C
17
star
99

gnupg-windows-build

Cross-compile GnuPG for Windows using Docker
Dockerfile
17
star
100

pokerware

Pokerware Secure Passphrase Generation
Makefile
16
star