net-ssh 8.0.3 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGES.txt +14 -0
  4. data/lib/net/ssh/authentication/certificate.rb +2 -2
  5. data/lib/net/ssh/authentication/methods/abstract.rb +4 -0
  6. data/lib/net/ssh/authentication/methods/hostbased.rb +3 -3
  7. data/lib/net/ssh/authentication/methods/publickey.rb +50 -38
  8. data/lib/net/ssh/authentication/session.rb +2 -1
  9. data/lib/net/ssh/buffer.rb +2 -2
  10. data/lib/net/ssh/config.rb +95 -38
  11. data/lib/net/ssh/multiplex.rb +3 -2
  12. data/lib/net/ssh/prompt.rb +41 -3
  13. data/lib/net/ssh/proxy/jump.rb +21 -6
  14. data/lib/net/ssh/transport/algorithms.rb +4 -1
  15. data/lib/net/ssh/transport/session.rb +20 -2
  16. data/lib/net/ssh/version.rb +2 -2
  17. data/lib/net/ssh.rb +17 -5
  18. data.tar.gz.sig +0 -0
  19. metadata +3 -31
  20. metadata.gz.sig +0 -0
  21. data/.dockerignore +0 -9
  22. data/.github/FUNDING.yml +0 -1
  23. data/.github/config/rubocop_linter_action.yml +0 -4
  24. data/.github/pull_request_template.md +0 -1
  25. data/.github/workflows/changelog.yml +0 -18
  26. data/.github/workflows/ci-with-docker.yml +0 -55
  27. data/.github/workflows/ci.yml +0 -84
  28. data/.github/workflows/rubocop.yml +0 -18
  29. data/.gitignore +0 -15
  30. data/.rubocop.yml +0 -26
  31. data/.rubocop_todo.yml +0 -1077
  32. data/CONTRIBUTING.md +0 -34
  33. data/DEVELOPMENT.md +0 -23
  34. data/Dockerfile +0 -32
  35. data/Dockerfile.openssl3 +0 -17
  36. data/Dockerfile.zlib_ng +0 -29
  37. data/Gemfile +0 -15
  38. data/ISSUE_TEMPLATE.md +0 -30
  39. data/Manifest +0 -132
  40. data/Rakefile +0 -214
  41. data/SECURITY.md +0 -4
  42. data/THANKS.txt +0 -110
  43. data/appveyor.yml +0 -46
  44. data/changelog.d/README.md +0 -1
  45. data/docker-compose.yml +0 -17
  46. data/net-ssh-public_cert.pem +0 -21
  47. data/net-ssh.gemspec +0 -45
  48. data/support/ssh_tunnel_bug.rb +0 -65
data/lib/net/ssh.rb CHANGED
@@ -69,7 +69,7 @@ module Net
69
69
  host_name user properties passphrase keys_only max_pkt_size
70
70
  max_win_size send_env set_env use_agent number_of_password_prompts
71
71
  append_all_supported_algorithms non_interactive password_prompt
72
- agent_socket_factory minimum_dh_bits verify_host_key
72
+ prompt_without_tty agent_socket_factory minimum_dh_bits verify_host_key
73
73
  fingerprint_hash check_host_ip pubkey_algorithms no_delay
74
74
  control_master control_path preopen_channels
75
75
  ]
@@ -216,7 +216,10 @@ module Net
216
216
  # * :non_interactive => set to true if your app is non interactive and prefers
217
217
  # authentication failure vs password prompt. Non-interactive applications
218
218
  # should set it to true to prefer failing a password/etc auth methods vs.
219
- # asking for password.
219
+ # asking for password. Like OpenSSH, Net::SSH never prompts when $stdin is
220
+ # not a TTY (e.g. in a background job), so it defaults to +true+ then,
221
+ # unless :password_prompt or :prompt_without_tty is given or an
222
+ # SSH_ASKPASS program can be used (see Net::SSH::Prompt.askpass).
220
223
  # * :passphrase => the passphrase to use when loading a private key (default
221
224
  # is +nil+, for no passphrase)
222
225
  # * :password => the password to use to login
@@ -227,6 +230,10 @@ module Net
227
230
  # costs one round trip instead of two. The spare counts against the
228
231
  # server's MaxSessions; if the server refuses it, pre-opening stops for
229
232
  # the session. Defaults to +false+.
