10-27-2010
Can you try something like this? Source:
Net::OpenSSH
Quote:
mod_perl and mod_perl2
mod_perl and mod_perl2 tie STDIN and STDOUT to objects that are not backed up by real file descriptors at the operative system level. Net::OpenSSH will fail if any of these handles is used explicetly or implicitly when calling some remote command.
The workaround is to redirect them to /dev/null or to some file:
open my $def_in, '<', '/dev/null' or die "unable to open /dev/null";
my $ssh = Net::OpenSSH->new($host,
default_stdin_fh => $def_in);
my $out = $ssh->capture($cmd1);
$ssh->system({stdout_discard => 1}, $cmd2);
$ssh->system({stdout_to_file => '/tmp/output'}, $cmd3);
Also, note that from a security stand point, running ssh from inside the webserver process is not a great idea. An attacker exploiting some Apache bug would be able to access the ssh keys and passwords and gain unlimited access to the remote systems.
If you can, use a queue (as
TheSchwartz) or any other mechanism to execute the ssh commands from another process running under a different user account.
At a minimum, ensure that ~www-data/.ssh (or similar) is not accessible through the web server!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to install openssh v2.9-p2 on Solaris 8. I already installed zlib and openssl, as required in INSTALL file. But when I issue ./configure to configure openssh v2.9-p2 for my platform ( I got the sources), it stops in the folowing message:
checking for OpenSSL directory... configure:... (1 Reply)
Discussion started by: htsubamoto
1 Replies
2. UNIX for Dummies Questions & Answers
Help! SSH is returning the following error message:
OpenSSL version mismatch. Built against 90581f, you have 90602f
How can I correct this? (21 Replies)
Discussion started by: chenly
21 Replies
3. Shell Programming and Scripting
hi,
i have a script that coverts the file time in epoch time.but the problem is perl is not working inside the k-shell
----------------------------------------------------------------
#!/bin/ksh
echo "Enter the file"
read n
perl -e 'print ((stat("n")))'... (6 Replies)
Discussion started by: ali560045
6 Replies
4. UNIX for Dummies Questions & Answers
When I first link a computer with ssh ,
the information "Warning: Permanently added ... (RSA) to the list of known hosts." will be occured.
How can i avoid this information without use the parameter '-q'?
tks!!! (2 Replies)
Discussion started by: ragehunter
2 Replies
5. UNIX Desktop Questions & Answers
Hello,
I downloaded Cygwin to practice on my coursework from home. I was told to download the OpenSSH from Cygwin website so that I can access my files from home. However, the file saves itself with a cgi extension and I have no idea as to what I am supposed to do next. I found info on some... (1 Reply)
Discussion started by: feliks0
1 Replies
6. AIX
Hello,
I am new in aix unix. First i install openssl - success, next step i try install openssh when i put command geninstall -Y -d /myssh openssh.base i have this message:
What is the problem?
Thanks for help.
Sorry for my bad english i still learning.
---------- Post updated at... (2 Replies)
Discussion started by: bieszczaders
2 Replies
7. Fedora
Hello,
I cannot seem to loggon to a machine using ssh/scp. Whenevr I do it closes the connection (error message : lost connection)but it appears to be the host machine closing rather than the destination which puzzles me even more. What is even weirder is that as a root user it works but as a... (1 Reply)
Discussion started by: mojoman
1 Replies
8. UNIX for Advanced & Expert Users
As in the ssh(1) man page:
-R bind_address:]port:host:hostport
.......By default, the listening socket on the server will be bound to the loopback interface only. This may be overridden by specifying a bind_address. An empty bind_address, or the address `*', indicates... (2 Replies)
Discussion started by: ahmad.zuhd
2 Replies
9. Web Development
Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect.
Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is
redirected to welcome page.
My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies
10. Red Hat
Hi
im using redhat enterprise linux 7
im trying to update to the latest openssh version 6.8
i ran the command yum update openssh and this upgraded only to version 6.6
how can i update to the latest version 6.8?
thanks! (5 Replies)
Discussion started by: guy3145
5 Replies
LEARN ABOUT MOJAVE
net::ldap::control::syncdone5.18
Net::LDAP::Control::SyncDone(3) User Contributed Perl Documentation Net::LDAP::Control::SyncDone(3)
NAME
Net::LDAP::Control::SyncDone - LDAPv3 Sync Done control object
SYNOPSIS
See Net::LDAP::Control::SyncRequest
DESCRIPTION
"Net::LDAP::Control::SyncDone" provides an interface for the creation and manipulation of objects that represent the "Sync Request Control"
as described by RFC 4533.
CONSTRUCTOR ARGUMENTS
In addition to the constructor arguments described in Net::LDAP::Control the following are provided.
cookie
refreshDeletes
METHODS
As with Net::LDAP::Control each constructor argument described above is also available as a method on the object which will return the
current value for the attribute if called without an argument, and set a new value for the attribute if called with an argument.
SEE ALSO
Net::LDAP, Net::LDAP::Control, Net::LDAP::Control::SyncRequest, Net::LDAP::Control::SyncState, http://www.ietf.org/rfc/rfc4533.txt
AUTHOR
Mathieu Parent <math.parent@gmail.com>
Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org>
COPYRIGHT
Copyright (c) 2008 Mathieu Parent. All rights reserved. This program is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.
perl v5.18.2 2013-07-21 Net::LDAP::Control::SyncDone(3)