All Projects → tsurubee → Sshr

tsurubee / Sshr

Licence: mit
Proxy server for routing SSH connections

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Sshr

Fasttunnel
NAT 内网穿透 远程内网计算机 域名访问内网站点 反向代理内网服务 花生壳 端口转发 http代理 微信 小程序 expose a local server behind a NAT or firewall to the internet like ngrok and frp. NAT ssh proxy tunnel reverse-proxy
Stars: ✭ 248 (+92.25%)
Mutual labels:  proxy, ssh
Exodus
network proxy and tunnel (VPN)
Stars: ✭ 432 (+234.88%)
Mutual labels:  proxy, ssh
Mallory
HTTP/HTTPS proxy over SSH
Stars: ✭ 251 (+94.57%)
Mutual labels:  proxy, ssh
Easyssh Proxy
easyssh-proxy provides a simple implementation of some SSH protocol features in Go
Stars: ✭ 180 (+39.53%)
Mutual labels:  proxy, ssh
Sidedoor
SSH connection daemon for Debian/Raspbian/Ubuntu/etc
Stars: ✭ 97 (-24.81%)
Mutual labels:  proxy, ssh
Fq Book
📖《这本书能让你连接互联网》详细阐述代理、隧道、VPN运作过程,并对GFW策略如:地址端口封锁、服务器缓存投毒、数字验证攻击、SSL连接阻断做相关的原理说明
Stars: ✭ 2,393 (+1755.04%)
Mutual labels:  proxy, ssh
Asuswrt Merlin Transparent Proxy
transparent proxy base on ss, v2ray, ipset, iptables, chinadns on asuswrt merlin.
Stars: ✭ 367 (+184.5%)
Mutual labels:  proxy, ssh
Ssh Mitm
ssh mitm server for security audits supporting public key authentication, session hijacking and file manipulation
Stars: ✭ 335 (+159.69%)
Mutual labels:  proxy, ssh
Switcher
Run SSH and HTTP(S) on the same port
Stars: ✭ 877 (+579.84%)
Mutual labels:  proxy, ssh
Python Proxy
HTTP/HTTP2/HTTP3/Socks4/Socks5/Shadowsocks/ShadowsocksR/SSH/Redirect/Pf TCP/UDP asynchronous tunnel proxy implemented in Python 3 asyncio.
Stars: ✭ 692 (+436.43%)
Mutual labels:  proxy, ssh
Assh
💻 make your ssh client smarter
Stars: ✭ 2,340 (+1713.95%)
Mutual labels:  proxy, ssh
Quicssh
SSH over QUIC
Stars: ✭ 116 (-10.08%)
Mutual labels:  proxy, ssh
Inlets Pro
Secure TCP and HTTP tunnels that work anywhere
Stars: ✭ 179 (+38.76%)
Mutual labels:  proxy, ssh
Chameleon
Customizable honeypots for monitoring network traffic, bots activities and username\password credentials (DNS, HTTP Proxy, HTTP, HTTPS, SSH, POP3, IMAP, STMP, RDP, VNC, SMB, SOCKS5, Redis, TELNET, Postgres and MySQL)
Stars: ✭ 230 (+78.29%)
Mutual labels:  proxy, ssh
Psiphon
A multi-functional version of a popular network circumvention tool
Stars: ✭ 169 (+31.01%)
Mutual labels:  proxy, ssh
Gsnova
Private proxy solution & network troubleshooting tool.
Stars: ✭ 509 (+294.57%)
Mutual labels:  proxy, ssh
S3 Sftp Proxy
An AWS S3 gateway proxying SFTP connections.
Stars: ✭ 112 (-13.18%)
Mutual labels:  proxy, ssh
Nassh Relay
Relay Server for the Secure Shell Chromium plugin
Stars: ✭ 118 (-8.53%)
Mutual labels:  proxy, ssh
Gitwebhookproxy
A proxy to let webhooks reach running services behind a firewall – [✩Star] if you're using it!
Stars: ✭ 123 (-4.65%)
Mutual labels:  proxy
Dubbo Go Pixiu
Based on the proxy gateway service of dubbo-go, it solves the problem that the external protocol calls the internal Dubbo cluster. At present, it supports HTTP and gRPC[developing].
Stars: ✭ 124 (-3.88%)
Mutual labels:  proxy

