|
|
@ -22,8 +22,8 @@ class SshConnector extends CPHPBaseClass
|
|
|
|
public $host = "localhost";
|
|
|
|
public $host = "localhost";
|
|
|
|
public $port = 22;
|
|
|
|
public $port = 22;
|
|
|
|
public $user = "root";
|
|
|
|
public $user = "root";
|
|
|
|
public $key = "/etc/cvm/key";
|
|
|
|
public $key = "";
|
|
|
|
public $pubkey = "/etc/cvm/key.pub";
|
|
|
|
public $pubkey = "";
|
|
|
|
public $keytype = "ssh-rsa";
|
|
|
|
public $keytype = "ssh-rsa";
|
|
|
|
|
|
|
|
|
|
|
|
public function RunCommand($command)
|
|
|
|
public function RunCommand($command)
|
|
|
@ -64,7 +64,7 @@ class SshConnector extends CPHPBaseClass
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$options = array(
|
|
|
|
$options = array(
|
|
|
|
'hostkey' => $this->keytype
|
|
|
|
'hostkey' => $this->keytype
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if($this->connection = ssh2_connect($this->host, $this->port, $options))
|
|
|
|
if($this->connection = ssh2_connect($this->host, $this->port, $options))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -97,9 +97,10 @@ class SshConnector extends CPHPBaseClass
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private function DoCommand()
|
|
|
|
private function DoCommand($command)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$stream = ssh2_exec($this->connection, $command);
|
|
|
|
|
|
|
|
echo($stream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|