![]() ![]() So in my code, in the place where I commented "connect to remote MySQL via TCP at local 127.0.0.1:12345 / do your work here", that's what you should do :-) As far as I can tell, the tunnel should remain open until you kill the slave process. Sorry, I should have been more clear on that: As far as I can tell, the sleep is not necessary in my code, I was simply using it for testing as a placeholder instead of connecting to the DB and doing work. Re^3: How do you use Net::OpenSSH to query mysql database via ssh tunnel $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate" I'm not an expert on Net::OpenSSH so I can't say if there's a better way, but this worked for me (tested with a different server, not MySQL, but that shouldn't make a difference): You might be able to DIY using the ssh_opts option. Unlike when ssh -L options is used to create tunnels, no TCP port is opened on the local machine at any time so this is a perfectly secure operation. Under the hood, in order to create a tunnel, a new ssh process is spawned with the option -W$ (available from OpenSSH 5.4 and upwards) making it redirect its stdio streams to the remote given address. It seems like what you want is the equivalent of ssh -L, but looking into the documentation of Net::OpenSSH, I'm not sure that's supported, as it has this to say about tunnels: ![]() Re: How do you use Net::OpenSSH to query mysql database via ssh tunnelĪt the moment I don't see a way to hand an existing socket object like the one returned from $ssh->open_tunnel to DBD::mysql.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |