hussh
A minimal SSH server that only implements TCP forwarding ("direct-tcpip"). It is intended for use as a restricted SSH tunnel, proxy or jump host where interactive login sessions and remote command execution are not required or desired. Only public-key authentication is supported, password logins are never accepted. An optional low-interaction honeypot mode can log or report unsolicited password authentication attempts.
- No password authentication, only public keys
- No shell access or command execution, only TCP forwarding
- No log noise from failed login attempts
- Memory-safe and based on russh
- Optional low-interaction honeypot, record usernames and passwords used in bruteforce attacks
Usage
# Start the server on port 2 (assuming 192.0.2.37 in the following examples)
# Set it up as a jump host for a 2nd, localhost-only SSH daemon
# Forward a TCP connection through ssh, connect it to stdin/stdout
# Start a socks5 proxy server on localhost:1080
# All connections are forwarded through the ssh server
# Listen for incoming connections on localhost:1337 and forward
# them to localhost:8080 of the ssh server
Configuration
A minimal configuration would look like this (allow any destination):
# /etc/hussh.conf
[[]]
= [
"ssh-ed25519 AAAAC3Nyourkeyhere",
]
# Allowed destinations to connect to
= ["*"]
A more elaborate configuration could look like this:
# /etc/hussh.conf
[]
# Change the ssh bind address (port 22 on ipv4 + ipv6)
= "[::]:22"
[[]]
# Instead of allowing any username, require a specific value
= "proxy"
= [
"ssh-ed25519 AAAAC3Nyourkeyhere",
"ssh-ed25519 AAAAC3Nanotherkey",
]
# Allowed destinations to connect to
= [
# All ports on specific destinations
"example.com:*",
"127.0.0.1:*",
# Filter by port
"*:443",
]
# If the previous rule didn't match, try this one next:
[[]]
= [
"ssh-ed25519 AAAAC3Nyourkeyhere",
]
= [
# Allow specific locations only
"127.0.0.1:8080",
"[::1]:8080",
]
Honeypot usage
In addition to operating as a network proxy, hussh can also be used as a
low-interaction SSH honeypot, to passively build combolists from internet
noise. When enabled, it records unsolicited password authentication attempts,
including the username, password and source address. This information can
either be logged or forwarded as json to a remote HTTP endpoint:
# /etc/hussh.conf
[]
# Change the SSH server banner to a custom string
# Note that invalid values may confuse or break clients
= "SSH-2.0-anything"
# Log unsolicited password authentication attempts (including the password) to stderr
= true
# Report unsolicited password authentication attempts to a remote server via http json post:
# {"username":"root","password":"123456","src":"192.0.2.34:56789"}
= "https://example.com/report"
# In addition to unsolicited password authentication attempts,
# advertise that password authentication is supported/enabled
= true
Installation
Build from source
License
GPL-3.0-or-later