Re: [Ssh-sftp-perl-users] Problems with using Net::SSH::Perl/Net: :SFTP
Brought to you by:
dbrobins
From: Bryan B. <br...@bu...> - 2006-11-17 20:52:31
|
> No, it does not help (although I did at one time consider using something > similar). > > Of course The Conditions That Prevail at my work place and the > specifications of what I am attempting may be conflicting, and I have very > little leeway in changing those conditions. > > - My workplace's security policy requires secure transmission of data > between Servers My Department Is Responsible For to Servers My Department > Is > Not Responsible For. For secure communications ssh and related > technologies > are used, with a RSA-Public-Private key shared among the various > Departments. Separate SSH User Accounts are not to be used since they are > too insecure (according to our Security Department) and maintenance of > said > accounts are prone to errors. > - My Perl script is to be a Monolithic Script that can be incorporated > into > other applications. It is to use the same ssh and related technologies to > communicate between the Servers My Department Is Responsible For to > Servers > My Department Is Not Responsible For; however, the users of this script > are > to not even know anything of the secure transfers of data between the > several servers. > > Thus my request to find some way of creating and using > Net::SSH::Perl/Net:SFTP objects and somehow programmatically specifying to > the created object the RSA-Public Passphrase WITHOUT having the object > prompt for it or having this script prompt a user for a Passphrase they > are > not to be aware of. > > Frustrating... > > -------------------------------------------------- > James R. Swenson > Information Technology Services > The Pennsylvania State University > jr...@ps..., 814.863.1348 > > Sounds pretty confusing, but i'll take one more stab at it. You have password protected ssh keys you use between departments, correct? So you need to use key authentication, with a password, with no prompting, how about this: -- snip --> use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect("somehost") or die; if ($ssh2->auth_publickey("user", "/priv/key", "/pub/key", "passphrase")) { my $chan = $ssh2->channel(); my $sftp = $ssh2->sftp; my $fh = $sftp->open('/etc/passwd') or die; print $_ while <$fh>; } <-- snip -- Which is straight from the Net::SSH2 man page. I was not able to test it because my Net::SSH2 install is not working at the moment. But it "should" do the trick. It does not seem that Net::SSH::Perl supports password protected private keys. If that doesnt work, maybe you should use something like Expect and write your own stuff around the ssh command line tool. There are many programs out there, including one that I wote: Rover - http://www.sourceforge.net/projects/rover Good luck. Bryan http://www.sourceforge.net/projects/rover |