Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help me create a cool 'pv' monitor of an ssh tunnel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dkasak
n00b
n00b


Joined: 10 Feb 2012
Posts: 61

PostPosted: Fri Jul 07, 2017 6:19 am    Post subject: Help me create a cool 'pv' monitor of an ssh tunnel Reply with quote

Hi all. This should be easy, but I can't quite make it work.

I regularly set up an ssh tunnel for database traffic to remote servers, eg:

Code:
ssh -CL 15432:127.0.0.1:5432 remote.db


What I want to do is forward DB traffic through 'pv', so I can get a nice graphical representation of traffic flowing. I've tried:

Code:
nc -l -p 10000 | pv -b | nc -l -p 11000
ssh -CL 11000:127.0.0.1:5432 remote.db


... but it seems that 'nc' binds to the port, and ssh can't get hold of it. I'm not sure if there is a way of telling 'nc' to connect to a port without binding to it? So anyway, I next tried:

Code:
nc -l -p 10000 | pv -b | socat - TCP4:127.0.0.1:11000
ssh -CL 11000:127.0.0.1:5432 remote.db


... and this at least doesn't give any errors, but it also doesn't work. What's the easiest way of achieving what I'm trying to do?
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3647
Location: Hamburg

PostPosted: Fri Jul 07, 2017 7:14 am    Post subject: Re: Help me create a cool 'pv' monitor of an ssh tunnel Reply with quote

dkasak wrote:
Code:
ssh -CL 15432:127.0.0.1:5432 remote.db
Maybe OT, but :
Code:
 -C      Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11,
             TCP and UNIX-domain connections).  The compression algorithm is the same used by gzip(1), and
             the “level” can be controlled by the CompressionLevel option for protocol version 1.  Compres‐
             sion is desirable on modem lines and other slow connections, but will only slow down things on
             fast networks.  The default value can be set on a host-by-host basis in the configuration files;
             see the Compression option.
furthermore compression lowers cryptographic security IIRC.
Back to top
View user's profile Send private message
dkasak
n00b
n00b


Joined: 10 Feb 2012
Posts: 61

PostPosted: Mon Jul 10, 2017 12:04 am    Post subject: Reply with quote

Yes I've found that using compression speeds things up a LOT on my high-speed copper ADSL2 line. Australia doesn't believe in fast internet.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum