From 80829e5b805a68056e63b8f9f9b24fc56bafebb2 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 29 Apr 2012 03:17:30 +0200 Subject: [PATCH] Fixed SSH auth --- frontend/classes/class.sshconnector.php | 6 +++--- frontend/includes/include.base.php | 1 + frontend/test.php | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/classes/class.sshconnector.php b/frontend/classes/class.sshconnector.php index f9f182a..15913a2 100644 --- a/frontend/classes/class.sshconnector.php +++ b/frontend/classes/class.sshconnector.php @@ -72,11 +72,11 @@ class SshConnector extends CPHPBaseClass if(empty($this->passphrase)) { - $result = ssh2_auth_pubkey_file($this->user, $this->pubkey, $this->key); + $result = ssh2_auth_pubkey_file($this->connection, $this->user, $this->pubkey, $this->key); } else { - $result = ssh2_auth_pubkey_file($this->user, $this->pubkey, $this->key, $this->passphrase); + $result = ssh2_auth_pubkey_file($this->connection, $this->user, $this->pubkey, $this->key, $this->passphrase); } if($result === true) @@ -100,7 +100,7 @@ class SshConnector extends CPHPBaseClass private function DoCommand($command) { $stream = ssh2_exec($this->connection, $command); - echo($stream); + var_dump($stream); } } diff --git a/frontend/includes/include.base.php b/frontend/includes/include.base.php index 075755b..c60c639 100644 --- a/frontend/includes/include.base.php +++ b/frontend/includes/include.base.php @@ -13,6 +13,7 @@ $_CPHP = true; require("cphp/base.php"); +require("include.exceptions.php"); require("classes/class.controller.php"); require("classes/class.container.php"); require("classes/class.node.php"); diff --git a/frontend/test.php b/frontend/test.php index 1d02aee..b07ef44 100644 --- a/frontend/test.php +++ b/frontend/test.php @@ -6,4 +6,8 @@ $ssh = new SshConnector(); $ssh->host = "cvm-vz.cryto.net"; $ssh->key = "/etc/cvm/key"; $ssh->pubkey = "/etc/cvm/key.pub"; + +var_dump($ssh); + +$ssh->RunCommand("df -h"); ?>