{"id":13453147,"url":"https://github.com/tg123/sshpiper","last_synced_at":"2026-02-10T10:03:27.616Z","repository":{"id":24162749,"uuid":"27552826","full_name":"tg123/sshpiper","owner":"tg123","description":"The missing reverse proxy for ssh scp","archived":false,"fork":false,"pushed_at":"2025-04-08T16:12:08.000Z","size":60734,"stargazers_count":1047,"open_issues_count":10,"forks_count":141,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-13T03:59:48.542Z","etag":null,"topics":["auditing","azuread","bastion","bastion-server","golang","google-authenticator","reverse-proxy","scp","ssh","ssh-connection","two-factor-authentication"],"latest_commit_sha":null,"homepage":"https://sshpiper.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tg123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"tg123"}},"created_at":"2014-12-04T18:00:12.000Z","updated_at":"2025-04-11T04:40:15.000Z","dependencies_parsed_at":"2023-11-27T22:28:38.754Z","dependency_job_id":"9399882a-6945-42b4-b60f-62d924ef37e4","html_url":"https://github.com/tg123/sshpiper","commit_stats":{"total_commits":660,"total_committers":28,"mean_commits":"23.571428571428573","dds":0.2545454545454545,"last_synced_commit":"f5fe06c5ebb0d5cda2609573a953ca09534e58b5"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fsshpiper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fsshpiper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fsshpiper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tg123%2Fsshpiper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tg123","download_url":"https://codeload.github.com/tg123/sshpiper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661706,"owners_count":21141450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auditing","azuread","bastion","bastion-server","golang","google-authenticator","reverse-proxy","scp","ssh","ssh-connection","two-factor-authentication"],"created_at":"2024-07-31T08:00:33.720Z","updated_at":"2026-02-10T10:03:27.611Z","avatar_url":"https://github.com/tg123.png","language":"Go","readme":"# sshpiper 🖇\n\n[![E2E](https://github.com/tg123/sshpiper/actions/workflows/e2e.yml/badge.svg)](https://github.com/tg123/sshpiper/actions/workflows/e2e.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/tg123/sshpiper)](https://goreportcard.com/report/github.com/tg123/sshpiper)\n[![Docker Image](https://img.shields.io/docker/pulls/farmer1992/sshpiperd.svg)](https://hub.docker.com/r/farmer1992/sshpiperd)\n\n`sshpiper` is the reverse proxy for sshd. all protocols, including ssh, scp, port forwarding, running on top of ssh are supported. \n\n*Note:* this is `v1` version, checkout legacy `v0` [here](https://github.com/tg123/sshpiper/tree/v0)\n\n### Overview and Terminology\n\n * `downstream`: the client side, typically an ssh client.\n * `upstream`: the server side, typically an ssh server.\n * `plugin`: handles the routing from `downstream` to `upstream`. The `plugin` is also responsible for mapping authentication methods to the upstream server. For example, the downstream may use password authentication, but the upstream server may receive public key authentication mapped by `sshpiper`.\n * `additional challenge`: some `plugins` will not only perform routing but also add additional challenges to SSH authentication for the `upstream` server. For example, the `downstream` may be asked for two-factor authentication provided by the `plugin`.\n\n\n```\n+---------+                      +------------------+          +-----------------+\n|         |                      |                  |          |                 |\n|   Bob   +----ssh -l bob----+   |   sshpiper    +-------------\u003e   Bob' machine  |\n|         |                  |   |               |  |          |                 |\n+---------+                  |   |               |  |          +-----------------+\n                             +---\u003e pipe-by-name--+  |                             \n+---------+                  |   |               |  |          +-----------------+\n|         |                  |   |               |  |          |                 |\n|  Alice  +----ssh -l alice--+   |               +-------------\u003e  Alice' machine |\n|         |                      |                  |          |                 |\n+---------+                      +------------------+          +-----------------+\n\n\n downstream                         sshpiper                        upstream                     \n\n```\n\n## Quick start\n\n### Build\n\n```\ngit clone https://github.com/tg123/sshpiper\ncd sshpiper\ngit submodule update --init --recursive\n\nmkdir out\ngo build -tags full -o out ./...\n```\n\n## Run simple demo\n\n### start dummy sshd server\n\n```\ndocker run -d -e USER_NAME=user -e USER_PASSWORD=pass -e PASSWORD_ACCESS=true -p 127.0.0.1:5522:2222 lscr.io/linuxserver/openssh-server\n```\n\n### start `sshpiperd` with `fixed` plugin targeting the dummy sshd server\n\n```\n./out/sshpiperd -i /tmp/sshpiperkey --server-key-generate-mode notexist --log-level=trace ./out/fixed --target 127.0.0.1:5522\n```\n\n### test ssh connection (password: `pass`)\n\n```\nssh 127.0.0.1 -l user -p 2222\n```\n\n### ➕ math before login? \n\nHere illustrates the example of `additional challenge` before the `fixed` plugin.\n\n```\n./out/sshpiperd -i /tmp/sshpiperkey --server-key-generate-mode notexist --log-level=trace ./out/simplemath -- ./out/fixed --target 127.0.0.1:5522\n```\n\n## Plugins\n\n### icons\n\n * 🔀: routing plugin\n * 🔒: additional challenge plugin\n * 📈: metrics plugin\n\nPlugin list\n\n * [workingdir](plugin/workingdir/) 🔀: `/home`-like directory to managed upstreams routing by sshpiperd.\n * [yaml](plugin/yaml/) 🔀: config routing with a single yaml file.\n * [docker](plugin/docker/) 🔀: pipe into docker containers.\n * [kubernetes](plugin/kubernetes/) 🔀: manage pipes via Kubernetes CRD.\n * [azdevicecode](https://github.com/tg123/sshpiper-plugins/tree/main/azdevicecode) 🔒: ask user to enter [azure device code](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code) before login\n * [fixed](plugin/fixed/) 🔀: fixed targeting the dummy sshd server\n * [username-router](plugin/username-router/) 🔀: route based on username, the username format is `target+username`, where `target` is the target host and `username` is the username to use for that target.\n * [simplemath](plugin/simplemath/) 🔒: ask for very simple math question before login, demo purpose\n * [githubapp](https://github.com/tg123/sshpiper-gh) 🔀: login ssh with your github account\n * [restful](https://github.com/11notes/docker-sshpiper) by [@11notes](https://github.com/11notes) 🔀🔒: The rest plugin for sshpiperd is a simple plugin that allows you to use a restful backend for authentication and challenge.\n * [failtoban](plugin/failtoban/) 🔒: ban ip after failed login attempts\n * [openpubkey](https://github.com/tg123/sshpiper-openpubkey)🔀🔒: integrate with [openpubkey](https://github.com/openpubkey/openpubkey)\n * [metrics](plugin/metrics/) 📈: serve prometheus metrics on open connections and auth errors\n\n## Screen recording\n\n### asciicast\n\nrecording the screen in `asciicast` format \u003chttps://docs.asciinema.org/manual/asciicast/v2/\u003e\n\nTo use it, start sshpiperd with `--screen-recording-format asciicast` and `--screen-recording-dir /path/to/recordingdir`\n\n    Example:\n\n    ```\n    ssh user_name@\n    ... do some commands\n    exit\n\n    asciinema play /path/to/recordingdir/\u003cconn_guid\u003e/shell-channel-0.cast\n\n    ```\n\n### typescript\n\nrecording the screen in `typescript` format (not the lang). The format is compatible with [scriptreplay(1)](https://linux.die.net/man/1/scriptreplay)\n\n\nTo use it, start sshpiperd with `--screen-recording-format typescript` and `--screen-recording-dir /path/to/recordingdir`\n\n    Example:\n\n    ```\n    ssh user_name@127.0.0.1 -p 2222\n    ... do some commands\n    exit\n\n\n    $ cd /path/to/recordingdir/\u003cconn_guid\u003e\n    $ ls *.timing *.typescript\n    1472847798.timing 1472847798.typescript\n\n    $ scriptreplay -t 1472847798.timing 1472847798.typescript # will replay the ssh session\n    ```\n\n\n## Public key authentication when using sshpiper (Private key remapping)\n\nDuring SSH publickey auth, [RFC 4252 Section 7](http://tools.ietf.org/html/rfc4252#section-7),\nssh client sign `session_id` and some other data using private key into a signature `sig`.\nThis is for server to verify that the connection is from the client not `the man in the middle`.\n\nHowever, sshpiper actually holds two ssh connection, and it is doing what `the man in the middle` does.\nthe two ssh connections' `session_id` will never be the same, because they are hash of the shared secret. [RFC 4253 Section 7.2](http://tools.ietf.org/html/rfc4253#section-7).\n\n\nTo support publickey auth, `sshpiper` routing plugin must provide a new private key for the `upstream` to sign the `session_id`. This new private key is called `mapping key`.\n\nHow this work\n\n```\n+------------+        +------------------------+                       \n|            |        |                        |                       \n|   client   |        |   sshpiper             |                       \n|   PK_X     +--------\u003e      |                 |                       \n|            |        |      v                 |                       \n|            |        |   Check Permission     |                       \n+------------+        |      |                 |                       \n                      |      |                 |                       \n                      |      |                 |     +----------------+\n                      |      v                 |     |                |\n                      |   sign again           |     |   server       |\n                      |   using PK_Y  +--------------\u003e   check PK_Y   |\n                      |                        |     |                |\n                      |                        |     |                |\n                      +------------------------+     +----------------+\n```\n\n## Ports to other platforms\n\n * [sshpiper on OpenWrt](https://github.com/ihidchaos/sshpiper-openwrt) by [@ihidchaos](https://github.com/ihidchaos)\n\n## Migrating from `v0`\n\n### What's the major change in `v1`\n \n * low level sshpiper api is fully redesigned to support more routing protocols.\n * plugins system totally redesigned to be more flexible and extensible.\n   * plugins are now separated from main process and no longer a single big binary, this allow user to write their own plugins without touching `sshpiperd` code.\n * `grpc` is first class now, the plugins are built on top of it\n\nFor plugins already in `v1`, you need change params to new params. However, not all plugins are migrated to `v1` yet, they are being migrated gradually. you can still use the old plugins in [`v0` branch](https://github.com/tg123/sshpiper/tree/v0)\n\n\n## Contributing\n\nsee [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## License\nMIT\n","funding_links":["https://github.com/sponsors/tg123"],"categories":["Go","Apps"],"sub_categories":["Network"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftg123%2Fsshpiper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftg123%2Fsshpiper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftg123%2Fsshpiper/lists"}