Commit Graph

305 Commits

Author SHA1 Message Date
terrafrost
c5f74eb3a3 Merge branch 'master' of https://github.com/phpseclib/phpseclib into openssl-support 2014-12-13 14:15:34 -06:00
Andreas Fischer
0efae5a91e Change copyright years from roman numeral to decimal numbers. 2014-12-10 00:04:08 +01:00
terrafrost
96eb1f3797 SSH2: simplify _send_channel_packet
the last _send_channel_packet was unnecessarily complex. this lead
to a number of problems. for example,

the window size was checked for adjustments in two places. in the
second place it receives a window adjustment packet and just assumes
that the window adjustment packet was big enough for the rest of the
data.

(thanks, pixall!)
2014-12-05 22:01:39 -06:00
terrafrost
8fc4f4b70c Merge branch 'master' of https://github.com/phpseclib/phpseclib into openssl-support 2014-11-29 07:46:06 -06:00
terrafrost
b1e6643032 SSH2: clarify exec() docblock comment 2014-11-19 22:38:19 -06:00
terrafrost
3eac2582d6 SSH2: fix issues with RSA key verification
Sometimes SSH servers will null pad their RSA keys. this null padding
broke Net/SSH2.php's RSA implementation (Crypt/RSA.php's implementation
works just fine). Also, the -3 was counting the initial "\0" of $h
twice so adjust it to -2.
2014-11-06 11:58:03 -06:00
terrafrost
361b59fff9 SSH2: make setCryptoEngine() less cumbersome 2014-10-11 23:40:56 -05:00
terrafrost
959c0cefae SSH2: add setCryptoEngine() function 2014-10-11 23:26:46 -05:00
terrafrost
ff4d563f4f SSH2: CS adjustments 2014-10-11 23:20:44 -05:00
Cezary Kluczyński
0692a1ea7d SSH2: removed redundant rtrim 2014-09-28 12:39:54 +02:00
terrafrost
67279d7811 SSH2: rm unused constant
it doesn't need to be defined since the strlen($this->last_interactive_response)
check in _login_helper serves the same purpose that NET_SSH_MASK_LOGIN_INTERACTIVE
was intended to serve
2014-09-06 20:30:01 -05:00
terrafrost
9e71e0bce8 SSH2: don't count data length against window size
it is my hope that the issues 8c9e7a890e
and ccb1c3e2bd sought to resolve were
fixed 9f8d8a7bf6 and
7a2c7a414c.
2014-08-30 15:26:23 -05:00
Andreas Fischer
1de939fb4a Merge pull request #427 from terrafrost/ssh2-show-methods-before-login
SSH2: make it so negotiated algorithms can be seen before login

* terrafrost/ssh2-show-methods-before-login:
  SSH2: white space adjustment
  SSH: update getServerPublicHostKey() to use new _connect() method
  SSH2: fix if statement for conditional _connect() call
  simplify calls to $this->_connect()
  SSH2: make it so negotiated algorithms can be seen before login
2014-08-10 12:10:04 +02:00
terrafrost
04e263bb8c SSH2: white space adjustment 2014-08-10 02:09:28 -05:00
terrafrost
085fb0ebb8 SSH: update getServerPublicHostKey() to use new _connect() method 2014-08-06 14:42:08 -05:00
terrafrost
5b019b22d9 SSH2: fix if statement for conditional _connect() call 2014-08-05 19:30:14 -05:00
terrafrost
dffef50838 simplify calls to $this->_connect() 2014-08-04 20:11:34 -05:00
Andreas Fischer
2ccb301c4c Merge pull request #425 from bantu/ssh-remove-none-mac
SSH2: Disallow the none MAC.

* bantu/ssh-remove-none-mac:
  SSH2: Disallow the none MAC.
2014-07-26 13:14:39 +02:00
Andreas Fischer
4be4533a6e ssh-hmac-sha2-256: Remove whitespace at end of line. 2014-07-26 13:02:52 +02:00
terrafrost
49079fa1b4 SSH2: make it so negotiated algorithms can be seen before login 2014-07-25 10:03:31 -05:00
Dag Wieers
1a330b68e2 Added RFC6668
Added the requested changed.
2014-07-25 14:10:01 +02:00
Dag Wieers
86d17c6989 Add hmac-sha2-256 MAC support
This small patch adds hmac-sha2-256 support separately as requested in #423.

Some security standards now recommend to disable MD5 and SHA1, and use SHA2 instead. This change was tested using SHA2 against RHEL6's OpenSSH v5.3p1 and Solaris 11. And was also tested with RHEL5's OpenSSH 4.3p2 which doesn't include SHA2.
2014-07-25 12:28:08 +02:00
Andreas Fischer
1aecc5e3d8 SSH2: Disallow the none MAC. 2014-07-25 12:18:11 +02:00
Andreas Fischer
a0a23cbaf1 Merge pull request #406 from bantu/remove-ssh-arcfour
Remove the arcfour and none ciphers from SSH2.

* bantu/remove-ssh-arcfour:
  Comment out (potentially) insecure ciphers arcfour and none.
2014-07-22 16:09:14 +02:00
terrafrost
9dd3db4a49 SSH2: don't remove old $this->bitmap values 2014-07-21 16:41:39 -05:00
Andreas Fischer
84ac305704 Comment out (potentially) insecure ciphers arcfour and none. 2014-07-21 12:16:49 +02:00
Andreas Fischer
678d0cc792 Make Net_SSH2::isConnected() return a boolean instead of int. 2014-07-20 23:03:06 +02:00
terrafrost
ac2fc96263 SSH2: make isConnected return true if even if we're not logged in 2014-07-20 11:24:16 -05:00
liutec
10597aed64 Removed white-spaces from line ends 2014-06-22 22:30:52 +03:00
liutec
8e1df6e3c3 Allow setting the terminal window size 2014-06-20 13:04:17 +03:00
Andreas Fischer
709c7c4d48 Merge pull request #385 from bantu/a-random-change
Random: include the Crypt_* classes if they're available

* bantu/a-random-change:
  phpseclib_is_includable() -> phpseclib_resolve_include_path()
  Drop Net_SSH2::_is_includable() method.
  Random: a few changes to the stream_resolve_include_path_function
  Replace stream_resolve_include_path with phpseclib_is_includable.
  Random: add explanatory comment
  SSH2: replace _is_includable() with stream_resolve_include_path
  Random: include the Crypt_* classes if they're available
2014-06-19 16:08:59 +02:00
Andreas Fischer
fd65c55720 phpseclib_is_includable() -> phpseclib_resolve_include_path() 2014-06-19 14:57:09 +02:00
Andreas Fischer
1afbea613d Drop Net_SSH2::_is_includable() method. 2014-06-18 23:41:26 +02:00
Andreas Fischer
9c90beaf82 Replace stream_resolve_include_path with phpseclib_is_includable. 2014-06-17 14:38:24 +02:00
terrafrost
5f56781261 SSH2: make it so you can verify server public host key without logging on 2014-06-16 10:19:34 -05:00
terrafrost
4401b7e21e SSH2: replace _is_includable() with stream_resolve_include_path 2014-06-16 09:47:13 -05:00
terrafrost
246e9e154f SSH2: make $mac_algorithms non-static
none of the other statically defined variables have the potential
to change as multiple Net_SSH2 objects are created but this one does.

ie. if you connect to one SSH-2.0-SSHD server then no subsequent server
will use hmac-sha1-96 even if it could
2014-06-10 23:08:56 -05:00
Andreas Fischer
e6f87318f5 Adjust documentation to coding guidelines: No () around include. 2014-06-01 23:28:49 +02:00
terrafrost
db32efb276 SSH2: 0x7FFFFFFF -> $this->window_size in one more place 2014-05-26 17:57:14 -05:00
terrafrost
0dd929341b SSH2: make it so callback functions can make exec() return early 2014-05-26 17:37:32 -05:00
terrafrost
efd3b96dc8 SSH2: improve handling of incomplete packets 2014-04-18 16:58:00 -05:00
Andreas Fischer
b676cc2690 Merge pull request #241 from mpscholten/ssh2-tests
Added some simple Net_SSH2 tests

* mpscholten/ssh2-tests:
  Added some simple Net_SSH2 tests

Conflicts:
	tests/Net/SSH2Test.php
2014-04-18 16:54:24 +02:00
terrafrost
79719e8f74 SSH2: move _connect() call to _login() from login()
Per bantu, this is required for it to work with Net/SFTP.php
2014-04-08 08:48:12 -05:00
terrafrost
0ad0bb4c37 SSH2: phpdoc updates 2014-04-07 15:43:31 -05:00
terrafrost
677a291cb3 SSH: clarify role of constructor / connection timeout
Also, in Net_SSH2::_connect() $host is used in multiple places. Rather than changing all references to {$this->host}:{$this->port} preserve existing $host reference and update it accordingly
2014-04-07 10:26:46 -05:00
terrafrost
6fcfe5c885 SSH2: != -> |= 2014-04-07 00:25:38 -05:00
terrafrost
8f08301744 SSH2: phpdoc changes 2014-04-07 00:19:35 -05:00
terrafrost
ab341df973 SSH2: syntax error 2014-04-07 00:16:54 -05:00
terrafrost
f27a49299e SSH2: timeout set in constructor != timeout set by setTimeout() 2014-04-07 00:02:03 -05:00
terrafrost
fc748346fc SSH2: add phpdoc header 2014-04-06 23:56:21 -05:00
terrafrost
a14e71f38b SSH2: connect to server in login() function
this change will make it so some parameters can be set after the
Net_SSH2 object has been created. eg. instead of doing
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX) one can now do
$ssh->setLogging(...) or something.
2014-04-06 23:45:25 -05:00
terrafrost
7a2c7a414c fix more ssh channel issues
In logs that were provided to me phpseclib sent a packet that was 2536 bytes long (excluding the bytes denoting the channel and data length) but the length packet said it was 32764 bytes long (ie. $max_size).

