Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Pure Ruby implementation of an SSH (protocol 2) client

License

NotificationsYou must be signed in to change notification settings

net-ssh/net-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gem VersionJoin the chat at https://gitter.im/net-ssh/net-sshBuild statusCoverage statusBackers on Open CollectiveSponsors on Open Collective

Net::SSH 7.x

As of v2.6.4, all gem releases are signed. SeeINSTALL.

DESCRIPTION:

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.

FEATURES:

  • Execute processes on remote servers and capture their output
  • Run multiple processes in parallel over a single SSH connection
  • Support for SSH subsystems
  • Forward local and remote ports via an SSH connection

Supported Algorithms

Net::SSH 6.0 disables by default the usage of weak algorithms.We strongly recommend that you install a servers's version that supports the latest algorithms.

It is possible to return to the previous behavior by adding the option :append_all_supported_algorithms: true

Unsecure algoritms will definitely be removed in Net::SSH 8.*.

Host Keys

NameSupportDetails
ssh-rsaOK
ssh-ed25519OKRequire the gemed25519
ecdsa-sha2-nistp521OKusing weak elliptic curves
ecdsa-sha2-nistp384OKusing weak elliptic curves
ecdsa-sha2-nistp256OKusing weak elliptic curves
ssh-dssDeprecated in 6.0unsecure, will be removed in 8.0

Key Exchange

NameSupportDetails
curve25519-sha256OKRequire the gemx25519
ecdh-sha2-nistp521OKusing weak elliptic curves
ecdh-sha2-nistp384OKusing weak elliptic curves
ecdh-sha2-nistp256OKusing weak elliptic curves
diffie-hellman-group1-sha1Deprecated in 6.0unsecure, will be removed in 8.0
diffie-hellman-group14-sha1OK
diffie-hellman-group-exchange-sha1Deprecated in 6.0unsecure, will be removed in 8.0
diffie-hellman-group-exchange-sha256OK

Encryption algorithms (ciphers)

NameSupportDetails
aes256-ctr / aes192-ctr / aes128-ctrOK
chacha20-poly1305@openssh.comOK.Requires the gemrbnacl
aes256-cbc / aes192-cbc / aes128-cbcDeprecated in 6.0unsecure, will be removed in 8.0
rijndael-cbc@lysator.liu.seDeprecated in 6.0unsecure, will be removed in 8.0
blowfish-ctr blowfish-cbcDeprecated in 6.0unsecure, will be removed in 8.0
cast128-ctr cast128-cbcDeprecated in 6.0unsecure, will be removed in 8.0
3des-ctr 3des-cbcDeprecated in 6.0unsecure, will be removed in 8.0
idea-cbcDeprecated in 6.0unsecure, will be removed in 8.0
noneDeprecated in 6.0unsecure, will be removed in 8.0

Message Authentication Code algorithms

NameSupportDetails
hmac-sha2-512-etmOK
hmac-sha2-256-etmOK
hmac-sha2-512OK
hmac-sha2-256OK
hmac-sha2-512-96Deprecated in 6.0removed from the specification, will be removed in 8.0
hmac-sha2-256-96Deprecated in 6.0removed from the specification, will be removed in 8.0
hmac-sha1OKfor backward compatibility
hmac-sha1-96Deprecated in 6.0unsecure, will be removed in 8.0
hmac-ripemd160Deprecated in 6.0unsecure, will be removed in 8.0
hmac-md5Deprecated in 6.0unsecure, will be removed in 8.0
hmac-md5-96Deprecated in 6.0unsecure, will be removed in 8.0
noneDeprecated in 6.0unsecure, will be removed in 8.0

SYNOPSIS:

In a nutshell:

