sftp_server 0.5.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.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +2 -0
- data/lib/sftp_server.rb +2 -0
- data/lib/sftp_server/c/api.rb +13 -0
- data/lib/sftp_server/server.rb +417 -0
- data/lib/sftp_server/ssh/api.rb +1152 -0
- data/lib/sftp_server/version.rb +3 -0
- data/sample/background.rb +30 -0
- data/sample/basic.rb +22 -0
- data/sample/keys/ssh_host_dsa_key +12 -0
- data/sample/keys/ssh_host_dsa_key.pub +1 -0
- data/sample/keys/ssh_host_rsa_key +27 -0
- data/sample/keys/ssh_host_rsa_key.pub +1 -0
- data/sftp_server.gemspec +25 -0
- metadata +105 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
|
6
|
+
require 'sftp_server'
|
7
|
+
|
8
|
+
dsa_key = File.expand_path('../keys/ssh_host_dsa_key', __FILE__)
|
9
|
+
fail "could not find dsa key file: #{dsa_key}" unless File.exist?(dsa_key)
|
10
|
+
|
11
|
+
rsa_key = File.expand_path('../keys/ssh_host_rsa_key', __FILE__)
|
12
|
+
fail "could not find rsa key file: #{rsa_key}" unless File.exist?(rsa_key)
|
13
|
+
|
14
|
+
server_pid = fork do
|
15
|
+
server = SFTPServer::Server.new(
|
16
|
+
dsa_key: dsa_key,
|
17
|
+
rsa_key: rsa_key,
|
18
|
+
user_name: 'test',
|
19
|
+
password: 'test',
|
20
|
+
port: '2299',
|
21
|
+
listen_address: '0.0.0.0'
|
22
|
+
)
|
23
|
+
server.open
|
24
|
+
end
|
25
|
+
|
26
|
+
puts 'Waiting for server to close'
|
27
|
+
|
28
|
+
Process.wait(server_pid)
|
29
|
+
|
30
|
+
puts 'Server closed'
|
data/sample/basic.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
|
6
|
+
require 'sftp_server'
|
7
|
+
|
8
|
+
dsa_key = File.expand_path('../keys/ssh_host_dsa_key', __FILE__)
|
9
|
+
fail "could not find dsa key file: #{dsa_key}" unless File.exist?(dsa_key)
|
10
|
+
|
11
|
+
rsa_key = File.expand_path('../keys/ssh_host_rsa_key', __FILE__)
|
12
|
+
fail "could not find rsa key file: #{rsa_key}" unless File.exist?(rsa_key)
|
13
|
+
|
14
|
+
server = SFTPServer::Server.new(
|
15
|
+
dsa_key: dsa_key,
|
16
|
+
rsa_key: rsa_key,
|
17
|
+
user_name: 'test',
|
18
|
+
password: 'test',
|
19
|
+
port: '2299',
|
20
|
+
listen_address: '0.0.0.0'
|
21
|
+
)
|
22
|
+
server.open
|
@@ -0,0 +1,12 @@
|
|
1
|
+
-----BEGIN DSA PRIVATE KEY-----
|
2
|
+
MIIBvAIBAAKBgQDUnWaAEUbM+bWDaTN5Uy8vP5GHlypG9s8cazJBMUxZ93scQWUM
|
3
|
+
3rvcYIL7qLlaUBgX99pvpP2v0R+a6vspk0u2AIRvh+u+CLkNwzDuX9dZsc0U3zTS
|
4
|
+
dkubnRUxzbRME2zQ6/8hWlmjL+B5wQEyxDwHJNj12huugZN4uvnfX0SVHwIVAPAX
|
5
|
+
qlM6kufiCFPurQCnmZYPJooNAoGBAK3NmzU0uQ9Wq18U6DBE3snufvdS23L414V6
|
6
|
+
LYnW08EbImk0Aw3GtMSmsYAvK9ZrULpT6zBT708RPBrpbXV+a/vnH3NC8g0kWf5B
|
7
|
+
7FqvUg+BtKTqZueXASiyI8Rgy1sRuyM3dQyQrw9Sk87RpeFZ/hYirO/RlGg543ga
|
8
|
+
rZkuMQyCAoGBAIhuiivxtt2co1SD6DIy5KwzogSq3na5R8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: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sftp_server/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sftp_server"
|
8
|
+
spec.version = SFTPServer::VERSION
|
9
|
+
spec.authors = ["M. Scott Ford"]
|
10
|
+
spec.email = ["scott@corgibytes.com"]
|
11
|
+
spec.summary = %q{A simple SFTP server for testing clients}
|
12
|
+
spec.description = %q{Uses libssh via FFI to create an SFTP server. Useful for testing interactions with a remote SFTP server.}
|
13
|
+
spec.homepage = "https://github.com/corgibytes/sftp_server"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
|
24
|
+
spec.add_dependency 'ffi', '~> 1.9'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sftp_server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- M. Scott Ford
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ffi
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
description: Uses libssh via FFI to create an SFTP server. Useful for testing interactions
|
56
|
+
with a remote SFTP server.
|
57
|
+
email:
|
58
|
+
- scott@corgibytes.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".ruby-version"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- lib/sftp_server.rb
|
70
|
+
- lib/sftp_server/c/api.rb
|
71
|
+
- lib/sftp_server/server.rb
|
72
|
+
- lib/sftp_server/ssh/api.rb
|
73
|
+
- lib/sftp_server/version.rb
|
74
|
+
- sample/background.rb
|
75
|
+
- sample/basic.rb
|
76
|
+
- sample/keys/ssh_host_dsa_key
|
77
|
+
- sample/keys/ssh_host_dsa_key.pub
|
78
|
+
- sample/keys/ssh_host_rsa_key
|
79
|
+
- sample/keys/ssh_host_rsa_key.pub
|
80
|
+
- sftp_server.gemspec
|
81
|
+
homepage: https://github.com/corgibytes/sftp_server
|
82
|
+
licenses:
|
83
|
+
- MIT
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.2.2
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: A simple SFTP server for testing clients
|
105
|
+
test_files: []
|