So when $max_size is less than the data being sent and has to be adjusted by a new window adjust message from the server and the adjustment makes $max_Size bigger than the data being sent over problems arise.

SSH's window size has caused issues before. Overall I don't think the SSH specs really explain the window size very well. I opened up an errata on SSH's RFC a while back about the issue.
2014-03-21 02:53:43 -05:00
Andreas Fischer
fb1296bbec Drop meaningless, outdated, inconsistent version tags in doc blocks.
find phpseclib -type f -name "*.php" -exec sed -i '/@version/d' {} \;
2014-03-11 15:58:33 +01:00
Nicky Gerritsen
97d1e75a51 Use call_user_func, as this will work on PHP < 5.4, whereas $callback() does not 2014-03-05 15:44:17 +01:00
terrafrost
e90648c7a5 SSH2: add ssh-agent support 2014-02-10 00:04:16 -06:00
terrafrost
cd9801db8a SSH2: ignore exit_status channel requests
Fixes #258
2014-02-02 23:42:06 -06:00
Marc Philip Scholten
b7092ebc21 Added some simple Net_SSH2 tests
Placed helper at top again in my test

Removed a whitespace
2013-12-28 21:29:52 +01:00
terrafrost
268ec2e5d1 Merge branch 'ssh2-identifier' 2013-12-28 13:49:05 -06:00
terrafrost
0ccac2c998 SSH2: add new line in docblock comment 2013-12-28 13:47:24 -06:00
Marc Philip Scholten
19be15c4c4 Fixed typos 2013-12-28 18:16:09 +01:00
Marc Philip Scholten
ad0c7c52bd Fixed cs 2013-12-26 21:02:18 +01:00
Marc Philip Scholten
b0de383f95 Replaced else { if ()...} with elseif() {} 2013-12-26 21:02:17 +01:00
Marc Philip Scholten
357d4253ee Fixed typo 2013-12-26 21:00:58 +01:00
Marc Philip Scholten
4817d28a54 Refactored Net_SSH2::$identifier and added unit tests
Added return tag
2013-12-26 21:00:58 +01:00
Andreas Fischer
f63798b923 Merge pull request #233 from terrafrost/phar-fix
SSH2: better accomodate Phar's

* terrafrost/phar-fix:
  SSH2: better accomodate Phar's
2013-12-26 19:43:26 +01:00
Andreas Fischer
0f69d35584 Fix indentation of _append_log in SSH1 and SSH2. 2013-12-26 11:45:24 +01:00
Andreas Fischer
0dd5a9ba9f Merge pull request #228 from bantu/cs-whitespace
CS: Add useful whitespace CodeSniffer rules.

* bantu/cs-whitespace:
  CS: Add useful whitespace CodeSniffer rules.
2013-12-26 11:38:17 +01:00
terrafrost
70b9a69c46 SSH2: better accomodate Phar's 2013-12-26 01:55:05 -06:00
Andreas Fischer
8bb80b3df0 CS: Add useful whitespace CodeSniffer rules. 2013-12-26 00:33:08 +01:00
terrafrost
8424a464a6 SSH2: typos in last commit 2013-12-22 18:25:00 -06:00
terrafrost
0f5b3ea416 Compatibility fixes
- PHP4 doesn't allow method chaining
- $_SESSION isn't always defined
- on PHP5.1 and earlier using 0x100000000 instead of 4294967296 gives E_NOTICE
- array('Net_SSH2', 'func_name') doesn't work so we fix this by passing $this to it.
  to make that work on PHP4 pass by call-time reference. normally this would result
  in a fatal error on PHP5.4+ but doesn't seem to in this case. the following URL
  elaborates:

  http://stackoverflow.com/q/20732563/569976