require'net/ssh'Net::SSH.start('host','user',password:"password")do |ssh|# capture all stderr and stdout output from a remote processoutput=ssh.exec!("hostname")putsoutput# capture only stdout matching a particular patternstdout=""ssh.exec!("ls -l /home/jamis")do |channel,stream,data|stdout <<dataifstream ==:stdout &&/foo/.match(data)endputsstdout# run multiple processes in parallel to completionssh.exec"sed ..."ssh.exec"awk ..."ssh.exec"rm -rf ..."ssh.loop# open a new channel and configure a minimal set of callbacks, then run# the event loop until the channel finishes (closes)channel=ssh.open_channeldo |ch|ch.exec"/usr/local/bin/ruby /path/to/file.rb"do |ch,success|raise"could not execute command"unlesssuccess# "on_data" is called when the process writes something to stdoutch.on_datado |c,data|      $stdout.printdataend# "on_extended_data" is called when the process writes something to stderrch.on_extended_datado |c,type,data|      $stderr.printdataendch.on_close{puts"done!"}endendchannel.wait# forward connections on local port 1234 to port 80 of www.capify.orgssh.forward.local(1234,"www.capify.org",80)ssh.loop{true}end

See Net::SSH for more documentation, and links to further information.

REQUIREMENTS:

The only requirement you might be missing is the OpenSSL bindings for Ruby with a version greather than1.0.1.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:

ruby -ropenssl -e'puts OpenSSL::OPENSSL_VERSION'

If that spits out something likeOpenSSL 1.0.1 14 Mar 2012, 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.

INSTALL:

gem install net-ssh# might need sudo privileges

NOTE: If you are running on jruby on windows you need to installjruby-pageant manually(gemspec doesn't allow for platform specific dependencies at gem installation time).

However, in order to be sure the code you're installing hasn't been tampered with,it's recommended that you verify thesignature.To do this, you need to add my public key as a trusted certificate (you only need to do this once):

# Add the public key as a trusted certificate# (You only need to do this once)curl -O https://raw.githubusercontent.com/net-ssh/net-ssh/master/net-ssh-public_cert.pemgem cert --add net-ssh-public_cert.pem

Then, when install the gem, do so with high security:

gem install net-ssh -P HighSecurity

If you don't add the public key, you'll see an error like "Couldn't verify data signature".If you're still having trouble let me know and I'll give you a hand.

For ed25519 public key auth support your bundle file should contained25519,bcrypt_pbkdf dependencies.

gem install ed25519gem install bcrypt_pbkdf

For curve25519-sha256 kex exchange support your bundle file should containx25519 dependency.

RUBY SUPPORT

RUNNING TESTS

If you want to run the tests or use any of the Rake tasks, you'll need Mocha andother dependencies listed in Gemfile

Run the test suite from the net-ssh directory with the following command:

bundleexec raketest

NOTE : you can run test on all ruby versions with docker :

docker-compose up --build

Run a single test file like this:

ruby -Ilib -Itest test/transport/test_server_version.rb

To run integration tests seehere

BUILDING GEM

rake build

GEM SIGNING (for maintainers)

If you have the net-ssh private signing key, you will be able to create signed release builds. Make sure the private key path matches thesigning_key path set innet-ssh.gemspec and tell rake to sign the gem by setting theNET_SSH_BUILDGEM_SIGNED flag:

NET_SSH_BUILDGEM_SIGNED=true rake build

For time to time, the public certificate associated to the private key needs to be renewed. You can do this with the following command:

gem cert --build netssh@solutious.com --private-key path/2/net-ssh-private_key.pemmv gem-public_cert.pem net-ssh-public_cert.pemgem cert --add net-ssh-public_cert.pem

orrake cert:update_public_when_expired

Security contact information

SeeSECURITY.md

CREDITS

Contributors

This project exists thanks to all the people who contribute.

contributors

Backers

Thank you to all our backers! 🙏Become a backer

backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.Become a sponsor

Sponsor

LICENSE:

(The MIT License)

Copyright (c) 2008 Jamis Buck

Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the'Software'), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:

The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANYCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Pure Ruby implementation of an SSH (protocol 2) client

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp