net-ssh 6.0.2 → 6.2.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64788ad9e1631653585c4f6c15ba5f9f75f3c7094c7514e846b2903033ab63b7
4
- data.tar.gz: abe406f28126935bcae76b9d83318164da56128482541cf60807628a91470481
3
+ metadata.gz: 41c56dfbc79ea932b949dfc90f27bf3377cdbd3a48c32fd409db872562f38491
4
+ data.tar.gz: 648aeea80bec0e871f4c8e26ea7e24773fbd8de8a0e8ccb305b00a3f96c53172
5
5
  SHA512:
6
- metadata.gz: '092f1301f068486c0db17fb8b58ba1d9453298c083a0b76fa5eae8c9863b5b6270dd7d805642a00e63d87ccb11220f7b1fe5acdbbbf6b46fe6f4e3c45aea7727'
7
- data.tar.gz: bb3a8b5ffc952940dce240422f5354dced264b25cb84a0072e44b7068cc1d05da1f14e19a290b0f956bde35f6560021cddf67485bbb242bb6c9f701220287325
6
+ metadata.gz: 50ded00bb7ce3aa76167557dad7f2840d047c7861a5d3480fe3141bc67ccdcf502fd3a2dd4d1097d21467ec7cf83d1decd14809581e2203851eca52f083b1844
7
+ data.tar.gz: '056481ae85b0919dac4b75cd7434ea921c4fa248a050ef3d6b19d0c38ac49e6f0824731c192d6a242f2b6eba5c684e28244f9b8d15341a5ead44db3aac1d48ea'
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,76 @@
1
+ name: CI
2
+ on: [pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ ruby-version: [2.7.2, 2.6.6, 2.5.8, 2.4.10, 3.0.0]
9
+ steps:
10
+ - uses: actions/checkout@v1
11
+
12
+ - name: Set up Ruby ${{ matrix.ruby-version }}
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: ${{ matrix.ruby-version }}
16
+ - name: Set up Python ${{ matrix.python-version }}
17
+ uses: actions/setup-python@v2
18
+ with:
19
+ python-version: 2.7
20
+
21
+ - name: Cache bundler
22
+ uses: actions/cache@v1
23
+ id: bundler-cache
24
+ with:
25
+ path: vendor/bundle
26
+ key: ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v3-${{ hashFiles('**/Gemfile') }}-${{ hashFiles('**/net-ssh.gemspec') }}
27
+ restore-keys: |
28
+ ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v3-
29
+
30
+ - name: Cache pip
31
+ uses: actions/cache@v1
32
+ id: pip-cache
33
+ with:
34
+ path: ~/.cache/pip
35
+ key: ${{ runner.os }}-pip-v1
36
+ restore-keys: |
37
+ ${{ runner.os }}-pip-v1
38
+ - name: Bundle install
39
+ run: |
40
+ gem install bundler
41
+ bundle config set path 'vendor/bundle'
42
+ bundle config set --local path 'vendor/bundle'
43
+ bundle install --jobs 4 --retry 3 --path vendor/bundle
44
+ BUNDLE_GEMFILE=./Gemfile.noed25519 bundle install --jobs 4 --retry 3 --path vendor/bundle
45
+ env:
46
+ BUNDLE_PATH: vendor/bundle
47
+
48
+ - name: Add to etc/hosts
49
+ run: |
50
+ sudo echo "127.0.0.1 gateway.netssh" | sudo tee -a /etc/hosts
51
+ - name: Ansible install
52
+ run: |
53
+ python -m pip install --upgrade pip
54
+ pip install ansible urllib3 pyOpenSSL ndg-httpsclient pyasn1
55
+ ansible-galaxy install rvm.ruby
56
+ pwd
57
+ uname -a
58
+ export
59
+ who am i
60
+ ansible-playbook ./test/integration/playbook.yml -i "localhost," --become -c local -e 'no_rvm=true' -e 'myuser=runner' -e 'mygroup=runner' -e 'homedir=/home/runner'
61
+ - name: Run Tests
62
+ run: bundle exec rake test
63
+ env:
64
+ NET_SSH_RUN_INTEGRATION_TESTS_DISABLED: 1
65
+ - name: Run Tests (without ed25519)
66
+ run: bundle exec rake test
67
+ env:
68
+ BUNDLE_GEMFILE: ./Gemfile.noed25519
69
+ NET_SSH_RUN_INTEGRATION_TESTS_DISABLED: 1
70
+ - name: Run test helper test
71
+ run: bundle exec rake test_test
72
+ - name: Rubocop
73
+ if: matrix.ruby-version != '3.0.0'
74
+ run: bundle exec rubocop
75
+
76
+
data/.gitignore CHANGED
@@ -9,3 +9,5 @@ test/integration/.vagrant
9
9
  test/integration/playbook.retry
10
10
 
11
11
  .byebug_history
12
+
13
+ tryout
data/.rubocop_todo.yml CHANGED
@@ -1,19 +1,19 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-09-10 17:13:26 +0200 using RuboCop version 0.74.0.
3
+ # on 2020-05-29 10:37:36 +0200 using RuboCop version 0.74.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 76
9
+ # Offense count: 75
10
10
  # Cop supports --auto-correct.
11
11
  # Configuration parameters: EnforcedStyle, IndentationWidth.
12
12
  # SupportedStyles: with_first_argument, with_fixed_indentation
13
13
  Layout/AlignArguments:
14
14
  Enabled: false
15
15
 
16
- # Offense count: 57
16
+ # Offense count: 63
17
17
  # Cop supports --auto-correct.
18
18
  # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
19
19
  # SupportedHashRocketStyles: key, separator, table
@@ -32,39 +32,13 @@ Layout/AlignHash:
32
32
  Layout/EmptyLineAfterGuardClause:
33
33
  Enabled: false
34
34
 
35
- # Offense count: 170
35
+ # Offense count: 172
36
36
  # Cop supports --auto-correct.
37
37
  # Configuration parameters: EnforcedStyle.
38
38
  # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
39
39
  Layout/EmptyLinesAroundModuleBody:
40
40
  Enabled: false
41
41
 
42
- # Offense count: 2
43
- # Cop supports --auto-correct.
44
- # Configuration parameters: EnforcedStyle, IndentationWidth.
45
- # SupportedStyles: special_inside_parentheses, consistent, align_brackets
46
- Layout/IndentFirstArrayElement:
47
- Exclude:
48
- - 'lib/net/ssh/transport/openssl.rb'
49
-
50
- # Offense count: 3
51
- # Cop supports --auto-correct.
52
- Layout/LeadingBlankLines:
53
- Exclude:
54
- - 'Rakefile'
55
- - 'lib/net/ssh/authentication/pub_key_fingerprint.rb'
56
- - 'support/arcfour_check.rb'
57
-
58
- # Offense count: 14
59
- # Cop supports --auto-correct.
60
- # Configuration parameters: AllowDoxygenCommentStyle.
61
- Layout/LeadingCommentSpace:
62
- Exclude:
63
- - 'test/integration/test_ed25519_pkeys.rb'
64
- - 'test/integration/test_forward.rb'
65
- - 'test/integration/test_id_rsa_keys.rb'
66
- - 'test/integration/test_proxy.rb'
67
-
68
42
  # Offense count: 23
69
43
  # Cop supports --auto-correct.
70
44
  # Configuration parameters: EnforcedStyle, IndentationWidth.
@@ -87,7 +61,7 @@ Layout/SpaceAfterColon:
87
61
  - 'test/integration/test_ed25519_pkeys.rb'
88
62
  - 'test/verifiers/test_always.rb'
89
63
 
90
- # Offense count: 281
64
+ # Offense count: 291
91
65
  # Cop supports --auto-correct.
92
66
  Layout/SpaceAfterComma:
93
67
  Enabled: false
@@ -99,7 +73,7 @@ Layout/SpaceAfterComma:
99
73
  Layout/SpaceAroundEqualsInParameterDefault:
100
74
  Enabled: false
101
75
 
102
- # Offense count: 10
76
+ # Offense count: 12
103
77
  # Cop supports --auto-correct.
104
78
  # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
105
79
  # SupportedStyles: space, no_space
@@ -122,14 +96,7 @@ Layout/SpaceInsideReferenceBrackets:
122
96
  Exclude:
123
97
  - 'lib/net/ssh/transport/algorithms.rb'
124
98
 
125
- # Offense count: 17
126
- # Cop supports --auto-correct.
127
- # Configuration parameters: EnforcedStyle.
128
- # SupportedStyles: final_newline, final_blank_line
129
- Layout/TrailingBlankLines:
130
- Enabled: false
131
-
132
- # Offense count: 739
99
+ # Offense count: 730
133
100
  # Cop supports --auto-correct.
134
101
  # Configuration parameters: AllowInHeredoc.
135
102
  Layout/TrailingWhitespace:
@@ -177,14 +144,6 @@ Lint/Loop:
177
144
  - 'lib/net/ssh/authentication/methods/password.rb'
178
145
  - 'lib/net/ssh/key_factory.rb'
179
146
 
180
- # Offense count: 3
181
- # Configuration parameters: MaximumRangeSize.
182
- Lint/MissingCopEnableDirective:
183
- Exclude:
184
- - 'test/authentication/test_agent.rb'
185
- - 'test/authentication/test_certificate.rb'
186
- - 'test/integration/test_agent.rb'
187
-
188
147
  # Offense count: 1
189
148
  Lint/NonLocalExitFromIterator:
190
149
  Exclude:
@@ -207,12 +166,6 @@ Lint/UnderscorePrefixedVariableName:
207
166
  Exclude:
208
167
  - 'lib/net/ssh/test/local_packet.rb'
209
168
 
210
- # Offense count: 1
211
- # Cop supports --auto-correct.
212
- Lint/UnneededRequireStatement:
213
- Exclude:
214
- - 'lib/net/ssh/ruby_compat.rb'
215
-
216
169
  # Offense count: 60
217
170
  # Cop supports --auto-correct.
218
171
  # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
@@ -229,7 +182,7 @@ Lint/UnusedBlockArgument:
229
182
  - 'test/transport/test_algorithms.rb'
230
183
  - 'test/transport/test_hmac.rb'
231
184
 
232
- # Offense count: 62
185
+ # Offense count: 65
233
186
  # Cop supports --auto-correct.
234
187
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
235
188
  Lint/UnusedMethodArgument:
@@ -251,11 +204,11 @@ Lint/UselessAssignment:
251
204
  - 'test/integration/common.rb'
252
205
  - 'test/integration/test_forward.rb'
253
206
 
254
- # Offense count: 229
207
+ # Offense count: 239
255
208
  Metrics/AbcSize:
256
- Max: 89
209
+ Max: 71
257
210
 
258
- # Offense count: 15
211
+ # Offense count: 17
259
212
  # Configuration parameters: CountComments, ExcludedMethods.
260
213
  # ExcludedMethods: refine
261
214
  Metrics/BlockLength:
@@ -266,23 +219,21 @@ Metrics/BlockLength:
266
219
  Metrics/BlockNesting:
267
220
  Max: 4
268
221
 
269
- # Offense count: 31
222
+ # Offense count: 33
270
223
  # Configuration parameters: CountComments.
271
224
  Metrics/ClassLength:
272
225
  Max: 488
273
226
 
274
- # Offense count: 38
227
+ # Offense count: 40
275
228
  Metrics/CyclomaticComplexity:
276
- Max: 27
277
- Exclude:
278
- - 'lib/net/ssh/config.rb'
229
+ Max: 28
279
230
 
280
- # Offense count: 211
231
+ # Offense count: 224
281
232
  # Configuration parameters: CountComments, ExcludedMethods.
282
233
  Metrics/MethodLength:
283
- Max: 82
234
+ Max: 72
284
235
 
285
- # Offense count: 2
236
+ # Offense count: 3
286
237
  # Configuration parameters: CountComments.
287
238
  Metrics/ModuleLength:
288
239
  Max: 160
@@ -292,11 +243,11 @@ Metrics/ModuleLength:
292
243
  Metrics/ParameterLists:
293
244
  Max: 6
294
245
 
295
- # Offense count: 30
246
+ # Offense count: 32
296
247
  Metrics/PerceivedComplexity:
297
248
  Max: 20
298
249
 
299
- # Offense count: 9
250
+ # Offense count: 10
300
251
  Naming/AccessorMethodName:
301
252
  Exclude:
302
253
  - 'lib/net/ssh/authentication/methods/password.rb'
@@ -313,25 +264,9 @@ Naming/BinaryOperatorParameterName:
313
264
  - 'lib/net/ssh/buffer.rb'
314
265
  - 'lib/net/ssh/version.rb'
315
266
 
316
- # Offense count: 12
267
+ # Offense count: 16
317
268
  Naming/ClassAndModuleCamelCase:
318
- Exclude:
319
- - 'lib/net/ssh/transport/hmac/md5_96.rb'
320
- - 'lib/net/ssh/transport/hmac/sha1_96.rb'
321
- - 'lib/net/ssh/transport/hmac/sha2_256.rb'
322
- - 'lib/net/ssh/transport/hmac/sha2_256_96.rb'
323
- - 'lib/net/ssh/transport/hmac/sha2_256_etm.rb'
324
- - 'lib/net/ssh/transport/hmac/sha2_512.rb'
325
- - 'lib/net/ssh/transport/hmac/sha2_512_96.rb'
326
- - 'lib/net/ssh/transport/hmac/sha2_512_etm.rb'
327
- - 'test/transport/hmac/test_md5_96.rb'
328
- - 'test/transport/hmac/test_sha1_96.rb'
329
- - 'test/transport/hmac/test_sha2_256.rb'
330
- - 'test/transport/hmac/test_sha2_256_96.rb'
331
- - 'test/transport/hmac/test_sha2_256_etm.rb'
332
- - 'test/transport/hmac/test_sha2_512.rb'
333
- - 'test/transport/hmac/test_sha2_512_96.rb'
334
- - 'test/transport/hmac/test_sha2_512_etm.rb'
269
+ Enabled: false
335
270
 
336
271
  # Offense count: 4
337
272
  Naming/ConstantName:
@@ -340,7 +275,7 @@ Naming/ConstantName:
340
275
  - 'lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb'
341
276
  - 'lib/net/ssh/transport/openssl.rb'
342
277
 
343
- # Offense count: 11
278
+ # Offense count: 12
344
279
  # Configuration parameters: Blacklist.
345
280
  # Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
346
281
  Naming/HeredocDelimiterNaming:
@@ -352,7 +287,7 @@ Naming/HeredocDelimiterNaming:
352
287
  - 'test/integration/test_agent.rb'
353
288
  - 'test/test_key_factory.rb'
354
289
 
355
- # Offense count: 4
290
+ # Offense count: 5
356
291
  # Configuration parameters: EnforcedStyleForLeadingUnderscores.
357
292
  # SupportedStylesForLeadingUnderscores: disallowed, required, optional
358
293
  Naming/MemoizedInstanceVariableName:
@@ -394,7 +329,6 @@ Naming/UncommunicativeMethodParamName:
394
329
  - 'lib/net/ssh/authentication/pageant.rb'
395
330
  - 'lib/net/ssh/buffer.rb'
396
331
  - 'lib/net/ssh/buffered_io.rb'
397
- - 'lib/net/ssh/ruby_compat.rb'
398
332
  - 'lib/net/ssh/test/socket.rb'
399
333
  - 'lib/net/ssh/transport/ctr.rb'
400
334
  - 'lib/net/ssh/transport/hmac/abstract.rb'
@@ -446,7 +380,7 @@ Style/AsciiComments:
446
380
  - 'lib/net/ssh/authentication/pageant.rb'
447
381
  - 'lib/net/ssh/buffered_io.rb'
448
382
 
449
- # Offense count: 8
383
+ # Offense count: 9
450
384
  # Cop supports --auto-correct.
451
385
  # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners.
452
386
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
@@ -487,29 +421,12 @@ Style/CharacterLiteral:
487
421
  Exclude:
488
422
  - 'test/test_buffer.rb'
489
423
 
490
- # Offense count: 15
424
+ # Offense count: 17
491
425
  # Cop supports --auto-correct.
492
426
  # Configuration parameters: AutoCorrect, EnforcedStyle.
493
427
  # SupportedStyles: nested, compact
494
428
  Style/ClassAndModuleChildren:
495
- Exclude:
496
- - 'lib/net/ssh/transport/ctr.rb'
497
- - 'lib/net/ssh/transport/hmac.rb'
498
- - 'lib/net/ssh/transport/hmac/md5.rb'
499
- - 'lib/net/ssh/transport/hmac/md5_96.rb'
500
- - 'lib/net/ssh/transport/hmac/none.rb'
501
- - 'lib/net/ssh/transport/hmac/ripemd160.rb'
502
- - 'lib/net/ssh/transport/hmac/sha1.rb'
503
- - 'lib/net/ssh/transport/hmac/sha1_96.rb'
504
- - 'lib/net/ssh/transport/hmac/sha2_256.rb'
505
- - 'lib/net/ssh/transport/hmac/sha2_256_96.rb'
506
- - 'lib/net/ssh/transport/hmac/sha2_256_etm.rb'
507
- - 'lib/net/ssh/transport/hmac/sha2_512.rb'
508
- - 'lib/net/ssh/transport/hmac/sha2_512_96.rb'
509
- - 'lib/net/ssh/transport/hmac/sha2_512_etm.rb'
510
- - 'lib/net/ssh/transport/kex.rb'
511
- - 'lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb'
512
- - 'lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb'
429
+ Enabled: false
513
430
 
514
431
  # Offense count: 7
515
432
  Style/ClassVars:
@@ -554,13 +471,7 @@ Style/ConditionalAssignment:
554
471
  - 'lib/net/ssh/transport/state.rb'
555
472
  - 'test/test_key_factory.rb'
556
473
 
557
- # Offense count: 1
558
- # Cop supports --auto-correct.
559
- Style/DefWithParentheses:
560
- Exclude:
561
- - 'test/integration/test_forward.rb'
562
-
563
- # Offense count: 14
474
+ # Offense count: 13
564
475
  Style/Documentation:
565
476
  Exclude:
566
477
  - 'spec/**/*'
@@ -568,7 +479,6 @@ Style/Documentation:
568
479
  - 'lib/net/ssh/authentication/ed25519.rb'
569
480
  - 'lib/net/ssh/connection/keepalive.rb'
570
481
  - 'lib/net/ssh/connection/session.rb'
571
- - 'lib/net/ssh/ruby_compat.rb'
572
482
  - 'lib/net/ssh/test/extensions.rb'
573
483
  - 'lib/net/ssh/transport/kex.rb'
574
484
  - 'lib/net/ssh/transport/key_expander.rb'
@@ -602,14 +512,14 @@ Style/FormatStringToken:
602
512
  Exclude:
603
513
  - 'lib/net/ssh/loggable.rb'
604
514
 
605
- # Offense count: 166
515
+ # Offense count: 171
606
516
  # Cop supports --auto-correct.
607
517
  # Configuration parameters: EnforcedStyle.
608
518
  # SupportedStyles: always, never
609
519
  Style/FrozenStringLiteralComment:
610
520
  Enabled: false
611
521
 
612
- # Offense count: 34
522
+ # Offense count: 35
613
523
  # Configuration parameters: MinBodyLength.
614
524
  Style/GuardClause:
615
525
  Enabled: false
@@ -620,7 +530,7 @@ Style/IfInsideElse:
620
530
  Exclude:
621
531
  - 'lib/net/ssh/connection/session.rb'
622
532
 
623
- # Offense count: 16
533
+ # Offense count: 13
624
534
  # Cop supports --auto-correct.
625
535
  Style/IfUnlessModifier:
626
536
  Exclude:
@@ -629,8 +539,6 @@ Style/IfUnlessModifier:
629
539
  - 'lib/net/ssh/proxy/command.rb'
630
540
  - 'lib/net/ssh/service/forward.rb'
631
541
  - 'lib/net/ssh/transport/ctr.rb'
632
- - 'lib/net/ssh/transport/kex.rb'
633
- - 'lib/net/ssh/transport/kex/abstract5656.rb'
634
542
  - 'lib/net/ssh/transport/key_expander.rb'
635
543
  - 'test/integration/test_proxy.rb'
636
544
  - 'test/test_key_factory.rb'
@@ -690,7 +598,7 @@ Style/MultipleComparison:
690
598
  Style/MutableConstant:
691
599
  Enabled: false
692
600
 
693
- # Offense count: 13
601
+ # Offense count: 14
694
602
  # Cop supports --auto-correct.
695
603
  # Configuration parameters: EnforcedStyle.
696
604
  # SupportedStyles: both, prefix, postfix
@@ -734,7 +642,7 @@ Style/Not:
734
642
  Exclude:
735
643
  - 'lib/net/ssh/connection/channel.rb'
736
644
 
737
- # Offense count: 8
645
+ # Offense count: 10
738
646
  # Cop supports --auto-correct.
739
647
  # Configuration parameters: Strict.
740
648
  Style/NumericLiterals:
@@ -771,7 +679,7 @@ Style/ParenthesesAroundCondition:
771
679
  - 'lib/net/ssh/transport/ctr.rb'
772
680
  - 'test/integration/test_proxy.rb'
773
681
 
774
- # Offense count: 33
682
+ # Offense count: 23
775
683
  # Cop supports --auto-correct.
776
684
  # Configuration parameters: PreferredDelimiters.
777
685
  Style/PercentLiteralDelimiters:
@@ -819,19 +727,13 @@ Style/RedundantBegin:
819
727
  - 'lib/net/ssh/verifiers/accept_new.rb'
820
728
  - 'test/manual/test_pageant.rb'
821
729
 
822
- # Offense count: 1
823
- # Cop supports --auto-correct.
824
- Style/RedundantParentheses:
825
- Exclude:
826
- - 'support/arcfour_check.rb'
827
-
828
- # Offense count: 59
730
+ # Offense count: 61
829
731
  # Cop supports --auto-correct.
830
732
  # Configuration parameters: AllowMultipleReturnValues.
831
733
  Style/RedundantReturn:
832
734
  Enabled: false
833
735
 
834
- # Offense count: 14
736
+ # Offense count: 18
835
737
  # Cop supports --auto-correct.
836
738
  Style/RedundantSelf:
837
739
  Exclude:
@@ -910,14 +812,14 @@ Style/SpecialGlobalVars:
910
812
  - 'test/manual/test_pageant.rb'
911
813
  - 'test/test_all.rb'
912
814
 
913
- # Offense count: 1754
815
+ # Offense count: 1801
914
816
  # Cop supports --auto-correct.
915
817
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
916
818
  # SupportedStyles: single_quotes, double_quotes
917
819
  Style/StringLiterals:
918
820
  Enabled: false
919
821
 
920
- # Offense count: 11
822
+ # Offense count: 7
921
823
  # Cop supports --auto-correct.
922
824
  # Configuration parameters: IgnoredMethods.
923
825
  # IgnoredMethods: respond_to, define_method
@@ -928,8 +830,6 @@ Style/SymbolProc:
928
830
  - 'lib/net/ssh/connection/session.rb'
929
831
  - 'lib/net/ssh/test/extensions.rb'
930
832
  - 'lib/net/ssh/transport/algorithms.rb'
931
- - 'test/integration/test_forward.rb'
932
- - 'test/test/test_test.rb'
933
833
 
934
834
  # Offense count: 1
935
835
  # Cop supports --auto-correct.
@@ -937,20 +837,18 @@ Style/UnneededCondition:
937
837
  Exclude:
938
838
  - 'lib/net/ssh/proxy/command.rb'
939
839
 
940
- # Offense count: 4
840
+ # Offense count: 2
941
841
  # Cop supports --auto-correct.
942
842
  Style/UnneededInterpolation:
943
843
  Exclude:
944
844
  - 'lib/net/ssh/proxy/socks5.rb'
945
845
  - 'lib/net/ssh/transport/session.rb'
946
- - 'test/integration/test_forward.rb'
947
846
 
948
- # Offense count: 15
847
+ # Offense count: 2
949
848
  # Cop supports --auto-correct.
950
849
  Style/UnneededPercentQ:
951
850
  Exclude:
952
851
  - 'net-ssh.gemspec'
953
- - 'test/test_config.rb'
954
852
 
955
853
  # Offense count: 2
956
854
  # Cop supports --auto-correct.
@@ -973,10 +871,3 @@ Style/ZeroLengthPredicate:
973
871
  Exclude:
974
872
  - 'lib/net/ssh/buffered_io.rb'
975
873
  - 'lib/net/ssh/connection/channel.rb'
976
-
977
- # Offense count: 1636
978
- # Cop supports --auto-correct.
979
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
980
- # URISchemes: http, https
981
- Metrics/LineLength:
982
- Max: 932
data/CHANGES.txt CHANGED
@@ -1,3 +1,21 @@
1
+ === 6.2.0 rc1
2
+
3
+ === 6.2.0 beta1
4
+
5
+ * rsa-sha2-512, rsa-sha2-256 host_key algs [#771]
6
+ * JRuby aes*-ctr suppport [#767]
7
+
8
+ === 6.1.0
9
+
10
+ * Adapt to ssh's default behaviors when no username is provided.
11
+ When Net::SSH.start user is nil and config has no entry
12
+ we default to Etc.getpwuid.name() instead of Etc.getlogin(). [#749]
13
+
14
+ === 6.1.0.rc1
15
+
16
+ * Make sha2-{256,512}-etm@openssh.com MAC default again [#761]
17
+ * Support algorithm subtraction syntax from ssh_config [#751]
18
+
1
19
  === 6.0.2
2
20
 
3
21
  * Fix corrupted hmac issue in etm hmac [#759]
@@ -12,7 +30,7 @@
12
30
  * Add sha2-{256,512}-etm@openssh.com MAC algorithms [graaff, #714]
13
31
 
14
32
  === 6.0.0 beta2
15
-
33
+
16
34
  * Support :certkeys and CertificateFile configuration option [Anders Carling, #722]
17
35
 
18
36
  === 6.0.0 beta1
@@ -25,7 +43,7 @@
25
43
  === 5.2.0.rc3
26
44
 
27
45
  * Fix check_host_ip read from config
28
- * Support ssh-ed25519 in kown hosts
46
+ * Support ssh-ed25519 in known hosts
29
47
 
30
48
  === 5.2.0.rc2
31
49
 
@@ -48,7 +66,7 @@
48
66
 
49
67
  === 5.0.2
50
68
 
51
- * fix ctr for jruby [#612]
69
+ * Fix ctr for jruby [#612]
52
70
 
53
71
  === 5.0.1
54
72
 
data/README.md CHANGED
@@ -33,7 +33,7 @@ We strongly recommend that you install a servers's version that supports the lat
33
33
 
34
34
  It is possible to return to the previous behavior by adding the option : `append_all_supported_algorithms: true`
35
35
 
36
- Unsecure algoritms will be definively remove in Net::SSH 7.*.
36
+ Unsecure algoritms will definitely be removed in Net::SSH 7.*.
37
37
 
38
38
  ### Host Keys
39
39
 
@@ -63,7 +63,7 @@ Unsecure algoritms will be definively remove in Net::SSH 7.*.
63
63
 
64
64
  | Name | Support | Details |
65
65
  |--------------------------------------|-----------------------|----------|
66
- | aes256-ctr / aes192-ctr / aes128-ctr | OK | [using weak elliptic curves](https://safecurves.cr.yp.to/) |
66
+ | aes256-ctr / aes192-ctr / aes128-ctr | OK | |
67
67
  | aes256-cbc / aes192-cbc / aes128-cbc | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
68
68
  | rijndael-cbc@lysator.liu.se | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
69
69
  | blowfish-ctr blowfish-cbc | Deprecated in 6.0 | unsecure, will be removed in 7.0 |
@@ -97,6 +97,7 @@ In a nutshell:
97
97
  require 'net/ssh'
98
98
 
99
99
  Net::SSH.start('host', 'user', password: "password") do |ssh|
100
+
100
101
  # capture all stderr and stdout output from a remote process
101
102
  output = ssh.exec!("hostname")
102
103
  puts output
@@ -104,7 +105,7 @@ puts output
104
105
  # capture only stdout matching a particular pattern
105
106
  stdout = ""
106
107
  ssh.exec!("ls -l /home/jamis") do |channel, stream, data|
107
- stdout << data if stream == :stdout
108
+ stdout << data if stream == :stdout && /foo/.match(data)
108
109
  end
109
110
  puts stdout
110
111
 
@@ -164,7 +165,7 @@ gem install net-ssh # might need sudo privileges
164
165
  ```
165
166
 
166
167
  NOTE: If you are running on jruby on windows you need to install `jruby-pageant` manually
167
- (gemspec doesn't allow for platform specific dependencies).
168
+ (gemspec doesn't allow for platform specific dependencies at gem installation time).
168
169
 
169
170
  However, in order to be sure the code you're installing hasn't been tampered with,
170
171
  it's recommended that you verify the [signature](http://docs.rubygems.org/read/chapter/21).
data/lib/net/ssh.rb CHANGED
@@ -251,7 +251,7 @@ module Net
251
251
  transport = Transport::Session.new(host, options)
252
252
  auth = Authentication::Session.new(transport, options)
253
253
 
254
- user = options.fetch(:user, user) || Etc.getlogin
254
+ user = options.fetch(:user, user) || Etc.getpwuid.name
255
255
  if auth.authenticate("ssh-connection", user, options[:password])
256
256
  connection = Connection::Session.new(transport, options)
257
257
  if block_given?
@@ -39,6 +39,8 @@ module Net
39
39
  SSH2_AGENT_ADD_IDENTITY = 17
40
40
  SSH2_AGENT_REMOVE_IDENTITY = 18
41
41
  SSH2_AGENT_REMOVE_ALL_IDENTITIES = 19
42
+ SSH2_AGENT_LOCK = 22
43
+ SSH2_AGENT_UNLOCK = 23
42
44
  SSH2_AGENT_ADD_ID_CONSTRAINED = 25
43
45
  SSH2_AGENT_FAILURE = 30
44
46
  SSH2_AGENT_VERSION_RESPONSE = 103
@@ -189,6 +191,18 @@ module Net
189
191
  raise AgentError, "could not remove all identity from agent" if type != SSH_AGENT_SUCCESS
190
192
  end
191
193
 
194
+ # lock the ssh agent with password
195
+ def lock(password)
196
+ type, = send_and_wait(SSH2_AGENT_LOCK, :string, password)
197
+ raise AgentError, "could not lock agent" if type != SSH_AGENT_SUCCESS
198
+ end
199
+
200
+ # unlock the ssh agent with password
201
+ def unlock(password)
202
+ type, = send_and_wait(SSH2_AGENT_UNLOCK, :string, password)
203
+ raise AgentError, "could not unlock agent" if type != SSH_AGENT_SUCCESS
204
+ end
205
+
192
206
  private
193
207
 
194
208
  def unix_socket_class
@@ -35,8 +35,9 @@ module Net
35
35
  cert.valid_before = if RUBY_PLATFORM == "java"
36
36
  # 0x20c49ba5e353f7 = 0x7fffffffffffffff/1000, the largest value possible for JRuby
37
37
  # JRuby Time.at multiplies the arg by 1000, and then stores it in a signed long.
38
- # 0x20c49ba5e353f7 = 292278994-08-17 01:12:55 -0600
39
- Time.at([0x20c49ba5e353f7, buffer.read_int64].min)
38
+ # 0x20c49ba2d52500 = 292278993-01-01 00:00:00 +0000
39
+ # JRuby 9.1 does not accept the year 292278994 because of edge cases (https://github.com/JodaOrg/joda-time/issues/190)
40
+ Time.at([0x20c49ba2d52500, buffer.read_int64].min)
40
41
  else
41
42
  Time.at(buffer.read_int64)
42
43
  end
@@ -69,8 +70,8 @@ module Net
69
70
  key.ssh_do_sign(data)
70
71
  end
71
72
 
72
- def ssh_do_verify(sig, data)
73
- key.ssh_do_verify(sig, data)
73
+ def ssh_do_verify(sig, data, options = {})
74
+ key.ssh_do_verify(sig, data, options)
74
75
  end
75
76
 
76
77
  def to_pem
@@ -123,7 +123,7 @@ module Net
123
123
  ssh_type
124
124
  end
125
125
 
126
- def ssh_do_verify(sig,data)
126
+ def ssh_do_verify(sig, data, options = {})
127
127
  @verify_key.verify(sig,data)
128
128
  end
129
129
 
@@ -683,6 +683,7 @@ module Net
683
683
  #
684
684
  # channel.set_remote_env foo: 'bar', baz: 'whale'
685
685
  def set_remote_env(env)
686
+ env.each { |key, value| puts "E:#{key} V:#{value}" }
686
687
  env.each { |key, value| self.env(key, value) }
687
688
  end
688
689
  end
@@ -146,4 +146,4 @@ module Net
146
146
 
147
147
  end
148
148
  end
149
- end
149
+ end
@@ -39,4 +39,4 @@ module Net
39
39
 
40
40
  end
41
41
  end
42
- end
42
+ end
@@ -179,4 +179,4 @@ module Net
179
179
 
180
180
  end
181
181
  end
182
- end
182
+ end
@@ -33,7 +33,9 @@ module Net
33
33
  ecdsa-sha2-nistp256
34
34
  ssh-rsa-cert-v01@openssh.com
35
35
  ssh-rsa-cert-v00@openssh.com
36
- ssh-rsa],
36
+ ssh-rsa
37
+ rsa-sha2-256
38
+ rsa-sha2-512],
37
39
 
38
40
  kex: %w[ecdh-sha2-nistp521
39
41
  ecdh-sha2-nistp384
@@ -43,7 +45,8 @@ module Net
43
45
 
44
46
  encryption: %w[aes256-ctr aes192-ctr aes128-ctr],
45
47
 
46
- hmac: %w[hmac-sha2-512 hmac-sha2-256
48
+ hmac: %w[hmac-sha2-512-etm@openssh.com hmac-sha2-256-etm@openssh.com
49
+ hmac-sha2-512 hmac-sha2-256
47
50
  hmac-sha1]
48
51
  }.freeze
49
52
 
@@ -83,9 +86,7 @@ module Net
83
86
  hmac-sha1-96
84
87
  hmac-ripemd160 hmac-ripemd160@openssh.com
85
88
  hmac-md5 hmac-md5-96
86
- none] +
87
- %w[hmac-sha2-256-etm@openssh.com
88
- hmac-sha2-512-etm@openssh.com],
89
+ none],
89
90
 
90
91
  compression: %w[none zlib@openssh.com zlib],
91
92
  language: %w[]
@@ -291,10 +292,24 @@ module Net
291
292
  list = []
292
293
  option = Array(option).compact.uniq
293
294
 
294
- if option.first && option.first.start_with?('+')
295
+ if option.first && option.first.start_with?('+', '-')
295
296
  list = supported.dup
296
- list << option.first[1..-1]
297
- list.concat(option[1..-1])
297
+
298
+ appends = option.select { |opt| opt.start_with?('+') }.map { |opt| opt[1..-1] }
299
+ deletions = option.select { |opt| opt.start_with?('-') }.map { |opt| opt[1..-1] }
300
+
301
+ list.concat(appends)
302
+
303
+ deletions.each do |opt|
304
+ if opt.include?('*')
305
+ opt_escaped = Regexp.escape(opt)
306
+ algo_re = /\A#{opt_escaped.gsub('\*', '[A-Za-z\d\-@\.]*')}\z/
307
+ list.delete_if { |existing_opt| algo_re.match(existing_opt) }
308
+ else
309
+ list.delete(opt)
310
+ end
311
+ end
312
+
298
313
  list.uniq!
299
314
  else
300
315
  list = option
@@ -22,9 +22,9 @@ module Net
22
22
  "3des-ctr" => "des-ede3",
23
23
  "blowfish-ctr" => "bf-ecb",
24
24
 
25
- 'aes256-ctr' => 'aes-256-ctr',
26
- 'aes192-ctr' => 'aes-192-ctr',
27
- 'aes128-ctr' => 'aes-128-ctr',
25
+ "aes256-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-256-ctr") ? "aes-256-ctr" : "aes-256-ecb",
26
+ "aes192-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-192-ctr") ? "aes-192-ctr" : "aes-192-ecb",
27
+ "aes128-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-128-ctr") ? "aes-128-ctr" : "aes-128-ecb",
28
28
  'cast128-ctr' => 'cast5-ecb',
29
29
 
30
30
  'none' => 'none'
@@ -64,11 +64,16 @@ module Net
64
64
 
65
65
  private
66
66
 
67
+ def matching?(key_ssh_type, host_key_alg)
68
+ return true if key_ssh_type == host_key_alg
69
+ return true if key_ssh_type == 'ssh-rsa' && ['rsa-sha2-512', 'rsa-sha2-256'].include?(host_key_alg)
70
+ end
71
+
67
72
  # Verify that the given key is of the expected type, and that it
68
73
  # really is the key for the session's host. Raise Net::SSH::Exception
69
74
  # if it is not.
70
75
  def verify_server_key(key) #:nodoc:
71
- if key.ssh_type != algorithms.host_key
76
+ unless matching?(key.ssh_type, algorithms.host_key)
72
77
  raise Net::SSH::Exception, "host key algorithm mismatch '#{key.ssh_type}' != '#{algorithms.host_key}'"
73
78
  end
74
79
 
@@ -97,7 +102,9 @@ module Net
97
102
 
98
103
  hash = digester.digest(response.to_s)
99
104
 
100
- unless connection.host_key_verifier.verify_signature { result[:server_key].ssh_do_verify(result[:server_sig], hash) }
105
+ server_key = result[:server_key]
106
+ server_sig = result[:server_sig]
107
+ unless connection.host_key_verifier.verify_signature { server_key.ssh_do_verify(server_sig, hash, host_key: algorithms.host_key) }
101
108
  raise Net::SSH::Exception, 'could not verify server signature'
102
109
  end
103
110
 
@@ -63,8 +63,17 @@ module OpenSSL
63
63
  end
64
64
 
65
65
  # Verifies the given signature matches the given data.
66
- def ssh_do_verify(sig, data)
67
- verify(OpenSSL::Digest::SHA1.new, sig, data)
66
+ def ssh_do_verify(sig, data, options = {})
67
+ digester =
68
+ if options[:host_key] == "rsa-sha2-512"
69
+ OpenSSL::Digest::SHA512.new
70
+ elsif options[:host_key] == "rsa-sha2-256"
71
+ OpenSSL::Digest::SHA256.new
72
+ else
73
+ OpenSSL::Digest::SHA1.new
74
+ end
75
+
76
+ verify(digester, sig, data)
68
77
  end
69
78
 
70
79
  # Returns the signature for the given data.
@@ -94,7 +103,7 @@ module OpenSSL
94
103
  end
95
104
 
96
105
  # Verifies the given signature matches the given data.
97
- def ssh_do_verify(sig, data)
106
+ def ssh_do_verify(sig, data, options = {})
98
107
  sig_r = sig[0,20].unpack("H*")[0].to_i(16)
99
108
  sig_s = sig[20,20].unpack("H*")[0].to_i(16)
100
109
  a1sig = OpenSSL::ASN1::Sequence([
@@ -192,7 +201,7 @@ module OpenSSL
192
201
  end
193
202
 
194
203
  # Verifies the given signature matches the given data.
195
- def ssh_do_verify(sig, data)
204
+ def ssh_do_verify(sig, data, options = {})
196
205
  digest = digester.digest(data)
197
206
  a1sig = nil
198
207
 
@@ -49,14 +49,14 @@ module Net
49
49
  MAJOR = 6
50
50
 
51
51
  # The minor component of this version of the Net::SSH library
52
- MINOR = 0
52
+ MINOR = 2
53
53
 
54
54
  # The tiny component of this version of the Net::SSH library
55
- TINY = 2
55
+ TINY = 0
56
56
 
57
57
  # The prerelease component of this version of the Net::SSH library
58
58
  # nil allowed
59
- PRE = nil
59
+ PRE = "rc2"
60
60
 
61
61
  # The current version of the Net::SSH library as a Version instance
62
62
  CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.2
4
+ version: 6.2.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -31,7 +31,7 @@ cert_chain:
31
31
  voajiJNS75Pw/2j13WnPB4Q6w7dHSb57E/VluBpVKmcQZN0dGdAkEIVty3v7kw9g
32
32
  y++VpCpWM/PstIFv4ApZMf501UY=
33
33
  -----END CERTIFICATE-----
34
- date: 2020-04-25 00:00:00.000000000 Z
34
+ date: 2021-03-12 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bcrypt_pbkdf
@@ -156,6 +156,7 @@ extra_rdoc_files:
156
156
  - LICENSE.txt
157
157
  - README.md
158
158
  files:
159
+ - ".github/workflows/ci.yml"
159
160
  - ".gitignore"
160
161
  - ".rubocop.yml"
161
162
  - ".rubocop_todo.yml"
@@ -279,9 +280,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
280
  version: '2.3'
280
281
  required_rubygems_version: !ruby/object:Gem::Requirement
281
282
  requirements:
282
- - - ">="
283
+ - - ">"
283
284
  - !ruby/object:Gem::Version
284
- version: '0'
285
+ version: 1.3.1
285
286
  requirements: []
286
287
  rubygems_version: 3.0.3
287
288
  signing_key:
metadata.gz.sig CHANGED
Binary file