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://clue.engineering/2018/introducing-reactphp-ssh-proxy
MIT License
21 stars 7 forks source link

Support secure TLS connections #4

Closed clue closed 5 years ago

clue commented 5 years ago

Currently, the SshProcessConnector allows creating plaintext TCP/IP connections which can be used by higher-level protocol implementations. It is implemented by spawning an SSH client like ssh -W google.com:80 user@example.com and will access the standard I/O process streams and represent this as a single connection.

Due to the way how ReactPHP's SecureConnector uses PHP's underlying stream_socket_enable_crypto() function, it requires an actual full-duplex socket stream and does not support the virtual stream returned by the SshProcessConnector. As such, it is currently impossible to create a secure TLS connection using this class.

We should support secure TLS connections as part of this library. While this will not be required for a number of use cases (such as accessing a plaintext database through an SSH tunnel), it is still a critical feature for other use cases (such as sending HTTPS requests through an SSH tunnel). I've started looking into possible implementation approaches and will keep this ticket updated as I make progress.