From: Francis Cianfrocca Date: 2006-08-18T13:45:59+09:00 Subject: Re: Secure telnet and ftp? Hal Fulton wrote: > I'm rather ignorant of SSL and ssh... but I'm wishing > for a "compatibility" layer of some kind so that I > could use the old telnet and ftp interfaces (which I > know) but do it securely. > > In other words, something like: > > require 'ssh-compat' > > SSH::Compat.setup(*whatever) do > # ...whatever... > end > > # Now just use Net::FTP and Net::Telnet > # "just as if" they were the originals > > # Blah blah blah... > # all legacy code remains unchanged > > SSH::Compat.quit # I don't mind some "teardown" > # if it's needed > > > Is this practical/reasonable? > > Or is it Just As Easy to use the real secure ftp > and ssh stuff? > > > Thanks, > Hal I've done exactly what you're talking about in C before but not in Ruby. You establish an SSH tunnel, then run your operations through it (for FTP stick to passive mode), and then tear it down. It's rather hairy, you have to deal with authenticating to the remote host (probably a password-less local identity file, which suddenly makes your machine security-sensitive) or some trick with ssh-agent. And you also have to deal with all the edge conditions involved in having a tunnel going as a child process. (Like diddling your signal mask, making sure your code doesn't crash and leave the tunnel up, setting up an external wathcdog to ensure same, etc.) If your requirement is encrypted ftp, you're probably better off using scp and sftp, they work fine. Otherwise, I'd do the ssh tunnelling in an outboard process built for the task, not inline as you have it. Hope that helps. -- Posted via http://www.ruby-forum.com/.