Skip to content

Commit

Permalink
Merge pull request #12 from ikari7789/update-phpseclib
Browse files Browse the repository at this point in the history
Updated PHPSecLib from 0.3.x to 2.X.
  • Loading branch information
tshafer committed Sep 26, 2015
2 parents 4dd232d + 2070f0c commit 0384fe9
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 84 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ language: php
php:
- 5.5
- 5.6
- 7.0
- hhvm

sudo: false

install: travis_retry composer install --no-interaction --prefer-source

script: vendor/bin/phpunit
script: vendor/bin/phpunit
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"php": ">=5.5.9",
"illuminate/support": "5.1.*",
"illuminate/filesystem": "5.1.*",
"phpseclib/phpseclib": "0.3.*"
"phpseclib/phpseclib": "^2.0"
},
"require-dev": {
"illuminate/console": "5.1.*",
Expand Down
99 changes: 53 additions & 46 deletions config/remote.php
Original file line number Diff line number Diff line change
@@ -1,49 +1,56 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Default Remote Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify the default connection that will be used for SSH
| operations. This name should correspond to a connection name below
| in the server list. Each connection will be manually accessible.
|
*/
'default' => 'production',
/*
|--------------------------------------------------------------------------
| Remote Server Connections
|--------------------------------------------------------------------------
|
| These are the servers that will be accessible via the SSH task runner
| facilities of Laravel. This feature radically simplifies executing
| tasks on your servers, such as deploying out these applications.
|
*/
'connections' => [
'production' => [
'host' => '',
'username' => '',
'password' => '',
'key' => '',
'keytext' => '',
'keyphrase' => '',
'agent' => '',
],
],
/*
|--------------------------------------------------------------------------
| Remote Server Groups
|--------------------------------------------------------------------------
|
| Here you may list connections under a single group name, which allows
| you to easily access all of the servers at once using a short name
| that is extremely easy to remember, such as "web" or "database".
|
*/
'groups' => [
'web' => ['production'],
return [

/*
|--------------------------------------------------------------------------
| Default Remote Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify the default connection that will be used for SSH
| operations. This name should correspond to a connection name below
| in the server list. Each connection will be manually accessible.
|
*/

'default' => 'production',

/*
|--------------------------------------------------------------------------
| Remote Server Connections
|--------------------------------------------------------------------------
|
| These are the servers that will be accessible via the SSH task runner
| facilities of Laravel. This feature radically simplifies executing
| tasks on your servers, such as deploying out these applications.
|
*/

'connections' => [
'production' => [
'host' => '',
'username' => '',
'password' => '',
'key' => '',
'keytext' => '',
'keyphrase' => '',
'agent' => '',
],
];
],

/*
|--------------------------------------------------------------------------
| Remote Server Groups
|--------------------------------------------------------------------------
|
| Here you may list connections under a single group name, which allows
| you to easily access all of the servers at once using a short name
| that is extremely easy to remember, such as "web" or "database".
|
*/

'groups' => [
'web' => ['production'],
],

];
50 changes: 27 additions & 23 deletions phpunit.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
<?php
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Set The Default Timezone
|--------------------------------------------------------------------------
|
| Here we will set the default timezone for PHP. PHP is notoriously mean
| if the timezone is not explicitly set. This will be used by each of
| the PHP date and date-time functions throughout the application.
|
*/
date_default_timezone_set('UTC');

/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/

require __DIR__.'/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Set The Default Timezone
|--------------------------------------------------------------------------
|
| Here we will set the default timezone for PHP. PHP is notoriously mean
| if the timezone is not explicitly set. This will be used by each of
| the PHP date and date-time functions throughout the application.
|
*/

date_default_timezone_set('UTC');
2 changes: 2 additions & 0 deletions src/RemoteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function boot()

$this->registerCommands();
}

/**
* Register the service provider.
*
Expand Down Expand Up @@ -68,6 +69,7 @@ protected function registerTailCommand()
return new TailCommand();
});
}

/**
* Get the services provided by the provider.
*
Expand Down
25 changes: 13 additions & 12 deletions src/SecLibGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace Collective\Remote;

use Crypt_RSA;
use Illuminate\Filesystem\Filesystem;
use Net_SFTP;
use System_SSH_Agent;
use phpseclib\Crypt\RSA;
use phpseclib\Net\SFTP;
use phpseclib\Net\SSH2;
use phpseclib\System\SSH\Agent;

class SecLibGateway implements GatewayInterface
{
Expand Down Expand Up @@ -145,7 +146,7 @@ public function getString($remote)
*/
public function put($local, $remote)
{
$this->getConnection()->put($remote, $local, NET_SFTP_LOCAL_FILE);
$this->getConnection()->put($remote, $local, SFTP::SOURCE_LOCAL_FILE);
}

/**
Expand Down Expand Up @@ -205,7 +206,7 @@ public function delete($remote)
*/
public function nextLine()
{
$value = $this->getConnection()->_get_channel_packet(NET_SSH2_CHANNEL_EXEC);
$value = $this->getConnection()->_get_channel_packet(SSH2::CHANNEL_EXEC);

return $value === true ? null : $value;
}
Expand Down Expand Up @@ -309,21 +310,21 @@ protected function useAgent()
/**
* Get a new SSH Agent instance.
*
* @return \System_SSH_Agent
* @return \phpseclib\System\SSH\Agent
*/
public function getAgent()
{
return new System_SSH_Agent();
return new Agent();
}

/**
* Get a new RSA key instance.
*
* @return \Crypt_RSA
* @return \phpseclib\Crypt\RSA
*/
public function getNewKey()
{
return new Crypt_RSA();
return new RSA();
}

/**
Expand Down Expand Up @@ -357,16 +358,16 @@ public function getPort()
}

/**
* Get the underlying Net_SFTP connection.
* Get the underlying SFTP connection.
*
* @return \Net_SFTP
* @return \phpseclib\Net\SFTP
*/
public function getConnection()
{
if ($this->connection) {
return $this->connection;
}

return $this->connection = new Net_SFTP($this->host, $this->port);
return $this->connection = new SFTP($this->host, $this->port);
}
}
3 changes: 2 additions & 1 deletion tests/RemoteSecLibTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
use Mockery as m;

use Mockery as m;

class RemoteSecLibGatewayTest extends PHPUnit_Framework_TestCase
{
Expand Down

0 comments on commit 0384fe9

Please sign in to comment.