All Projects → tg123 → Sshpiper

tg123 / Sshpiper

Licence: mit
The missing reverse proxy for ssh scp

Programming Languages

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

Projects that are alternatives of or similar to Sshpiper

Wolfssh
wolfSSH is a small, fast, portable SSH implementation, including support for SCP and SFTP.
Stars: ✭ 142 (-70.96%)
Mutual labels:  scp, ssh
FastTunnel
expose a local server to the internet. 高性能跨平台的内网穿透解决方案 远程内网计算机 域名访问内网站点 反向代理内网服务 端口转发 http代理
Stars: ✭ 815 (+66.67%)
Mutual labels:  ssh, reverse-proxy
Sshj
ssh, scp and sftp for java
Stars: ✭ 2,016 (+312.27%)
Mutual labels:  scp, ssh
Sshkit.ex
An Elixir toolkit for performing tasks on one or more servers, built on top of Erlang’s SSH application.
Stars: ✭ 108 (-77.91%)
Mutual labels:  scp, ssh
Sync
syncs your local folder with remote folder using scp
Stars: ✭ 293 (-40.08%)
Mutual labels:  scp, ssh
Lssh
List selection type alternative ssh/scp/sftp client. Pure Go.
Stars: ✭ 110 (-77.51%)
Mutual labels:  scp, ssh
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 (-49.28%)
Mutual labels:  reverse-proxy, ssh
Felix
A Friendly SSH Jumper Bastion Fortress Server
Stars: ✭ 542 (+10.84%)
Mutual labels:  scp, ssh
Deployr
A simple golang application to automate the deployment of software releases.
Stars: ✭ 282 (-42.33%)
Mutual labels:  scp, ssh
ssh2.nim
Async SSH, SCP and SFTP client for Nim, using libssh2 wrapper [WIP]
Stars: ✭ 17 (-96.52%)
Mutual labels:  ssh, scp
Paramiko Tutorial
📡🐍SSH & SCP in Python with Paramiko
Stars: ✭ 65 (-86.71%)
Mutual labels:  scp, ssh
Ssh Mitm
ssh mitm server for security audits supporting public key authentication, session hijacking and file manipulation
Stars: ✭ 335 (-31.49%)
Mutual labels:  scp, ssh
Winscp
WinSCP is a popular free SFTP and FTP client for Windows, a powerful file manager that will improve your productivity. It supports also Amazon S3, FTPS, SCP and WebDAV protocols. Power users can automate WinSCP using .NET assembly.
Stars: ✭ 794 (+62.37%)
Mutual labels:  scp, ssh
S3 Sftp Proxy
An AWS S3 gateway proxying SFTP connections.
Stars: ✭ 112 (-77.1%)
Mutual labels:  scp, ssh
Libssh2
the SSH library
Stars: ✭ 743 (+51.94%)
Mutual labels:  scp, ssh
Sidedoor
SSH connection daemon for Debian/Raspbian/Ubuntu/etc
Stars: ✭ 97 (-80.16%)
Mutual labels:  reverse-proxy, ssh
Ssh Auditor
The best way to scan for weak ssh passwords on your network
Stars: ✭ 516 (+5.52%)
Mutual labels:  ssh, auditing
ssh-am
SSH ACCOUNT MANAGEMENT
Stars: ✭ 15 (-96.93%)
Mutual labels:  ssh, scp
Aws Gate
Better AWS SSM Session manager CLI client
Stars: ✭ 294 (-39.88%)
Mutual labels:  scp, ssh
Cowrie
Cowrie SSH/Telnet Honeypot https://cowrie.readthedocs.io
Stars: ✭ 3,810 (+679.14%)
Mutual labels:  scp, ssh

SSH Piper

Go Go Report Card Docker Image

SSH Piper works as a proxy-like ware, and route connections by username, src ip , etc.

+---------+                      +------------------+          +-----------------+
|         |                      |                  |          |                 |
|   Bob   +----ssh -l bob----+   |   SSH Piper   +------------->   Bob' machine  |
|         |                  |   |               |  |          |                 |
+---------+                  |   |               |  |          +-----------------+
                             +---> pipe-by-name--+  |                             
+---------+                  |   |               |  |          +-----------------+
|         |                  |   |               |  |          |                 |
|  Alice  +----ssh -l alice--+   |               +------------->  Alice' machine |
|         |                      |                  |          |                 |
+---------+                      +------------------+          +-----------------+


 Downstream                         SSH Piper                       Upstream                     

Demo

demo

asciicast

Install

Build yourself [Go 1.14+]

git clone 
cd sshpiper/sshpiperd/
go build

with pam module support

go build -tags pam 

with Docker image

docker run farmer1992/sshpiperd

Run with Workding Dir upstream driver

docker run -d -p 2222:2222 \
  -v /etc/ssh/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key \
  -v /YOUR_WORKING_DIR:/var/sshpiper \
  farmer1992/sshpiperd

Run with Additional Challenge

use env SSHPIPERD_CHALLENGER to specify which challenger to use

