PHPackages                             clue/reactphp-ssh-proxy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. clue/reactphp-ssh-proxy

ActiveLibrary[Queues &amp; Workers](/categories/queues)

clue/reactphp-ssh-proxy
=======================

Async SSH proxy connector and forwarder, tunnel any TCP/IP-based protocol through an SSH server, built on top of ReactPHP

v1.4.0(3y ago)2116.3k↑18.1%7[6 issues](https://github.com/clue/reactphp-ssh-proxy/issues)5MITPHPPHP &gt;=5.3CI passing

Since Dec 19Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/clue/reactphp-ssh-proxy)[ Packagist](https://packagist.org/packages/clue/reactphp-ssh-proxy)[ Docs](https://github.com/clue/reactphp-ssh-proxy)[ Fund](https://clue.engineering/support)[ GitHub Sponsors](https://github.com/clue)[ RSS](/packages/clue-reactphp-ssh-proxy/feed)WikiDiscussions 1.x Synced 3d ago

READMEChangelog (6)Dependencies (10)Versions (7)Used By (5)

clue/reactphp-ssh-proxy
=======================

[](#cluereactphp-ssh-proxy)

[![CI status](https://github.com/clue/reactphp-ssh-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/reactphp-ssh-proxy/actions)[![installs on Packagist](https://camo.githubusercontent.com/43c0e8926ba1cc00c71bebfee618cebd20f72a6b5c9765ef5210d1c9635a0a76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c75652f72656163747068702d7373682d70726f78793f636f6c6f723d626c7565266c6162656c3d696e7374616c6c732532306f6e2532305061636b6167697374)](https://packagist.org/packages/clue/reactphp-ssh-proxy)

Async SSH proxy connector and forwarder, tunnel any TCP/IP-based protocol through an SSH server, built on top of [ReactPHP](https://reactphp.org/).

[Secure Shell (SSH)](https://en.wikipedia.org/wiki/Secure_Shell) is a secure network protocol that is most commonly used to access a login shell on a remote server. Its architecture allows it to use multiple secure channels over a single connection. Among others, this can also be used to create an "SSH tunnel", which is commonly used to tunnel HTTP(S) traffic through an intermediary ("proxy"), to conceal the origin address (anonymity) or to circumvent address blocking (geoblocking). This can be used to tunnel any TCP/IP-based protocol (HTTP, SMTP, IMAP etc.) and as such also allows you to access local services that are otherwise not accessible from the outside (database behind firewall). This library is implemented as a lightweight process wrapper around the `ssh` client binary and provides a simple API to create these tunneled connections for you. Because it implements ReactPHP's standard [`ConnectorInterface`](https://github.com/reactphp/socket#connectorinterface), it can simply be used in place of a normal connector. This makes it fairly simple to add SSH proxy support to pretty much any existing higher-level protocol implementation.

- **Async execution of connections** - Send any number of SSH proxy requests in parallel and process their responses as soon as results come in. The Promise-based design provides a *sane* interface to working with out of order responses and possible connection errors.
- **Standard interfaces** - Allows easy integration with existing higher-level components by implementing ReactPHP's standard [`ConnectorInterface`](https://github.com/reactphp/socket#connectorinterface).
- **Lightweight, SOLID design** - Provides a thin abstraction that is [*just good enough*](https://en.wikipedia.org/wiki/Principle_of_good_enough)and does not get in your way. Builds on top of well-tested components and well-established concepts instead of reinventing the wheel.
- **Good test coverage** - Comes with an automated tests suite and is regularly tested against actual SSH servers in the wild.

**Table of contents**

- [Support us](#support-us)
- [Quickstart example](#quickstart-example)
- [API](#api)
    - [SshProcessConnector](#sshprocessconnector)
    - [SshSocksConnector](#sshsocksconnector)
- [Usage](#usage)
    - [Plain TCP connections](#plain-tcp-connections)
    - [Secure TLS connections](#secure-tls-connections)
    - [HTTP requests](#http-requests)
    - [Database tunnel](#database-tunnel)
    - [Connection timeout](#connection-timeout)
    - [DNS resolution](#dns-resolution)
    - [Password authentication](#password-authentication)
- [Install](#install)
- [Tests](#tests)
- [License](#license)
- [More](#more)

Support us
----------

[](#support-us)

We invest a lot of time developing, maintaining and updating our awesome open-source projects. You can help us sustain this high-quality of our work by [becoming a sponsor on GitHub](https://github.com/sponsors/clue). Sponsors get numerous benefits in return, see our [sponsoring page](https://github.com/sponsors/clue)for details.

Let's take these projects to the next level together! 🚀

Quickstart example
------------------

[](#quickstart-example)

The following example code demonstrates how this library can be used to send a secure HTTPS request to google.com through a remote SSH server:

```