sshr

Build Status

sshr is an SSH proxy server whose client is not aware of the connection destination.
A developer using sshr can freely incorporate own hooks that dynamically determines the destination host from the SSH username. Therefore, for example, when the server administrator wants to centrally manage the linkage information between the SSH user and the server to be used in the DB, you can refer to the destination host from the DB with the hook that can be pluggable in sshr.

※ The main logic of sshr is implemented in proxy.go of the tsurubee/sshr.crypto repository forked from golang/crypto.

conceptual_scheme

Usage

Installation

$ go get github.com/tsurubee/sshr

Example

func main() {
	confFile := "./example.toml"

	sshServer, err := sshr.NewSSHServer(confFile)
	if err != nil {
		fmt.Errorf("Error: %s", err)
	}

	sshServer.ProxyConfig.FindUpstreamHook = FindUpstreamByUsername
	if err := sshServer.ListenAndServe(); err != nil {
		fmt.Errorf("Error: %s", err)
	}
}

func FindUpstreamByUsername(username string) (string, error) {
	if username == "tsurubee" {
		return "host-tsurubee", nil
	} else {
		return "", errors.New(username + "'s host is not found!")
	}
}

FindUpstreamHook is a hook that can be pluggable, which allows you to write your own logic to dynamically determine the destination host from the SSH username.

Quick start

After Installation, test environment can be easily set up by using docker-compose.

$ docker-compose up
・・・
ssh-proxy_1      | ==> Installing Dependencies
ssh-proxy_1      | go get -u github.com/golang/dep/...
host-tsurubee_1  | Starting crond: [  OK  ]
host-hoge_1      | Starting crond: [  OK  ]
ssh-proxy_1      | dep ensure
ssh-proxy_1      | go run main.go
ssh-proxy_1      | time="2018-09-22T09:23:00Z" level=info msg="Start Listening on [::]:2222"

The sshr server is listening on port 2222 of the localhost, and we can login to the server as tsurubee or hoge user like below. (Password is testpass)

$ ssh [email protected] -p 2222
[email protected]'s password:
[[email protected] ~]$

We can also login with the public key authentication. (At the first time, we need to change permissions by chmod)

$ chmod 600 ./misc/testdata/client_keys/id_rsa
$ ssh -i ./misc/testdata/client_keys/id_rsa [email protected] -p 2222
Last login: Sat Sep 22 09:31:18 2018 from sshr_ssh-proxy_1.sshr_defaul
[[email protected] ~]$ 

Pluggable Hooks

In order to be able to flexibly change the behavior of the proxy server, sshr can freely incorporate the following hooks.

FindUpstreamHook(Required)

FindUpstreamHook is for specifying upstream host by SSH username.

Type: func(username string) (string, error)

FetchAuthorizedKeysHook(Optional)

FetchAuthorizedKeysHook is for fetching authorized_keys to confirm registration of the client's public key.

Type: func(username string, host string) ([]byte, error)

If not specified, authorized_keys is fetched from /home/<username>/.ssh/.

FetchPrivateKeyHook(Optional)

FetchPrivateKeyHook is for fetching the private key used when sshr performs publickey authentication as a client user to the upstream host.

Type: func(username string) ([]byte, error)

If not specified, privatekey whose file path is /home/<username>/.ssh/id_rsa is used.

Publications

  1. H. Tsuruta and R. Matsumoto, “sshr: An SSH Proxy Server Responsive to System Changes without Forcing Clients to Change”, in The 15th IEEE International Workshop on Security, Trust & Privacy for Software Applications (STPSA 2020), July 2020.

License

MIT

Author

tsurubee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].