docker run -d -p 2222:2222 \
  -e SSHPIPERD_CHALLENGER=pam \
  -v /YOUR_PAM_CONFIG:/etc/pam.d/sshpiperd \
  -v /etc/ssh/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key \
  -v /YOUR_WORKING_DIR:/var/sshpiper \
  farmer1992/sshpiperd

with Snap

Get it from the Snap Store

sudo snap install sshpiperd

configure with snap

sudo snap set sshpiperd 'port=3333'

sudo snap restart sshpiperd

NOTE:

  • Default working dir for snap verion is /var/snap/sshpiperd/common
  • use classic mode if PAM is not working: sudo snap install --classic sshpiperd

Quick start

Just run showme.sh in sshpiperd example directory or Copy paste command below to run

go get github.com/tg123/sshpiper/sshpiperd && `go env GOPATH`/src/github.com/tg123/sshpiper/sshpiperd/example/showme.sh

the example script will setup a sshpiper server using

bitbucket -> [email protected]:22 # ssh 127.0.0.1 -p 2222 -l bitbucket
github -> [email protected]:22 # ssh 127.0.0.1 -p 2222 -l github
gitlab -> [email protected]:22 # ssh 127.0.0.1 -p 2222 -l gitlab

connect to gitlab

$ ssh 127.0.0.1 -p 2222 -l gitlab
Permission denied (publickey).

connect to github.com

$ ssh 127.0.0.1 -p 2222 -l github
Permission denied (publickey).

Configuration

sshpiper provides 3 pluginable components to highly customize your piper

sshpiperd daemon -h to learn more

Upstream Driver (--upstream-driver=)

Upstream driver helps sshpiper to find which upstream host to connect and how to connect.

For example, you can change the username when connecting to upstream sshd by config upstream driver

Available Upstream Drivers

  • Workding Directory

    Working Dir is a /home-like directory. SSHPiperd read files from workingdir/[username]/ to know upstream's configuration.

  • Database Driver

    Database upstream driver connected to popular databases, such as mysql, pg or sqlite etc to provide upstream's information.

How to do public key authentication when using sshpiper

During SSH publickey auth, RFC 4252 Section 7, ssh client sign session_id and some other data using private key into a signature sig. This is for server to verify that the connection is from the client not the man in the middle.

However, sshpiper actually holds two ssh connection, and it is doing what the man in the middle does. the two ssh connections' session_id will never be the same, because they are hash of the shared secret. RFC 4253 Section 7.2.

To support publickey auth, sshpiper will modify the sig using a private key provided by upstream driver. e.g. (id_rsa) in the workingdir/[username]/.

How this work

+------------+        +------------------------+                       
|            |        |                        |                       
|   client   |        |   SSH Piper            |                       
|   PK_X     +-------->      |                 |                       
|            |        |      v                 |                       
|            |        |   Check PK_X           |                       
+------------+        |   in authorized_keys   |                       
                      |      |                 |                       
                      |      |                 |     +----------------+
                      |      v                 |     |                |
                      |   sign agian           |     |   server       |
                      |   using PK_Y  +-------------->   check PK_Y   |
                      |                        |     |                |
                      |                        |     |                |
                      +------------------------+     +----------------+

e.g.

on client

ssh-copy-id -i PK_X [email protected]

on ssh piper server

ln -s ~test/.ssh/authorized_keys workingdir/test/authorized_keys
ssh-keygen -N '' -f workingdir/test/id_rsa  # this is PK_Y
ssh-copy-id -i workingdir/test/id_rsa [email protected]

now ssh [email protected] -i -i PK_X, sshpiper will send PK_Y to server instead of PK_X.

Additional Challenge (--challenger-driver=)

sshpiper allows you to add your own challenge before dialing to the upstream. if a client failed in this challenge, connection will be closed. however, the client has to pass the upstream server's auth in order to establish the whole connection. Additional Challenge is required, but not enough.

This is useful when you want use publickey and something like google-authenticator together. OpenSSH do not support use publickey and other auth together.

Available Challengers

  • pam

    Linux-PAM challenger

    this module use the pam service called sshpiperd

    you can configure the rule at /etc/pam.d/sshpiperd

  • azdevcode

    Support Azure AD device code grant, More info

    sshpier will ask user to login using webpage

    To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code ****** to authenticate.
    
  • authy

    Support token and onetouch from https://authy.com/

Auditor for pipes (--auditor-driver=)

Auditor provides hook for messages transfered by SSH Piper which cloud log messages onto disks or filter some specific message on the fly.

Available Auditor

  • SSH Session logging (--auditor-driver=typescript-logger)

    When record_typescript is allowed, each piped connection would be recorded into typescript in --auditor-typescriptlogger-outputdir.

    The file format is compatible with scriptreplay(1)

    Example:

    $ ./sshpiperd daemon --auditor-driver=typescript-logger
    
    ssh [email protected] -p 2222
    ... do some commands
    exit
    
    
    $ cd workingdir/user_name
    $ ls *.timing *.typescript
    1472847798.timing 1472847798.typescript
    
    $ scriptreplay -t 1472847798.timing 1472847798.typescript # will replay the ssh session
    

Manage pipes with sshpiper command

SSH Piper comes with tools to list/add/remove pipes.

sshpiperd pipe -h to learn more.

License

MIT

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].