233
+ # * :prompt_without_tty => set to +true+ to prompt for passwords, key
234
+ # passphrases and keyboard-interactive responses on $stdout/$stdin even
235
+ # when $stdin is not a TTY, e.g. to read a password piped into the
236
+ # process. Defaults to +false+.
230
237
  # * :properties => a hash of key/value pairs to add to the new connection's
231
238
  # properties (see Net::SSH::Connection::Session#properties)
232
239
  # * :proxy => a proxy instance (see Proxy) to use when connecting
@@ -306,7 +313,7 @@ module Net
306
313
  assign_defaults(options)
307
314
 
308
315
  options[:user] = user if user
309
- options = configuration_for(host, options.fetch(:config, true)).merge(options)
316
+ options = configuration_for(host, options.fetch(:config, true), user: options[:user]).merge(options)
310
317
  host = options.fetch(:host_name, host)
311
318
 
312
319
  options[:check_host_ip] = true unless options.key?(:check_host_ip)
@@ -365,15 +372,17 @@ module Net
365
372
  # be a file name (or array of file names) of SSH configuration file(s)
366
373
  # to read.
367
374
  #
375
+ # +user+ is the explicitly requested remote user, matched by <tt>Match User</tt>.
376
+ #
368
377
  # See Net::SSH::Config for the full description of all supported options.
369
- def self.configuration_for(host, use_ssh_config)
378
+ def self.configuration_for(host, use_ssh_config, user: nil)
370
379
  files = case use_ssh_config
371
380
  when true then Net::SSH::Config.expandable_default_files
372
381
  when false, nil then return {}
373
382
  else Array(use_ssh_config)
374
383
  end
375
384
 
376
- Net::SSH::Config.for(host, files)
385
+ Net::SSH::Config.for(host, files, user: user)
377
386
  end
378
387
 
379
388
  def self.assign_defaults(options)
@@ -382,6 +391,9 @@ module Net
382
391
  options[:logger].level = Logger::FATAL
383
392
  end
384
393
 
394
+ unless options[:password_prompt] || options[:prompt_without_tty] || Prompt.can_ask?
395
+ options[:non_interactive] = true
396
+ end
385
397
  options[:password_prompt] ||= Prompt.default(options)
386
398
 
387
399
  %i[password passphrase].each do |key|
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.3
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
8
8
  - Delano Mandelbaum
9
9
  - Miklós Fazekas
10
10
  autorequire:
11
- bindir: exe
11
+ bindir: bin
12
12
  cert_chain:
13
13
  - |
14
14
  -----BEGIN CERTIFICATE-----
@@ -32,7 +32,7 @@ cert_chain:
32
32
  ufHf4AX2UIkJbh7zCPkiNCqIr7MSWLNFG/9lOlHYsEJM8XujT1ofPobYx6YSFx/C
33
33
  7HBrI7UX7awt6UvBZebhcHzyMHxg/B5PVQllPA==
34
34
  -----END CERTIFICATE-----
35
- date: 2026-10-25 00:00:00.000000000 Z
35
+ date: 2026-11-02 00:00:00.000000000 Z
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: logger
@@ -191,34 +191,9 @@ extra_rdoc_files:
191
191
  - LICENSE.txt
192
192
  - README.md
193
193
  files:
194
- - ".dockerignore"
195
- - ".github/FUNDING.yml"
196
- - ".github/config/rubocop_linter_action.yml"
197
- - ".github/pull_request_template.md"
198
- - ".github/workflows/changelog.yml"
199
- - ".github/workflows/ci-with-docker.yml"
200
- - ".github/workflows/ci.yml"
201
- - ".github/workflows/rubocop.yml"
202
- - ".gitignore"
203
- - ".rubocop.yml"
204
- - ".rubocop_todo.yml"
205
194
  - CHANGES.txt
206
- - CONTRIBUTING.md
207
- - DEVELOPMENT.md
208
- - Dockerfile
209
- - Dockerfile.openssl3
210
- - Dockerfile.zlib_ng
211
- - Gemfile
212
- - ISSUE_TEMPLATE.md
213
195
  - LICENSE.txt
214
- - Manifest
215
196
  - README.md
216
- - Rakefile
217
- - SECURITY.md
218
- - THANKS.txt
219
- - appveyor.yml
220
- - changelog.d/README.md
221
- - docker-compose.yml
222
197
  - lib/net/ssh.rb
223
198
  - lib/net/ssh/authentication/agent.rb
224
199
  - lib/net/ssh/authentication/certificate.rb
@@ -322,9 +297,6 @@ files:
322
297
  - lib/net/ssh/verifiers/always.rb
323
298
  - lib/net/ssh/verifiers/never.rb
324
299
  - lib/net/ssh/version.rb
325
- - net-ssh-public_cert.pem
326
- - net-ssh.gemspec
327
- - support/ssh_tunnel_bug.rb
328
300
  homepage: https://github.com/net-ssh/net-ssh
329
301
  licenses:
330
302
  - MIT
metadata.gz.sig CHANGED
Binary file
data/.dockerignore DELETED
@@ -1,9 +0,0 @@
1
- # Remove Git
2
- .git/
3
- .gitignore
4
-
5
- # Vagrant
6
- test/integration/.vagrant
7
-
8
- docker-compose.yml
9
- README.md
data/.github/FUNDING.yml DELETED
@@ -1 +0,0 @@
1
- github: [mfazekas]
@@ -1,4 +0,0 @@
1
- rubocop_fail_level: "convention"
2
-
3
- versions:
4
- rubocop: "1.27.0"
@@ -1 +0,0 @@
1
- <!-- After opening the PR, add a changelog.d/<PR number>.<type>.txt fragment (none, change, security, breaking or breaking-security) instead of editing CHANGES.txt; see CONTRIBUTING.md#changelog. -->
@@ -1,18 +0,0 @@
1
- name: Changelog
2
-
3
- on:
4
- pull_request:
5
- types: [opened, synchronize, reopened, labeled, unlabeled]
6
-
7
- permissions:
8
- contents: read
9
-
10
- jobs:
11
- changelog:
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v4
15
- with:
16
- # HEAD is the PR merged into the base branch; HEAD^1 is the base it was merged into.
17
- fetch-depth: 2
18
- - uses: net-ssh/changelogd@v1
@@ -1,55 +0,0 @@
1
- name: Test
2
- on:
3
- pull_request:
4
- push: { branches: master }
5
-
6
- jobs:
7
- test:
8
- name: Run test suite with docker
9
- runs-on: ubuntu-latest
10
- env:
11
- COMPOSE_FILE: docker-compose.yml
12
-
13
- steps:
14
- - name: Checkout code
15
- uses: actions/checkout@v4
16
-
17
- - name: Build docker images
18
- run: docker compose build
19
-
20
- - name: Run ruby 2.7
21
- run: docker compose run ruby-2.7
22
-
23
- - name: Run ruby 3.0
24
- run: docker compose run ruby-3.0
25
-
26
- - name: Run ruby 3.1
27
- run: docker compose run ruby-3.1
28
-
29
- test_openssl3:
30
- name: Run test suite with docker and openssl 3.0
31
- runs-on: ubuntu-latest
32
-
33
- steps:
34
- - name: Checkout code
35
- uses: actions/checkout@v4
36
-
37
- - name: Build docker images
38
- run: docker build -t netssh_openssl3 -f Dockerfile.openssl3 .
39
-
40
- - name: Run ruby 3.0 with openssl3
41
- run: docker run --rm netssh_openssl3
42
-
43
- test_zlib_ng:
44
- name: Run test suite with docker and zlib-ng
45
- runs-on: ubuntu-latest
46
-
47
- steps:
48
- - name: Checkout code
49
- uses: actions/checkout@v4
50
-
51
- - name: Build docker images
52
- run: docker build -t netssh_zlib_ng -f Dockerfile.zlib_ng .
53
-
54
- - name: Run ruby with zlib-ng
55
- run: docker run --rm netssh_zlib_ng
@@ -1,84 +0,0 @@
1
- name: CI
2
- on:
3
- pull_request:
4
- push: { branches: master }
5
- jobs:
6
- test:
7
- runs-on: ubuntu-22.04
8
- strategy:
9
- matrix:
10
- ruby-version: [2.7.8, 3.0.6, 3.1.3, 3.2.1, 3.3, 3.4, '4.0']
11
- steps:
12
- - uses: actions/checkout@v3
13
-
14
- - name: Set up Ruby ${{ matrix.ruby-version }}
15
- uses: ruby/setup-ruby@v1
16
- with:
17
- ruby-version: ${{ matrix.ruby-version }}
18
- - name: Set up Python ${{ matrix.python-version }}
19
- uses: actions/setup-python@v2
20
- with:
21
- python-version: 3.8
22
-
23
- - name: Cache bundler
24
- uses: actions/cache@v4
25
- id: bundler-cache
26
- with:
27
- path: vendor/bundle
28
- key: ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v3-${{ hashFiles('**/Gemfile') }}-${{ hashFiles('**/net-ssh.gemspec') }}
29
- restore-keys: |
30
- ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v3-
31
-
32
- - name: Cache pip
33
- uses: actions/cache@v4
34
- id: pip-cache
35
- with:
36
- path: ~/.cache/pip
37
- key: ${{ runner.os }}-pip-v1
38
- restore-keys: |
39
- ${{ runner.os }}-pip-v1
40
- - name: Bundle install
41
- run: |
42
- gem install bundler ${{ startsWith(matrix.ruby-version, '2.7.') && '-v 2.4.22' || '' }}
43
- bundle config set path 'vendor/bundle'
44
- bundle config set --local path 'vendor/bundle'
45
- bundle install --jobs 4 --retry 3
46
- env:
47
- BUNDLE_PATH: vendor/bundle
48
-
49
-
50
- - name: Add to etc/hosts
51
- run: |
52
- sudo echo "127.0.0.1 gateway.netssh" | sudo tee -a /etc/hosts
53
- - name: Check sshd_config
54
- run: sudo cat '/etc/ssh/sshd_config' || true
55
- - name: Check sshd_config2
56
- run: sudo cat /etc/ssh/sshd_config.d/*.conf || true
57
- - name: Check sshd pid
58
- run: sudo ps aux | grep sshd
59
- - name: Ansible install
60
- run: |
61
- python -m pip install --upgrade pip
62
- pip install ansible urllib3 pyOpenSSL ndg-httpsclient pyasn1
63
- ansible-galaxy install rvm.ruby
64
- pwd
65
- uname -a
66
- export
67
- who am i
68
- 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'
69
- - name: Check sshd_config
70
- run: sudo cat '/etc/ssh/sshd_config' || true
71
- - name: Check sshd pid
72
- run: sudo ps aux | grep sshd
73
- - name: Check sshd_config2
74
- run: sudo cat /etc/ssh/sshd_config.d/*.conf || true
75
- - name: Run Tests
76
- run: bundle exec rake test
77
- env:
78
- NET_SSH_RUN_INTEGRATION_TESTS: 1
79
- CI: 1
80
- RUBYOPT: '--enable=frozen-string-literal'
81
- - name: Run test helper test
82
- run: bundle exec rake test_test
83
- env:
84
- RUBYOPT: '--enable=frozen-string-literal'
@@ -1,18 +0,0 @@
1
- name: Rubocop
2
-
3
- on:
4
- pull_request:
5
- push: { branches: master }
6
-
7
- jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v3
12
- - name: Set up Ruby 3.1
13
- uses: ruby/setup-ruby@v1
14
- with:
15
- ruby-version: 3.1
16
- bundler-cache: true
17
- - name: Run RuboCop
18
- run: bundle exec rubocop
data/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- /Gemfile.lock
2
- /Gemfile.noed25519.lock
3
- doc
4
- rdoc
5
- ri
6
- pkg
7
- *.swp
8
- test/integration/.vagrant
9
- test/integration/playbook.retry
10
-
11
- lib/net/ssh/version.rb.old
12
-
13
- .byebug_history
14
-
15
- tryout
data/.rubocop.yml DELETED
@@ -1,26 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - 'tryout/**/*'
4
- - "vendor/**/.*"
5
- - "vendor/**/*"
6
- NewCops: enable
7
- TargetRubyVersion: 2.7
8
-
9
- inherit_from: .rubocop_todo.yml
10
-
11
- Style/DoubleNegation:
12
- Exclude:
13
- - 'lib/net/ssh/key_factory.rb'
14
-
15
- Layout/LineLength:
16
- Max: 150
17
- Exclude:
18
- - 'test/**/*.rb'
19
- - 'net-ssh.gemspec'
20
-
21
- Style/EmptyLiteral:
22
- Enabled: false
23
-
24
- # CI runs the suite with RUBYOPT=--enable=frozen-string-literal instead of a magic comment in every file.
25
- Style/FrozenStringLiteralComment:
26
- Enabled: false