Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Tunneling DBD::mysql connections over SSH without using external programs

by wwinfrey (Acolyte)
on Apr 11, 2013 at 21:30 UTC ( [id://1028235]=note: print w/replies, xml ) Need Help??


in reply to Re: Tunneling DBD::mysql connections over SSH without using external programs
in thread Tunneling DBD::mysql connections over SSH without using external programs

Right, I am very familiar with that technique. However, if you'll note from my post, my design goals dictate that I establish the tunneled connection without the use of exec() or open() calls to system binaries like the SSH client binary (/usr/bin/ssh) or socat.

I am not looking for how to do this from the shell; I am looking to do this completely from within the confines of my Perl application, mostly for portability issues, but also because this "application" I'm working on will be implemented as a custom module in an API I am designing.

Dependence on external programs in this situation seems sloppy and hard to maintain. I am looking for my fellow developers to simply "use" my module and not have to worry about installing anything else besides other Perl modules.

  • Comment on Re^2: Tunneling DBD::mysql connections over SSH without using external programs

Replies are listed 'Best First'.
Re^3: Tunneling DBD::mysql connections over SSH without using external programs
by salva (Canon) on Apr 12, 2013 at 08:16 UTC
    Then, there is only a realistic way to do that: write your own ssh implementation using Net::SSH2 able to redirect connections on a TCP port to the remote MySQL port trough SSH.

    Then in your module run this proxy in a new thread or process.

      I concur, Salva, that this is the approach I need to take. I'm more inclined to use Net::OpenSSH as it seems the most portable (and, as was pointed out by Krambambuli below, all the other modules are wrappers to one degree or another for external binaries). In my response below I distilled the issue down to "How do you make DBI connect with DBD::mysql over Net::OpenSSH tunnels ?" and I suppose that's the crux of the challenge.
        Net::OpenSSH does not work on Windows.

        If you just want to run a tunnel, you could use the native ssh client from your OS on Unix and on Windows use PuTTY's plink which could be distributed with your module. IIRC, it doesn't have any dependency.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1028235]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-19 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found