**Author**: Pahaz Blinov
**Repo**: https://github.com/pahaz/sshtunnel/
Inspired: https://github.com/jmagnusson/bgtunnel but it don`t work on windows.
See also: https://github.com/paramiko/paramiko/blob/master/demos/forward.py
Require `paramiko`.
# Install #
pip install sshtunnel
or
easy_install sshtunnel
# SSH tunnels to remote server #
Useful when you need to connect to local port on remote server throw ssh
tunnel. It works by opening a port forwarding ssh connection in the
background, using threads. The connection(s) are closed when explicitly
calling the `close` method of the returned SSHTunnelForwarder object.
----------------------------------------------------------------------
|
-------------| | |----------| |---------
LOCAL | | | REMOTE | | PRIVATE
SERVER | <== SSH ========> | SERVER | <== local ==> | SERVER
-------------| | |----------| |---------
|
FIREWALL
----------------------------------------------------------------------
Fig1: How to connect to PRIVATE SERVER throw SSH tunnel.
## Ex 1: ##
import sshtunnel
with sshtunnel.open(
(ssh_host, ssh_port),
ssh_host_key=None,
ssh_username=ssh_user,
ssh_password=ssh_password,
ssh_private_key=None,
remote_bind_address=(REMOTE_HOST, REMOTE_PORT)) as server:
def do_something(port):
pass
print "LOCAL PORT:", server.local_bind_port
do_something(server.local_bind_port)
## Ex 2: ##
from sshtunnel import SSHTunnelForwarder
server = SSHTunnelForwarder(
ssh_address=('pahaz.urfuclub.ru', 22),
ssh_username="pahaz",
ssh_password="secret",
remote_bind_address=('127.0.0.1', 5555))
server.start()
print(server.local_bind_port)
# work with `SECRET SERVICE` throw `server.local_bind_port`.
server.stop()
# AUTHORS #
- [Pahaz Blinov](https://github.com/pahaz)
- [Cameron Maske](https://github.com/cameronmaske)
- [Gustavo Machado](https://github.com/gdmachado)
- [Colin Jermain](https://github.com/cjermain)
# CHANGELOG #
## work in progress ##
## v.0.0.3 ##
- add `threaded` options (cameronmaske)
- fix exception error message, correctly printing destination address (gdmachado)
- fix pip install fails (cjermain, pahaz)
## v.0.0.1 ##
- `SSHTunnelForwarder` class (pahaz)
- `open` function (pahaz)
**Repo**: https://github.com/pahaz/sshtunnel/
Inspired: https://github.com/jmagnusson/bgtunnel but it don`t work on windows.
See also: https://github.com/paramiko/paramiko/blob/master/demos/forward.py
Require `paramiko`.
# Install #
pip install sshtunnel
or
easy_install sshtunnel
# SSH tunnels to remote server #
Useful when you need to connect to local port on remote server throw ssh
tunnel. It works by opening a port forwarding ssh connection in the
background, using threads. The connection(s) are closed when explicitly
calling the `close` method of the returned SSHTunnelForwarder object.
----------------------------------------------------------------------
|
-------------| | |----------| |---------
LOCAL | | | REMOTE | | PRIVATE
SERVER | <== SSH ========> | SERVER | <== local ==> | SERVER
-------------| | |----------| |---------
|
FIREWALL
----------------------------------------------------------------------
Fig1: How to connect to PRIVATE SERVER throw SSH tunnel.
## Ex 1: ##
import sshtunnel
with sshtunnel.open(
(ssh_host, ssh_port),
ssh_host_key=None,
ssh_username=ssh_user,
ssh_password=ssh_password,
ssh_private_key=None,
remote_bind_address=(REMOTE_HOST, REMOTE_PORT)) as server:
def do_something(port):
pass
print "LOCAL PORT:", server.local_bind_port
do_something(server.local_bind_port)
## Ex 2: ##
from sshtunnel import SSHTunnelForwarder
server = SSHTunnelForwarder(
ssh_address=('pahaz.urfuclub.ru', 22),
ssh_username="pahaz",
ssh_password="secret",
remote_bind_address=('127.0.0.1', 5555))
server.start()
print(server.local_bind_port)
# work with `SECRET SERVICE` throw `server.local_bind_port`.
server.stop()
# AUTHORS #
- [Pahaz Blinov](https://github.com/pahaz)
- [Cameron Maske](https://github.com/cameronmaske)
- [Gustavo Machado](https://github.com/gdmachado)
- [Colin Jermain](https://github.com/cjermain)
# CHANGELOG #
## work in progress ##
## v.0.0.3 ##
- add `threaded` options (cameronmaske)
- fix exception error message, correctly printing destination address (gdmachado)
- fix pip install fails (cjermain, pahaz)
## v.0.0.1 ##
- `SSHTunnelForwarder` class (pahaz)
- `open` function (pahaz)
Metadata
Release files for sshtunnel 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sshtunnel-0.0.3.zip | 9.6 kB | Details |
Release files / sshtunnel-0.0.3.zip
| Download URL | sshtunnel-0.0.3.zip |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c344c40c3ffa7b4e4019aec965f23cf314d6198d42314b84fc58053a816830a
|
|
BLAKE2b-256 checksum How to use checksums |
4b4ad828e6fe19118340c5aba765a61c8b2c2969a47bbbbcefe91398b8e203e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |