summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@tinyboard.org>2011-07-30 20:45:51 +1000
committerSavetheinternet <savetheinternet@tinyboard.org>2011-07-30 20:45:51 +1000
commite3918f71107d693ee39e0b6323e1f65b622fa6c2 (patch)
tree6d64824d13ab58e41cecb0e0e5f1aebbe3d20f09 /inc
parent7ff9cd6f2d97d5dda0e6655f9fd2f2ccd5eacedc (diff)
public key authentication for remote servers
Diffstat (limited to 'inc')
-rw-r--r--inc/functions.php1
-rw-r--r--inc/remote.php12
2 files changed, 11 insertions, 2 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 74313e82..523d82f5 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -259,7 +259,6 @@
global $config;
if(preg_match('/^remote:\/\/(.+)\:(.+)$/', $path, $m)) {
-
if(isset($config['remote'][$m[1]])) {
require_once 'inc/remote.php';
diff --git a/inc/remote.php b/inc/remote.php
index a4c9e68a..a69d3160 100644
--- a/inc/remote.php
+++ b/inc/remote.php
@@ -14,6 +14,16 @@
$this->connection = ssh2_connect($this->host, isset($this->port) ? $this->port : 22, $methods);
switch($this->auth['method']) {
+ case 'pubkey':
+
+ if(!isset($this->auth['public']))
+ error('Public key filename not specified.');
+ if(!isset($this->auth['private']))
+ error('Private key filename not specified.');
+
+ if(!ssh2_auth_pubkey_file($this->connection, $this->auth['username'], $this->auth['public'], $this->auth['private'], isset($this->auth['passphrase']) ? $this->auth['passphrase']: null))
+ error('Public key authentication failed.');
+ break;
case 'plain':
if(!ssh2_auth_password($this->connection, $this->auth['username'], $this->auth['password']))
error('Plain-text authentication failed.');
@@ -44,4 +54,4 @@
}
}
};
-?> \ No newline at end of file
+?>