2013-12-22 18:14:49 -06:00
terrafrost
4bd9a546ab Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-12-22 11:53:35 -06:00
terrafrost
6ac922726d SSH2: fix E_DEPRECATED on PHP5.5 2013-12-16 11:27:12 -06:00
terrafrost
c01b8fc4ed SCP: Tweaks
sending the close channel packet right after the eof seems to make some scp transfers terminate prematurely.

unfortunately, sometimes this behavior is undesirable as it is in this case:

http://www.frostjedi.com/phpbb3/viewtopic.php?f=46&t=29457

hence the $want_reply parameter

also, this commit makes the scp packet length account for the length portion
2013-12-15 00:43:20 -06:00
Andreas Fischer
f0f029b2c1 CS: Fix "PEAR.Commenting.ClassComment.WrongTagOrder" sniff. 2013-12-11 18:33:18 +01:00
Andreas Fischer
3db1fbb072 CS: Fix "PEAR.Commenting.FileComment.TagIndent" sniff. 2013-12-10 20:10:37 +01:00
Andreas Fischer
6d1fb9f7db CS: Fix "PEAR.Files.IncludingFile.UseIncludeOnce" sniff. 2013-12-06 01:03:34 +01:00
Andreas Fischer
bc6ff96292 Fix "PEAR.Files.IncludingFile.BracketsNotRequired" sniff. 2013-12-05 23:17:40 +01:00
Andreas Fischer
e09f1b730e CodeSniffer: Fix PEAR.Classes.ClassDeclaration.OpenBraceNewLine sniff. 2013-12-03 19:34:41 +01:00
Andreas Fischer
ca9c8b107b CodeSniffer: Fix Generic.PHP.LowerCaseConstant.Found sniff. 2013-12-03 18:54:43 +01:00
Andreas Fischer
399308f98a Merge pull request #180 from mpscholten/removed-vim-comments
Removed vim comments

* mpscholten/removed-vim-comments:
  Removed vim comments
2013-11-23 21:16:25 +01:00
Marc Philip Scholten
3bfd884813 Removed vim comments
Reformated files
2013-11-23 19:42:26 +01:00
phonzie
3afa655f57 SSH2: Continue Subsystem Implementation.
Removed unused piece of code @2352.
Added $this->_get_interactive_channel() to reset(). Unless we don't want to close the subsystem channel?? Leaving that decision up to you.
2013-11-20 16:17:23 -05:00
phonzie
eb3bffaa00 Update SSH2.php
Use of undefined property: "$this->bitmask".

In context, it seems that it should reference the "bitmap" property.
2013-11-15 13:34:31 -05:00
terrafrost
c6a52cb1b1 SSH2: add preliminary support for custom SSH subsystems 2013-10-25 12:35:30 -05:00
terrafrost
48b13bc1d7 SSH2: make it so realtime logs filter out password's
"Complex" logs already do this - just not realtime logs
2013-09-12 08:45:13 -05:00
terrafrost
9f8d8a7bf6 SSH2: window size handling adjustments 2013-09-12 08:29:14 -05:00
terrafrost
24a06eeff3 SSH2: neither of the DSA signature values should be 0 2013-08-31 00:22:47 -05:00
terrafrost
df45abcda0 SSH2: try to execute commands via interactive shell even if no pty 2013-08-20 23:52:15 -05:00
terrafrost
093a182904 SSH2: Logging updates 2013-07-26 09:57:20 -05:00
terrafrost
bf6da217c1 Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-07-22 23:53:45 -05:00
terrafrost
8c9e7a890e SSH2: more window size adjustments 2013-07-22 23:48:28 -05:00
terrafrost
78f9fadd3d SSH2: don't remove first byte from complex logs 2013-07-19 10:34:11 -05:00
terrafrost
415df3bd45 SSH2: attribute newly added comment 2013-07-18 10:35:39 -05:00
terrafrost
ccb1c3e2bd SSH2: include string length in window size adjustments 2013-07-17 23:21:25 -05:00
terrafrost
ffdcf843c1 Merge branch 'master' of https://github.com/phpseclib/phpseclib 2013-07-14 04:10:54 -05:00
terrafrost
0f96fae818 SSH2: channel handling adjustments
- keep track of server -> client window size and look out for NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST packets as appropriate
- send client -> server window size packets based on channel of received packet - not of desired channel
- buffer incoming packets based on received packets channel - not on desired channel
2013-07-14 04:09:16 -05:00
terrafrost
309f79ecea SSH2: attempt to handle case where window size is smaller than packet size 2013-07-07 16:10:12 -05:00
terrafrost
327a3b8bc8 SSH2: Keep track of client -> server window size 2013-07-07 15:57:15 -05:00
terrafrost
a6289036a0 SSH2: fix possible E_NOTICE 2013-07-07 15:49:49 -05:00