scout 5.3.5 → 5.4.4.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/CHANGELOG +0 -12
- data/Gemfile +4 -0
- data/README +8 -0
- data/Rakefile +6 -108
- data/bin/scout +1 -0
- data/lib/scout.rb +5 -4
- data/lib/scout/command.rb +11 -12
- data/lib/scout/command/install.rb +1 -1
- data/lib/scout/command/run.rb +13 -1
- data/lib/scout/command/sign.rb +2 -8
- data/lib/scout/command/stream.rb +50 -0
- data/lib/scout/command/test.rb +1 -1
- data/lib/scout/daemon_spawn.rb +215 -0
- data/lib/scout/plugin.rb +20 -1
- data/lib/scout/server.rb +16 -111
- data/lib/scout/server_base.rb +100 -0
- data/lib/scout/streamer.rb +162 -0
- data/lib/scout/streamer_control.rb +43 -0
- data/lib/scout/version.rb +3 -0
- data/scout.gemspec +27 -0
- data/test/plugins/disk_usage.rb +86 -0
- data/test/scout_test.rb +598 -0
- data/vendor/pusher-gem/Gemfile +2 -0
- data/vendor/pusher-gem/LICENSE +20 -0
- data/vendor/pusher-gem/README.md +80 -0
- data/vendor/pusher-gem/Rakefile +11 -0
- data/vendor/pusher-gem/examples/async_message.rb +28 -0
- data/vendor/pusher-gem/lib/pusher.rb +107 -0
- data/vendor/pusher-gem/lib/pusher/channel.rb +154 -0
- data/vendor/pusher-gem/lib/pusher/request.rb +107 -0
- data/vendor/pusher-gem/pusher.gemspec +28 -0
- data/vendor/pusher-gem/spec/channel_spec.rb +274 -0
- data/vendor/pusher-gem/spec/pusher_spec.rb +87 -0
- data/vendor/pusher-gem/spec/spec_helper.rb +13 -0
- data/vendor/ruby-hmac/History.txt +15 -0
- data/vendor/ruby-hmac/Manifest.txt +11 -0
- data/vendor/ruby-hmac/README.md +41 -0
- data/vendor/ruby-hmac/Rakefile +23 -0
- data/vendor/ruby-hmac/lib/hmac-md5.rb +11 -0
- data/vendor/ruby-hmac/lib/hmac-rmd160.rb +11 -0
- data/vendor/ruby-hmac/lib/hmac-sha1.rb +11 -0
- data/vendor/ruby-hmac/lib/hmac-sha2.rb +25 -0
- data/vendor/ruby-hmac/lib/hmac.rb +118 -0
- data/vendor/ruby-hmac/lib/ruby_hmac.rb +2 -0
- data/vendor/ruby-hmac/ruby-hmac.gemspec +33 -0
- data/vendor/ruby-hmac/test/test_hmac.rb +89 -0
- data/vendor/signature/.document +5 -0
- data/vendor/signature/.gitignore +21 -0
- data/vendor/signature/Gemfile +3 -0
- data/vendor/signature/Gemfile.lock +29 -0
- data/vendor/signature/LICENSE +20 -0
- data/vendor/signature/README.md +55 -0
- data/vendor/signature/Rakefile +2 -0
- data/vendor/signature/VERSION +1 -0
- data/vendor/signature/lib/signature.rb +142 -0
- data/vendor/signature/lib/signature/version.rb +3 -0
- data/vendor/signature/signature.gemspec +22 -0
- data/vendor/signature/spec/signature_spec.rb +176 -0
- data/vendor/signature/spec/spec_helper.rb +10 -0
- data/vendor/util/lib/core_extensions.rb +60 -0
- metadata +120 -84
- data/AUTHORS +0 -4
- data/COPYING +0 -340
- data/INSTALL +0 -18
- data/TODO +0 -6
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'hoe'
|
3
|
+
$:.unshift(File.dirname(__FILE__) + "/lib")
|
4
|
+
require 'hmac'
|
5
|
+
|
6
|
+
Hoe.spec 'ruby-hmac' do
|
7
|
+
developer "Daiki Ueno", ""
|
8
|
+
developer "Geoffrey Grosenbach", "boss@topfunky.com"
|
9
|
+
end
|
10
|
+
|
11
|
+
Hoe.plugin :minitest
|
12
|
+
Hoe.plugin :git
|
13
|
+
Hoe.plugin :gemcutter
|
14
|
+
|
15
|
+
desc "Simple require on packaged files to make sure they are all there"
|
16
|
+
task :verify => :package do
|
17
|
+
# An error message will be displayed if files are missing
|
18
|
+
if system %(ruby -e "require 'pkg/ruby-hmac-#{HMAC::VERSION}/lib/hmac'")
|
19
|
+
puts "\nThe library files are present"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
task :release => :verify
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'hmac'
|
2
|
+
require 'digest/sha2'
|
3
|
+
|
4
|
+
module HMAC
|
5
|
+
class SHA256 < Base
|
6
|
+
def initialize(key = nil)
|
7
|
+
super(Digest::SHA256, 64, 32, key)
|
8
|
+
end
|
9
|
+
public_class_method :new, :digest, :hexdigest
|
10
|
+
end
|
11
|
+
|
12
|
+
class SHA384 < Base
|
13
|
+
def initialize(key = nil)
|
14
|
+
super(Digest::SHA384, 128, 48, key)
|
15
|
+
end
|
16
|
+
public_class_method :new, :digest, :hexdigest
|
17
|
+
end
|
18
|
+
|
19
|
+
class SHA512 < Base
|
20
|
+
def initialize(key = nil)
|
21
|
+
super(Digest::SHA512, 128, 64, key)
|
22
|
+
end
|
23
|
+
public_class_method :new, :digest, :hexdigest
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Copyright (C) 2001 Daiki Ueno <ueno@unixuser.org>
|
2
|
+
# This library is distributed under the terms of the Ruby license.
|
3
|
+
|
4
|
+
# This module provides common interface to HMAC engines.
|
5
|
+
# HMAC standard is documented in RFC 2104:
|
6
|
+
#
|
7
|
+
# H. Krawczyk et al., "HMAC: Keyed-Hashing for Message Authentication",
|
8
|
+
# RFC 2104, February 1997
|
9
|
+
#
|
10
|
+
# These APIs are inspired by JCE 1.2's javax.crypto.Mac interface.
|
11
|
+
#
|
12
|
+
# <URL:http://java.sun.com/security/JCE1.2/spec/apidoc/javax/crypto/Mac.html>
|
13
|
+
#
|
14
|
+
# Source repository is at
|
15
|
+
#
|
16
|
+
# http://github.com/topfunky/ruby-hmac/tree/master
|
17
|
+
|
18
|
+
module HMAC
|
19
|
+
|
20
|
+
VERSION = '0.4.0'
|
21
|
+
|
22
|
+
class Base
|
23
|
+
def initialize(algorithm, block_size, output_length, key)
|
24
|
+
@algorithm = algorithm
|
25
|
+
@block_size = block_size
|
26
|
+
@output_length = output_length
|
27
|
+
@initialized = false
|
28
|
+
@key_xor_ipad = ''
|
29
|
+
@key_xor_opad = ''
|
30
|
+
set_key(key) unless key.nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
def check_status
|
35
|
+
unless @initialized
|
36
|
+
raise RuntimeError,
|
37
|
+
"The underlying hash algorithm has not yet been initialized."
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
public
|
42
|
+
def set_key(key)
|
43
|
+
# If key is longer than the block size, apply hash function
|
44
|
+
# to key and use the result as a real key.
|
45
|
+
key = @algorithm.digest(key) if key.size > @block_size
|
46
|
+
akey = key.unpack("C*")
|
47
|
+
key_xor_ipad = ("\x36" * @block_size).unpack("C*")
|
48
|
+
key_xor_opad = ("\x5C" * @block_size).unpack("C*")
|
49
|
+
for i in 0 .. akey.size - 1
|
50
|
+
key_xor_ipad[i] ^= akey[i]
|
51
|
+
key_xor_opad[i] ^= akey[i]
|
52
|
+
end
|
53
|
+
@key_xor_ipad = key_xor_ipad.pack("C*")
|
54
|
+
@key_xor_opad = key_xor_opad.pack("C*")
|
55
|
+
@md = @algorithm.new
|
56
|
+
@initialized = true
|
57
|
+
end
|
58
|
+
|
59
|
+
def reset_key
|
60
|
+
@key_xor_ipad.gsub!(/./, '?')
|
61
|
+
@key_xor_opad.gsub!(/./, '?')
|
62
|
+
@key_xor_ipad[0..-1] = ''
|
63
|
+
@key_xor_opad[0..-1] = ''
|
64
|
+
@initialized = false
|
65
|
+
end
|
66
|
+
|
67
|
+
def update(text)
|
68
|
+
check_status
|
69
|
+
# perform inner H
|
70
|
+
md = @algorithm.new
|
71
|
+
md.update(@key_xor_ipad)
|
72
|
+
md.update(text)
|
73
|
+
str = md.digest
|
74
|
+
# perform outer H
|
75
|
+
md = @algorithm.new
|
76
|
+
md.update(@key_xor_opad)
|
77
|
+
md.update(str)
|
78
|
+
@md = md
|
79
|
+
end
|
80
|
+
alias << update
|
81
|
+
|
82
|
+
def digest
|
83
|
+
check_status
|
84
|
+
@md.digest
|
85
|
+
end
|
86
|
+
|
87
|
+
def hexdigest
|
88
|
+
check_status
|
89
|
+
@md.hexdigest
|
90
|
+
end
|
91
|
+
alias to_s hexdigest
|
92
|
+
|
93
|
+
# These two class methods below are safer than using above
|
94
|
+
# instance methods combinatorially because an instance will have
|
95
|
+
# held a key even if it's no longer in use.
|
96
|
+
def Base.digest(key, text)
|
97
|
+
hmac = self.new(key)
|
98
|
+
begin
|
99
|
+
hmac.update(text)
|
100
|
+
hmac.digest
|
101
|
+
ensure
|
102
|
+
hmac.reset_key
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def Base.hexdigest(key, text)
|
107
|
+
hmac = self.new(key)
|
108
|
+
begin
|
109
|
+
hmac.update(text)
|
110
|
+
hmac.hexdigest
|
111
|
+
ensure
|
112
|
+
hmac.reset_key
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
private_class_method :new, :digest, :hexdigest
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{ruby-hmac}
|
3
|
+
s.version = "0.3.2"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Daiki Ueno", "Geoffrey Grosenbach"]
|
7
|
+
s.date = %q{2008-08-21}
|
8
|
+
s.description = %q{A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret key.}
|
9
|
+
s.email = %q{boss@topfunky.com}
|
10
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
11
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "lib/hmac-md5.rb", "lib/hmac-rmd160.rb", "lib/hmac-sha1.rb", "lib/hmac-sha2.rb", "lib/hmac.rb", "test/test_hmac.rb"]
|
12
|
+
s.has_rdoc = true
|
13
|
+
s.homepage = %q{http://ruby-hmac.rubyforge.org}
|
14
|
+
s.rdoc_options = ["--main", "README.txt"]
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
s.rubyforge_project = %q{ruby-hmac}
|
17
|
+
s.rubygems_version = %q{1.2.0}
|
18
|
+
s.summary = %q{An implementation of the HMAC authentication code in Ruby.}
|
19
|
+
s.test_files = ["test/test_hmac.rb"]
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 2
|
24
|
+
|
25
|
+
if current_version >= 3 then
|
26
|
+
s.add_development_dependency(%q<hoe>, [">= 1.7.0"])
|
27
|
+
else
|
28
|
+
s.add_dependency(%q<hoe>, [">= 1.7.0"])
|
29
|
+
end
|
30
|
+
else
|
31
|
+
s.add_dependency(%q<hoe>, [">= 1.7.0"])
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$: << File.dirname(__FILE__) + "/../lib"
|
4
|
+
require "hmac-md5"
|
5
|
+
require "hmac-sha1"
|
6
|
+
begin
|
7
|
+
require "minitest/unit"
|
8
|
+
rescue LoadError
|
9
|
+
require "rubygems"
|
10
|
+
require "minitest/unit"
|
11
|
+
end
|
12
|
+
|
13
|
+
MiniTest::Unit.autorun
|
14
|
+
|
15
|
+
class TestHmac < MiniTest::Unit::TestCase
|
16
|
+
|
17
|
+
def test_s_digest
|
18
|
+
key = "\x0b" * 16
|
19
|
+
text = "Hi There"
|
20
|
+
|
21
|
+
hmac = HMAC::MD5.new(key)
|
22
|
+
hmac.update(text)
|
23
|
+
|
24
|
+
assert_equal(hmac.digest, HMAC::MD5.digest(key, text))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_s_hexdigest
|
28
|
+
key = "\x0b" * 16
|
29
|
+
text = "Hi There"
|
30
|
+
|
31
|
+
hmac = HMAC::MD5.new(key)
|
32
|
+
hmac.update(text)
|
33
|
+
|
34
|
+
assert_equal(hmac.hexdigest, HMAC::MD5.hexdigest(key, text))
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_hmac_md5_1
|
38
|
+
assert_equal(HMAC::MD5.hexdigest("\x0b" * 16, "Hi There"),
|
39
|
+
"9294727a3638bb1c13f48ef8158bfc9d")
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_hmac_md5_2
|
43
|
+
assert_equal(HMAC::MD5.hexdigest("Jefe", "what do ya want for nothing?"),
|
44
|
+
"750c783e6ab0b503eaa86e310a5db738")
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_hmac_md5_3
|
48
|
+
assert_equal(HMAC::MD5.hexdigest("\xaa" * 16, "\xdd" * 50),
|
49
|
+
"56be34521d144c88dbb8c733f0e8b3f6")
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_hmac_md5_4
|
53
|
+
assert_equal(HMAC::MD5.hexdigest(["0102030405060708090a0b0c0d0e0f10111213141516171819"].pack("H*"), "\xcd" * 50),
|
54
|
+
"697eaf0aca3a3aea3a75164746ffaa79")
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_hmac_md5_5
|
58
|
+
assert_equal(HMAC::MD5.hexdigest("\x0c" * 16, "Test With Truncation"),
|
59
|
+
"56461ef2342edc00f9bab995690efd4c")
|
60
|
+
end
|
61
|
+
|
62
|
+
# def test_hmac_md5_6
|
63
|
+
# assert_equal(HMAC::MD5.hexdigest("\x0c" * 16, "Test With Truncation"),
|
64
|
+
# "56461ef2342edc00f9bab995")
|
65
|
+
# end
|
66
|
+
|
67
|
+
def test_hmac_md5_7
|
68
|
+
assert_equal(HMAC::MD5.hexdigest("\xaa" * 80, "Test Using Larger Than Block-Size Key - Hash Key First"),
|
69
|
+
"6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd")
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_hmac_md5_8
|
73
|
+
assert_equal(HMAC::MD5.hexdigest("\xaa" * 80, "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data"),
|
74
|
+
"6f630fad67cda0ee1fb1f562db3aa53e")
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_reset_key
|
78
|
+
hmac = HMAC::MD5.new("key")
|
79
|
+
hmac.reset_key
|
80
|
+
assert_raises(RuntimeError) { hmac.update("foo") }
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_set_key
|
84
|
+
hmac = HMAC::MD5.new
|
85
|
+
assert_raises(RuntimeError) { hmac.update("foo") }
|
86
|
+
hmac.reset_key
|
87
|
+
assert_raises(RuntimeError) { hmac.update("foo") }
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
signature (0.1.2)
|
5
|
+
ruby-hmac
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.1.2)
|
11
|
+
rspec (2.0.1)
|
12
|
+
rspec-core (~> 2.0.1)
|
13
|
+
rspec-expectations (~> 2.0.1)
|
14
|
+
rspec-mocks (~> 2.0.1)
|
15
|
+
rspec-core (2.0.1)
|
16
|
+
rspec-expectations (2.0.1)
|
17
|
+
diff-lcs (>= 1.1.2)
|
18
|
+
rspec-mocks (2.0.1)
|
19
|
+
rspec-core (~> 2.0.1)
|
20
|
+
rspec-expectations (~> 2.0.1)
|
21
|
+
ruby-hmac (0.4.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
ruby
|
25
|
+
|
26
|
+
DEPENDENCIES
|
27
|
+
rspec (~> 2.0.0)
|
28
|
+
ruby-hmac
|
29
|
+
signature!
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Martyn Loughran
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
signature
|
2
|
+
=========
|
3
|
+
|
4
|
+
Examples
|
5
|
+
--------
|
6
|
+
|
7
|
+
Client example
|
8
|
+
|
9
|
+
params = {:some => 'parameters'}
|
10
|
+
token = Signature::Token.new('my_key', 'my_secret')
|
11
|
+
request = Signature::Request.new('POST', '/api/thing', params)
|
12
|
+
auth_hash = request.sign(token)
|
13
|
+
query_params = params.merge(auth_hash)
|
14
|
+
|
15
|
+
HTTParty.post('http://myservice/api/thing', {
|
16
|
+
:query => query_params
|
17
|
+
})
|
18
|
+
|
19
|
+
`query_params` looks like:
|
20
|
+
|
21
|
+
{
|
22
|
+
:some => "parameters",
|
23
|
+
:auth_timestamp => 1273231888,
|
24
|
+
:auth_signature => "28b6bb0f242f71064916fad6ae463fe91f5adc302222dfc02c348ae1941eaf80",
|
25
|
+
:auth_version => "1.0",
|
26
|
+
:auth_key => "my_key"
|
27
|
+
}
|
28
|
+
|
29
|
+
Server example (sinatra)
|
30
|
+
|
31
|
+
error Signature::AuthenticationError do |controller|
|
32
|
+
error = controller.env["sinatra.error"]
|
33
|
+
halt 401, "401 UNAUTHORIZED: #{error.message}\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
post '/api/thing' do
|
37
|
+
request = Signature::Request.new('POST', env["REQUEST_PATH"], params)
|
38
|
+
# This will raise a Signature::AuthenticationError if request does not authenticate
|
39
|
+
token = request.authenticate do |key|
|
40
|
+
Signature::Token.new(key, lookup_secret(key))
|
41
|
+
end
|
42
|
+
|
43
|
+
# Do whatever you need to do
|
44
|
+
end
|
45
|
+
|
46
|
+
Developing
|
47
|
+
----------
|
48
|
+
|
49
|
+
bundle
|
50
|
+
bundle exec rspec spec/*_spec.rb
|
51
|
+
|
52
|
+
Copyright
|
53
|
+
---------
|
54
|
+
|
55
|
+
Copyright (c) 2010 Martyn Loughran. See LICENSE for details.
|