sonixlabs-net-ssh 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/CHANGELOG.rdoc +262 -0
  2. data/Manifest +121 -0
  3. data/README.rdoc +184 -0
  4. data/Rakefile +86 -0
  5. data/Rudyfile +96 -0
  6. data/THANKS.rdoc +19 -0
  7. data/lib/net/ssh.rb +223 -0
  8. data/lib/net/ssh/authentication/agent.rb +179 -0
  9. data/lib/net/ssh/authentication/constants.rb +18 -0
  10. data/lib/net/ssh/authentication/key_manager.rb +253 -0
  11. data/lib/net/ssh/authentication/methods/abstract.rb +60 -0
  12. data/lib/net/ssh/authentication/methods/hostbased.rb +75 -0
  13. data/lib/net/ssh/authentication/methods/keyboard_interactive.rb +70 -0
  14. data/lib/net/ssh/authentication/methods/password.rb +43 -0
  15. data/lib/net/ssh/authentication/methods/publickey.rb +96 -0
  16. data/lib/net/ssh/authentication/pageant.rb +264 -0
  17. data/lib/net/ssh/authentication/session.rb +146 -0
  18. data/lib/net/ssh/buffer.rb +340 -0
  19. data/lib/net/ssh/buffered_io.rb +198 -0
  20. data/lib/net/ssh/config.rb +207 -0
  21. data/lib/net/ssh/connection/channel.rb +630 -0
  22. data/lib/net/ssh/connection/constants.rb +33 -0
  23. data/lib/net/ssh/connection/session.rb +597 -0
  24. data/lib/net/ssh/connection/term.rb +178 -0
  25. data/lib/net/ssh/errors.rb +88 -0
  26. data/lib/net/ssh/key_factory.rb +102 -0
  27. data/lib/net/ssh/known_hosts.rb +129 -0
  28. data/lib/net/ssh/loggable.rb +61 -0
  29. data/lib/net/ssh/packet.rb +102 -0
  30. data/lib/net/ssh/prompt.rb +93 -0
  31. data/lib/net/ssh/proxy/command.rb +75 -0
  32. data/lib/net/ssh/proxy/errors.rb +14 -0
  33. data/lib/net/ssh/proxy/http.rb +94 -0
  34. data/lib/net/ssh/proxy/socks4.rb +70 -0
  35. data/lib/net/ssh/proxy/socks5.rb +142 -0
  36. data/lib/net/ssh/ruby_compat.rb +43 -0
  37. data/lib/net/ssh/service/forward.rb +298 -0
  38. data/lib/net/ssh/test.rb +89 -0
  39. data/lib/net/ssh/test/channel.rb +129 -0
  40. data/lib/net/ssh/test/extensions.rb +152 -0
  41. data/lib/net/ssh/test/kex.rb +44 -0
  42. data/lib/net/ssh/test/local_packet.rb +51 -0
  43. data/lib/net/ssh/test/packet.rb +81 -0
  44. data/lib/net/ssh/test/remote_packet.rb +38 -0
  45. data/lib/net/ssh/test/script.rb +157 -0
  46. data/lib/net/ssh/test/socket.rb +64 -0
  47. data/lib/net/ssh/transport/algorithms.rb +386 -0
  48. data/lib/net/ssh/transport/cipher_factory.rb +79 -0
  49. data/lib/net/ssh/transport/constants.rb +30 -0
  50. data/lib/net/ssh/transport/hmac.rb +42 -0
  51. data/lib/net/ssh/transport/hmac/abstract.rb +79 -0
  52. data/lib/net/ssh/transport/hmac/md5.rb +12 -0
  53. data/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
  54. data/lib/net/ssh/transport/hmac/none.rb +15 -0
  55. data/lib/net/ssh/transport/hmac/sha1.rb +13 -0
  56. data/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
  57. data/lib/net/ssh/transport/hmac/sha2_256.rb +15 -0
  58. data/lib/net/ssh/transport/hmac/sha2_256_96.rb +13 -0
  59. data/lib/net/ssh/transport/hmac/sha2_512.rb +14 -0
  60. data/lib/net/ssh/transport/hmac/sha2_512_96.rb +13 -0
  61. data/lib/net/ssh/transport/identity_cipher.rb +55 -0
  62. data/lib/net/ssh/transport/kex.rb +17 -0
  63. data/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +208 -0
  64. data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +80 -0
  65. data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +15 -0
  66. data/lib/net/ssh/transport/key_expander.rb +26 -0
  67. data/lib/net/ssh/transport/openssl.rb +127 -0
  68. data/lib/net/ssh/transport/packet_stream.rb +235 -0
  69. data/lib/net/ssh/transport/server_version.rb +71 -0
  70. data/lib/net/ssh/transport/session.rb +278 -0
  71. data/lib/net/ssh/transport/state.rb +206 -0
  72. data/lib/net/ssh/verifiers/lenient.rb +30 -0
  73. data/lib/net/ssh/verifiers/null.rb +12 -0
  74. data/lib/net/ssh/verifiers/strict.rb +53 -0
  75. data/lib/net/ssh/version.rb +62 -0
  76. data/lib/sonixlabs-net-ssh.rb +1 -0
  77. data/net-ssh.gemspec +145 -0
  78. data/setup.rb +1585 -0
  79. data/support/arcfour_check.rb +20 -0
  80. data/support/ssh_tunnel_bug.rb +65 -0
  81. data/test/authentication/methods/common.rb +28 -0
  82. data/test/authentication/methods/test_abstract.rb +51 -0
  83. data/test/authentication/methods/test_hostbased.rb +114 -0
  84. data/test/authentication/methods/test_keyboard_interactive.rb +100 -0
  85. data/test/authentication/methods/test_password.rb +52 -0
  86. data/test/authentication/methods/test_publickey.rb +148 -0
  87. data/test/authentication/test_agent.rb +205 -0
  88. data/test/authentication/test_key_manager.rb +171 -0
  89. data/test/authentication/test_session.rb +106 -0
  90. data/test/common.rb +107 -0
  91. data/test/configs/eqsign +3 -0
  92. data/test/configs/exact_match +8 -0
  93. data/test/configs/host_plus +10 -0
  94. data/test/configs/multihost +4 -0
  95. data/test/configs/wild_cards +14 -0
  96. data/test/connection/test_channel.rb +467 -0
  97. data/test/connection/test_session.rb +488 -0
  98. data/test/test_all.rb +9 -0
  99. data/test/test_buffer.rb +336 -0
  100. data/test/test_buffered_io.rb +63 -0
  101. data/test/test_config.rb +120 -0
  102. data/test/test_key_factory.rb +79 -0
  103. data/test/transport/hmac/test_md5.rb +39 -0
  104. data/test/transport/hmac/test_md5_96.rb +25 -0
  105. data/test/transport/hmac/test_none.rb +34 -0
  106. data/test/transport/hmac/test_sha1.rb +34 -0
  107. data/test/transport/hmac/test_sha1_96.rb +25 -0
  108. data/test/transport/hmac/test_sha2_256.rb +35 -0
  109. data/test/transport/hmac/test_sha2_256_96.rb +25 -0
  110. data/test/transport/hmac/test_sha2_512.rb +35 -0
  111. data/test/transport/hmac/test_sha2_512_96.rb +25 -0
  112. data/test/transport/kex/test_diffie_hellman_group1_sha1.rb +146 -0
  113. data/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +92 -0
  114. data/test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb +33 -0
  115. data/test/transport/test_algorithms.rb +308 -0
  116. data/test/transport/test_cipher_factory.rb +213 -0
  117. data/test/transport/test_hmac.rb +34 -0
  118. data/test/transport/test_identity_cipher.rb +40 -0
  119. data/test/transport/test_packet_stream.rb +736 -0
  120. data/test/transport/test_server_version.rb +78 -0
  121. data/test/transport/test_session.rb +315 -0
  122. data/test/transport/test_state.rb +179 -0
  123. metadata +178 -0
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,262 @@
1
+
2
+ === 2.3.0 / 11 Jan 2012
3
+
4
+ * Support for hmac-sha2 and diffie-hellman-group-exchange-sha256 [Ryosuke Yamazaki]
5
+
6
+ === 2.2.2 / 04 Jan 2012
7
+
8
+ * Fixed: Connection hangs on ServerVersion.new(socket, logger) [muffl0n]
9
+ * Avoid dying when unsupported auth mechanisms are defined [pcn]
10
+
11
+ === 2.2.1 / 24 Aug 2011
12
+
13
+ * Do not prompt any passphrases before trying all identities from agent. [musybite]
14
+ (see: http://net-ssh.lighthouseapp.com/projects/36253-net-ssh/tickets/30)
15
+
16
+ === 2.2.0 / 16 Aug 2011
17
+
18
+ * Add support for forward a local UNIX domain socket to a remote TCP socket. [Mark Imbriaco]
19
+
20
+ === 2.1.4 / 3 Apr 2011
21
+
22
+ * Add ConnectionTimeout exception class. [Joel Watson]
23
+ See: https://github.com/net-ssh/net-ssh-multi/pull/1
24
+
25
+
26
+ === 2.1.3 / 2 Mar 2011
27
+
28
+ * Call to transport.closed should be transport.close [Woon Jung]
29
+
30
+
31
+ === 2.1.2 / 1 Mar 2011
32
+
33
+ * Fix for Net::SSH Continues to attempt authentication when notified it is not allowed [Eric Hodel]
34
+ (see: http://net-ssh.lighthouseapp.com/projects/36253-net-ssh/tickets/26)
35
+ * Fix for transport won't be closed if authentication fails [Patrick Marchi]
36
+
37
+
38
+ === 2.1 / 19 Jan 2011
39
+
40
+ * Support "IdentitiesOnly" directive (LH-24) [Musy Bite, Edmund Haselwanter]
41
+ * Speeding up the Loggable module (LH-23) [robbebob]
42
+
43
+
44
+ === 2.0.24 / 14 Jan 2011
45
+
46
+ * Fix for process code to correctly wait until remote_id is set before sending any output, including eof. [Daniel Pittman, Markus Roberts]
47
+ * Fix circular require warning in Ruby 1.9.2 [Gavin Brock]
48
+
49
+
50
+ === 2.0.23 / 03 Jun 2010
51
+
52
+ * delay CHANNEL_EOF packet until output buffer is empty [Rich Lane]
53
+
54
+ Previously, calling #eof! after #send_data would result in the CHANNEL_EOF
55
+ packet being sent immediately, ahead of the data in the output buffer. Now
56
+ buffer becomes empty.
57
+
58
+
59
+ === 2.0.22 / 20 Apr 2010
60
+
61
+ * Fix for: "Parsing the config errors out because it coerces the "1" into an integer and then tries to split it on spaces for multiple host checking." (http://net-ssh.lighthouseapp.com/projects/36253/tickets/10) [Lee Marlow]
62
+
63
+
64
+ === 2.0.21 / 20 Mar 2010
65
+
66
+ * Fix for "IdentifyFile" in ~/.ssh/config does not work if no "Host" statement is given (http://net-ssh.lighthouseapp.com/projects/36253/tickets/9-identifyfile-in-sshconfig-does-not-work-if-no-host-statement-is-given#ticket-9-5) [xbaldauf, Delano Mandelbaum]
67
+
68
+ * Fix for client closes a forwarded connection, but the server is reading, net-ssh terminates with IOError socket closed (http://net-ssh.lighthouseapp.com/projects/36253/tickets/7) [Miklós Fazekas]
69
+
70
+ * Fix for client force closes (RST) a forwarded connection, but server is reading, net-ssh terminates with exception [Miklós Fazekas]
71
+
72
+ * Fix for server closes the sending side, the on_eof is not handled. [Miklós Fazekas]
73
+
74
+ * Removed Hanna dependency in Rakefile [Delano Mandelbaum]
75
+
76
+
77
+ === 2.0.20 / 10 Feb 2010
78
+
79
+ * Support "ProxyCommand none" directive [Andy Lo-A-Foe]
80
+
81
+ === 2.0.19 / 16 Jan 2010
82
+
83
+ * Support plus sign in sshconfig hostname [Jason Weathered]
84
+
85
+ === 2.0.18 / 15 Jan 2010
86
+
87
+ * Fix related to #recv(1) to #readpartial change in 2.0.16 [Hans de Graaff, Delano Mandelbaum]
88
+
89
+
90
+ === 2.0.17 / 14 Dec 2009
91
+
92
+ * Don't load net/ssh/authentication/pageant on Windows with Ruby 1.9 [Travis Reeder, Delano Mandelbaum]
93
+
94
+
95
+ === 2.0.16 / 28 Nov 2009
96
+
97
+ * Fix for "multiple hosts are separated by whitespace" [Akinori MUSHA]
98
+
99
+ * Add support for the ProxyCommand directive [Akinori MUSHA]
100
+
101
+ * Switched from #recv(1) to #readpartial in lib/net/ssh/transport/server_version.rb, so that closed sockets are recognized [Alex Peuchert]
102
+
103
+
104
+ === 2.0.15 / 03 Sep 2009
105
+
106
+ * Scale back IO#select patch so it mutexes only zero-timeout calls [Daniel Azuma, Will Bryant]
107
+
108
+
109
+ === 2.0.14 / 28 Aug 2009
110
+
111
+ * Fix for IO#select threading bug in Ruby 1.8 (LH-1) [Daniel Azuma]
112
+
113
+ * Fix for "uninitialized constant OpenSSL::Digest::MD5" exception in Net::SFTP [DL Redden]
114
+
115
+
116
+ === 2.0.13 / 17 Aug 2009
117
+
118
+ * Added fix for hanging in ServerVersion#negotiate! when using SOCKS5 proxy (GH-9) [Gerald Talton]
119
+
120
+ * Added support for specifying a list of hosts in .ssh/config, with tests (GH-6) [ckoehler, Delano Mandelbaum]
121
+
122
+ * Added tests for arcfour128/256/512 lengths, encryption, and decryption [Delano Mandelbaum]
123
+
124
+ * Skip packet stream tests for arcfour128/256/512 [Delano Mandelbaum]
125
+
126
+ * Fix for OpenSSL cipher key length because it always returns 16, even when 32 byte keys are required, e.g. for arcfour256 and arcfour512 ciphers [Karl Varga]
127
+
128
+
129
+ === 2.0.12 / 08 Jun 2009
130
+
131
+ * Applied patch for arcfour128 and arcfour256 support [Denis Bernard]
132
+
133
+ * Use unbuffered reads when negotiating the protocol version [Steven Hazel]
134
+
135
+
136
+ === 2.0.11 / 24 Feb 2009
137
+
138
+ * Add :key_data option for specifying raw private keys in PEM format [Alex Holems, Andrew Babkin]
139
+
140
+
141
+ === 2.0.10 / 4 Feb 2009
142
+
143
+ * Added Net::SSH.configuration_for to make it easier to query the SSH configuration file(s) [Jamis Buck]
144
+
145
+
146
+ === 2.0.9 / 1 Feb 2009
147
+
148
+ * Specifying non-nil user argument overrides user in .ssh/config [Jamis Buck]
149
+
150
+ * Ignore requests for non-existent channels (workaround ssh server bug) [Jamis Buck]
151
+
152
+ * Add terminate! method for hard shutdown scenarios [Jamis Buck]
153
+
154
+ * Revert to pre-2.0.7 key-loading behavior by default, but load private-key if public-key doesn't exist [Jamis Buck]
155
+
156
+ * Make sure :passphrase option gets passed to key manager [Bob Cotton]
157
+
158
+
159
+ === 2.0.8 / 29 December 2008
160
+
161
+ * Fix private key change from 2.0.7 so that keys are loaded just-in-time, avoiding unecessary prompts from encrypted keys. [Jamis Buck]
162
+
163
+
164
+ === 2.0.7 / 29 December 2008
165
+
166
+ * Make key manager use private keys instead of requiring public key to exist [arilerner@mac.com]
167
+
168
+ * Fix failing tests [arilerner@mac.com]
169
+
170
+ * Don't include pageant when running under JRuby [Angel N. Sciortino]
171
+
172
+
173
+ === 2.0.6 / 6 December 2008
174
+
175
+ * Update the Manifest file so that the gem includes all necessary files [Jamis Buck]
176
+
177
+
178
+ === 2.0.5 / 6 December 2008
179
+
180
+ * Make the Pageant interface comply with more of the Socket interface to avoid related errors [Jamis Buck]
181
+
182
+ * Don't busy-wait on session close for remaining channels to close [Will Bryant]
183
+
184
+ * Ruby 1.9 compatibility [Jamis Buck]
185
+
186
+ * Fix Cipher#final to correctly flag a need for a cipher reset [Jamis Buck]
187
+
188
+
189
+ === 2.0.4 / 27 Aug 2008
190
+
191
+ * Added Connection::Session#closed? and Transport::Session#closed? [Jamis Buck]
192
+
193
+ * Numeric host names in .ssh/config are now parsed correct [Yanko Ivanov]
194
+
195
+ * Make sure the error raised when a public key file is malformed is more informative than a MethodMissing error [Jamis Buck]
196
+
197
+ * Cipher#reset is now called after Cipher#final, with the last n bytes used as the next initialization vector [Jamis Buck]
198
+
199
+
200
+ === 2.0.3 / 27 Jun 2008
201
+
202
+ * Make Net::SSH::Version comparable [Brian Candler]
203
+
204
+ * Fix errors in port forwarding when a channel could not be opened due to a typo in the exception name [Matthew Todd]
205
+
206
+ * Use #chomp instead of #strip when cleaning the version string reported by the remote host, so that trailing whitespace is preserved (this is to play nice with servers like Mocana SSH) [Timo Gatsonides]
207
+
208
+ * Correctly parse ssh_config entries with eq-sign delimiters [Jamis Buck]
209
+
210
+ * Ignore malformed ssh_config entries [Jamis Buck]
211
+
212
+ === 2.0.2 / 29 May 2008
213
+
214
+ * Make sure the agent client understands both RSA "identities answers" [Jamis Buck]
215
+
216
+ * Fixed key truncation bug that caused hmacs other than SHA1 to fail with "corrupt hmac" errors [Jamis Buck]
217
+
218
+ * Fix detection and loading of public keys when the keys don't actually exist [David Dollar]
219
+
220
+
221
+ === 2.0.1 / 5 May 2008
222
+
223
+ * Teach Net::SSH about a handful of default key names [Jamis Buck]
224
+
225
+
226
+ === 2.0.0 / 1 May 2008
227
+
228
+ * Allow the :verbose argument to accept symbols (:debug, etc.) as well as Logger level constants (Logger::DEBUG, etc.) [Jamis Buck]
229
+
230
+
231
+ === 2.0 Preview Release 4 (1.99.3) / 19 Apr 2008
232
+
233
+ * Make sure HOME is set to something sane, even on OS's that don't set it by default [Jamis Buck]
234
+
235
+ * Add a :passphrase option to specify the passphrase to use with private keys [Francis Sullivan]
236
+
237
+ * Open a new auth agent connection for every auth-agent channel request [Jamis Buck]
238
+
239
+
240
+ === 2.0 Preview Release 3 (1.99.2) / 10 Apr 2008
241
+
242
+ * Session properties [Jamis Buck]
243
+
244
+ * Make channel open failure work with a callback so that failures can be handled similarly to successes [Jamis Buck]
245
+
246
+
247
+ === 2.0 Preview Release 2 (1.99.1) / 22 Mar 2008
248
+
249
+ * Partial support for ~/.ssh/config (and related) SSH configuration files [Daniel J. Berger, Jamis Buck]
250
+
251
+ * Added Net::SSH::Test to facilitate testing complex SSH state machines [Jamis Buck]
252
+
253
+ * Reworked Net::SSH::Prompt to use conditionally-selected modules [Jamis Buck, suggested by James Rosen]
254
+
255
+ * Added Channel#eof? and Channel#eof! [Jamis Buck]
256
+
257
+ * Fixed bug in strict host key verifier on cache miss [Mike Timm]
258
+
259
+
260
+ === 2.0 Preview Release 1 (1.99.0) / 21 Aug 2007
261
+
262
+ * First preview release of Net::SSH v2
data/Manifest ADDED
@@ -0,0 +1,121 @@
1
+ CHANGELOG.rdoc
2
+ Manifest
3
+ README.rdoc
4
+ Rakefile
5
+ Rudyfile
6
+ THANKS.rdoc
7
+ lib/net/ssh.rb
8
+ lib/net/ssh/authentication/agent.rb
9
+ lib/net/ssh/authentication/constants.rb
10
+ lib/net/ssh/authentication/key_manager.rb
11
+ lib/net/ssh/authentication/methods/abstract.rb
12
+ lib/net/ssh/authentication/methods/hostbased.rb
13
+ lib/net/ssh/authentication/methods/keyboard_interactive.rb
14
+ lib/net/ssh/authentication/methods/password.rb
15
+ lib/net/ssh/authentication/methods/publickey.rb
16
+ lib/net/ssh/authentication/pageant.rb
17
+ lib/net/ssh/authentication/session.rb
18
+ lib/net/ssh/buffer.rb
19
+ lib/net/ssh/buffered_io.rb
20
+ lib/net/ssh/config.rb
21
+ lib/net/ssh/connection/channel.rb
22
+ lib/net/ssh/connection/constants.rb
23
+ lib/net/ssh/connection/session.rb
24
+ lib/net/ssh/connection/term.rb
25
+ lib/net/ssh/errors.rb
26
+ lib/net/ssh/key_factory.rb
27
+ lib/net/ssh/known_hosts.rb
28
+ lib/net/ssh/loggable.rb
29
+ lib/net/ssh/packet.rb
30
+ lib/net/ssh/prompt.rb
31
+ lib/net/ssh/proxy/command.rb
32
+ lib/net/ssh/proxy/errors.rb
33
+ lib/net/ssh/proxy/http.rb
34
+ lib/net/ssh/proxy/socks4.rb
35
+ lib/net/ssh/proxy/socks5.rb
36
+ lib/net/ssh/ruby_compat.rb
37
+ lib/net/ssh/service/forward.rb
38
+ lib/net/ssh/test.rb
39
+ lib/net/ssh/test/channel.rb
40
+ lib/net/ssh/test/extensions.rb
41
+ lib/net/ssh/test/kex.rb
42
+ lib/net/ssh/test/local_packet.rb
43
+ lib/net/ssh/test/packet.rb
44
+ lib/net/ssh/test/remote_packet.rb
45
+ lib/net/ssh/test/script.rb
46
+ lib/net/ssh/test/socket.rb
47
+ lib/net/ssh/transport/algorithms.rb
48
+ lib/net/ssh/transport/cipher_factory.rb
49
+ lib/net/ssh/transport/constants.rb
50
+ lib/net/ssh/transport/hmac.rb
51
+ lib/net/ssh/transport/hmac/abstract.rb
52
+ lib/net/ssh/transport/hmac/md5.rb
53
+ lib/net/ssh/transport/hmac/md5_96.rb
54
+ lib/net/ssh/transport/hmac/none.rb
55
+ lib/net/ssh/transport/hmac/sha1.rb
56
+ lib/net/ssh/transport/hmac/sha1_96.rb
57
+ lib/net/ssh/transport/hmac/sha2_256.rb
58
+ lib/net/ssh/transport/hmac/sha2_256_96.rb
59
+ lib/net/ssh/transport/hmac/sha2_512.rb
60
+ lib/net/ssh/transport/hmac/sha2_512_96.rb
61
+ lib/net/ssh/transport/identity_cipher.rb
62
+ lib/net/ssh/transport/key_expander.rb
63
+ lib/net/ssh/transport/kex.rb
64
+ lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
65
+ lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb
66
+ lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb
67
+ lib/net/ssh/transport/openssl.rb
68
+ lib/net/ssh/transport/packet_stream.rb
69
+ lib/net/ssh/transport/server_version.rb
70
+ lib/net/ssh/transport/session.rb
71
+ lib/net/ssh/transport/state.rb
72
+ lib/net/ssh/verifiers/lenient.rb
73
+ lib/net/ssh/verifiers/null.rb
74
+ lib/net/ssh/verifiers/strict.rb
75
+ lib/net/ssh/version.rb
76
+ net-ssh.gemspec
77
+ setup.rb
78
+ support/arcfour_check.rb
79
+ support/ssh_tunnel_bug.rb
80
+ test/authentication/methods/common.rb
81
+ test/authentication/methods/test_abstract.rb
82
+ test/authentication/methods/test_hostbased.rb
83
+ test/authentication/methods/test_keyboard_interactive.rb
84
+ test/authentication/methods/test_password.rb
85
+ test/authentication/methods/test_publickey.rb
86
+ test/authentication/test_agent.rb
87
+ test/authentication/test_key_manager.rb
88
+ test/authentication/test_session.rb
89
+ test/common.rb
90
+ test/configs/eqsign
91
+ test/configs/exact_match
92
+ test/configs/host_plus
93
+ test/configs/multihost
94
+ test/configs/wild_cards
95
+ test/connection/test_channel.rb
96
+ test/connection/test_session.rb
97
+ test/test_all.rb
98
+ test/test_buffer.rb
99
+ test/test_buffered_io.rb
100
+ test/test_config.rb
101
+ test/test_key_factory.rb
102
+ test/transport/hmac/test_md5.rb
103
+ test/transport/hmac/test_md5_96.rb
104
+ test/transport/hmac/test_none.rb
105
+ test/transport/hmac/test_sha1.rb
106
+ test/transport/hmac/test_sha1_96.rb
107
+ test/transport/hmac/test_sha2_256.rb
108
+ test/transport/hmac/test_sha2_256_96.rb
109
+ test/transport/hmac/test_sha2_512.rb
110
+ test/transport/hmac/test_sha2_512_96.rb
111
+ test/transport/kex/test_diffie_hellman_group1_sha1.rb
112
+ test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
113
+ test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb
114
+ test/transport/test_algorithms.rb
115
+ test/transport/test_cipher_factory.rb
116
+ test/transport/test_hmac.rb
117
+ test/transport/test_identity_cipher.rb
118
+ test/transport/test_packet_stream.rb
119
+ test/transport/test_server_version.rb
120
+ test/transport/test_session.rb
121
+ test/transport/test_state.rb
data/README.rdoc ADDED
@@ -0,0 +1,184 @@
1
+ = Net::SSH
2
+
3
+ * Docs: http://net-ssh.github.com/net-ssh
4
+ * Issues: http://net-ssh.lighthouseapp.com/
5
+ * Codes: http://github.com/net-ssh/net-ssh
6
+ * Email: net-ssh@solutious.com
7
+
8
+ == DESCRIPTION:
9
+
10
+ Net::SSH is a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2.
11
+
12
+ == FEATURES:
13
+
14
+ * Execute processes on remote servers and capture their output
15
+ * Run multiple processes in parallel over a single SSH connection
16
+ * Support for SSH subsystems
17
+ * Forward local and remote ports via an SSH connection
18
+
19
+ == SYNOPSIS:
20
+
21
+ In a nutshell:
22
+
23
+ require 'net/ssh'
24
+
25
+ Net::SSH.start('host', 'user', :password => "password") do |ssh|
26
+ # capture all stderr and stdout output from a remote process
27
+ output = ssh.exec!("hostname")
28
+
29
+ # capture only stdout matching a particular pattern
30
+ stdout = ""
31
+ ssh.exec!("ls -l /home/jamis") do |channel, stream, data|
32
+ stdout << data if stream == :stdout
33
+ end
34
+ puts stdout
35
+
36
+ # run multiple processes in parallel to completion
37
+ ssh.exec "sed ..."
38
+ ssh.exec "awk ..."
39
+ ssh.exec "rm -rf ..."
40
+ ssh.loop
41
+
42
+ # open a new channel and configure a minimal set of callbacks, then run
43
+ # the event loop until the channel finishes (closes)
44
+ channel = ssh.open_channel do |ch|
45
+ ch.exec "/usr/local/bin/ruby /path/to/file.rb" do |ch, success|
46
+ raise "could not execute command" unless success
47
+
48
+ # "on_data" is called when the process writes something to stdout
49
+ ch.on_data do |c, data|
50
+ $STDOUT.print data
51
+ end
52
+
53
+ # "on_extended_data" is called when the process writes something to stderr
54
+ ch.on_extended_data do |c, type, data|
55
+ $STDERR.print data
56
+ end
57
+
58
+ ch.on_close { puts "done!" }
59
+ end
60
+ end
61
+
62
+ channel.wait
63
+
64
+ # forward connections on local port 1234 to port 80 of www.capify.org
65
+ ssh.forward.local(1234, "www.capify.org", 80)
66
+ ssh.loop { true }
67
+ end
68
+
69
+ See Net::SSH for more documentation, and links to further information.
70
+
71
+ == REQUIREMENTS:
72
+
73
+ The only requirement you might be missing is the OpenSSL bindings for Ruby. These are built by default on most platforms, but you can verify that they're built and installed on your system by running the following command line:
74
+
75
+ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
76
+
77
+ If that spits out something like "OpenSSL 0.9.8g 19 Oct 2007", then you're set. If you get an error, then you'll need to see about rebuilding ruby with OpenSSL support, or (if your platform supports it) installing the OpenSSL bindings separately.
78
+
79
+ Additionally: if you are going to be having Net::SSH prompt you for things like passwords or certificate passphrases, you'll want to have either the Highline (recommended) or Termios (unix systems only) gem installed, so that the passwords don't echo in clear text.
80
+
81
+ Lastly, if you want to run the tests or use any of the Rake tasks, you'll need:
82
+
83
+ * Echoe (for the Rakefile)
84
+ * Mocha (for the tests)
85
+
86
+
87
+ == INSTALL:
88
+
89
+ * gem install net-ssh (might need sudo privileges)
90
+
91
+
92
+ == ARCFOUR SUPPORT:
93
+
94
+ from Karl Varga:
95
+
96
+ Ruby's OpenSSL bindings always return a key length of 16 for RC4 ciphers, which means that when we try to use ARCFOUR256 or higher, Net::SSH generates keys which are consistently too short - 16 bytes as opposed to 32 bytes - resulting in the following error:
97
+
98
+ OpenSSL::CipherError: key length too short
99
+
100
+ My patch simply instructs Net::SSH to build keys of the the proper length, regardless of the required key length reported by OpenSSL.
101
+
102
+ You should also be aware that your OpenSSL C libraries may also contain this bug. I've updated to 0.9.8k, but according to this thread[https://bugzilla.mindrot.org/show_bug.cgi?id=1291], the bug existed as recently as 0.9.8e! I've manually taken a look at my header files and they look ok, which is what makes me think it's a bug in the Ruby implementation.
103
+
104
+ To see your OpenSSL version:
105
+
106
+ $ openssl version
107
+ OpenSSL 0.9.8k 25 Mar 2009
108
+
109
+ After installing this gem, verify that Net::SSH is generating keys of the correct length by running the script <tt>support/arcfour_check.rb</tt>:
110
+
111
+ $ ruby arcfour_support.rb
112
+
113
+ which should produce the following:
114
+
115
+ arcfour128: [16, 8] OpenSSL::Cipher::Cipher
116
+ arcfour256: [32, 8] OpenSSL::Cipher::Cipher
117
+ arcfour512: [64, 8] OpenSSL::Cipher::Cipher
118
+
119
+
120
+ == RUNNING TESTS
121
+
122
+ Run the test suite from the net-ssh directory with the following command:
123
+
124
+ ruby -Ilib -Itest -rrubygems test/test_all.rb
125
+
126
+ Run a single test file like this:
127
+
128
+ ruby -Ilib -Itest -rrubygems test/transport/test_server_version.rb
129
+
130
+
131
+ === EXPECTED RESULTS
132
+
133
+ * Ruby 1.8: all tests pass
134
+
135
+ * Ruby 1.9: all tests pass
136
+
137
+ * JRuby 1.5: 99% tests pass (448 tests, 1846 assertions, 1 failures)
138
+
139
+
140
+ === PORT FORWARDING TESTS
141
+
142
+ ruby -Ilib -Itest -rrubygems test/manual/test_forward.rb
143
+
144
+ test_forward.rb must be run separately from the test suite because
145
+ it requires authorizing your public SSH keys on you localhost.
146
+
147
+ If you already have keys you can do this:
148
+
149
+ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
150
+
151
+ If you don't have keys see:
152
+
153
+ http://kimmo.suominen.com/docs/ssh/#ssh-keygen
154
+
155
+ You should now be able to login to your localhost with out
156
+ bring prompted for a password:
157
+
158
+ ssh localhost
159
+
160
+
161
+ == LICENSE:
162
+
163
+ (The MIT License)
164
+
165
+ Copyright (c) 2008 Jamis Buck
166
+
167
+ Permission is hereby granted, free of charge, to any person obtaining
168
+ a copy of this software and associated documentation files (the
169
+ 'Software'), to deal in the Software without restriction, including
170
+ without limitation the rights to use, copy, modify, merge, publish,
171
+ distribute, sublicense, and/or sell copies of the Software, and to
172
+ permit persons to whom the Software is furnished to do so, subject to
173
+ the following conditions:
174
+
175
+ The above copyright notice and this permission notice shall be
176
+ included in all copies or substantial portions of the Software.
177
+
178
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
179
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
180
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
181
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
182
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
183
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
184
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.