right_agent 0.14.0 → 0.16.2
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.
- data/README.rdoc +2 -0
- data/lib/right_agent/actors/agent_manager.rb +1 -1
- data/lib/right_agent/agent.rb +28 -14
- data/lib/right_agent/agent_config.rb +1 -1
- data/lib/right_agent/agent_identity.rb +4 -5
- data/lib/right_agent/agent_tag_manager.rb +21 -24
- data/lib/right_agent/core_payload_types/executable_bundle.rb +1 -1
- data/lib/right_agent/core_payload_types/recipe_instantiation.rb +7 -0
- data/lib/right_agent/core_payload_types/right_script_instantiation.rb +20 -5
- data/lib/right_agent/exceptions.rb +44 -1
- data/lib/right_agent/history.rb +4 -1
- data/lib/right_agent/packets.rb +2 -1
- data/lib/right_agent/platform/darwin.rb +6 -0
- data/lib/right_agent/platform/linux.rb +5 -1
- data/lib/right_agent/platform/windows.rb +8 -4
- data/lib/right_agent/scripts/stats_manager.rb +3 -3
- data/lib/right_agent/security/cached_certificate_store_proxy.rb +27 -13
- data/lib/right_agent/security/encrypted_document.rb +1 -2
- data/lib/right_agent/security/static_certificate_store.rb +30 -14
- data/lib/right_agent/sender.rb +101 -47
- data/lib/right_agent/serialize/secure_serializer.rb +29 -27
- data/lib/right_agent/serialize/secure_serializer_initializer.rb +3 -3
- data/lib/right_agent/serialize/serializable.rb +1 -1
- data/lib/right_agent/serialize/serializer.rb +15 -6
- data/right_agent.gemspec +4 -5
- data/spec/agent_spec.rb +2 -2
- data/spec/agent_tag_manager_spec.rb +330 -0
- data/spec/core_payload_types/recipe_instantiation_spec.rb +81 -0
- data/spec/core_payload_types/right_script_instantiation_spec.rb +79 -0
- data/spec/security/cached_certificate_store_proxy_spec.rb +14 -8
- data/spec/security/static_certificate_store_spec.rb +13 -7
- data/spec/sender_spec.rb +114 -17
- data/spec/serialize/secure_serializer_spec.rb +78 -49
- data/spec/serialize/serializer_spec.rb +21 -2
- metadata +90 -36
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2009-
|
2
|
+
# Copyright (c) 2009-2013 RightScale Inc
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -38,65 +38,94 @@ describe RightScale::SecureSerializer do
|
|
38
38
|
include RightScale::SpecHelper
|
39
39
|
|
40
40
|
before(:all) do
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
41
|
+
@dump_cert, @dump_key = issue_cert
|
42
|
+
@load_cert, @load_key = issue_cert
|
43
|
+
@dump_store = RightScale::StaticCertificateStore.new(@dump_cert, @dump_key, @load_cert, @load_cert)
|
44
|
+
@load_store = RightScale::StaticCertificateStore.new(@load_cert, @load_key, @dump_cert, @dump_cert)
|
45
|
+
@dump_id = RightScale::AgentIdentity.new("rs", "dump_agent", 1).to_s
|
46
|
+
@load_id = RightScale::AgentIdentity.new("rs", "load_agent", 1).to_s
|
44
47
|
end
|
45
48
|
|
46
|
-
it
|
47
|
-
data = RightScale::Result.new("token", "to", "
|
48
|
-
lambda { RightScale::SecureSerializer.dump(data) }.should raise_error
|
49
|
+
it "must be initialized before use" do
|
50
|
+
data = RightScale::Result.new("token", "to", ["results"], "from")
|
51
|
+
lambda { RightScale::SecureSerializer.dump(data) }.should raise_error(Exception, "Secure serializer not initialized")
|
49
52
|
end
|
50
53
|
|
51
|
-
it
|
52
|
-
|
53
|
-
|
54
|
-
lambda { RightScale::SecureSerializer.load(Marshal.dump(data)) }.should raise_error(RightScale::Serializer::SerializationError)
|
55
|
-
lambda { RightScale::SecureSerializer.load(YAML.dump(data)) }.should raise_error(RightScale::Serializer::SerializationError)
|
54
|
+
it "must specify agent identity" do
|
55
|
+
lambda { RightScale::SecureSerializer.init(RightScale::Serializer.new, nil, @load_store, false) }.
|
56
|
+
should raise_error(Exception, "Missing local agent identity")
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
flexmock(JSON).should_receive(:dump).never
|
62
|
-
flexmock(JSON).should_receive(:load).never
|
63
|
-
@data = RightScale::Result.new("token", "to", "from", ["results"], nil, nil, nil, nil, [12, 12])
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'should unserialize signed data' do
|
67
|
-
RightScale::SecureSerializer.init(RightScale::Serializer.new, @identity, @certificate, @key, @store, false)
|
68
|
-
data = RightScale::SecureSerializer.dump(@data)
|
69
|
-
RightScale::SecureSerializer.load(data).should == @data
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'should unserialize encrypted data' do
|
73
|
-
RightScale::SecureSerializer.init(RightScale::Serializer.new, @identity, @certificate, @key, @store, true)
|
74
|
-
data = RightScale::SecureSerializer.dump(@data)
|
75
|
-
RightScale::SecureSerializer.load(data).should == @data
|
76
|
-
end
|
77
|
-
|
59
|
+
it "must specify a credentials store" do
|
60
|
+
lambda { RightScale::SecureSerializer.init(RightScale::Serializer.new, @load_id, nil, false) }.
|
61
|
+
should raise_error(Exception, "Missing credentials store")
|
78
62
|
end
|
79
63
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
@data = RightScale::Result.new("token", "to", "from", ["results"], nil, nil, nil, nil, [11, 11])
|
86
|
-
end
|
64
|
+
it "certificate store must contain certificate and key for agent" do
|
65
|
+
flexmock(@load_store).should_receive(:get_receiver).and_return([nil, nil]).once
|
66
|
+
lambda { RightScale::SecureSerializer.init(RightScale::Serializer.new, @load_id, @load_store, false) }.
|
67
|
+
should raise_error(Exception, "Missing local agent public certificate")
|
68
|
+
end
|
87
69
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
70
|
+
it "data must be serialized with MessagePack or JSON" do
|
71
|
+
data = RightScale::Result.new("token", "to", ["results"], "from")
|
72
|
+
RightScale::SecureSerializer.init(RightScale::Serializer.new, @load_id, @load_store, false)
|
73
|
+
lambda { RightScale::SecureSerializer.load(Marshal.dump(data)) }.should raise_error(RightScale::Serializer::SerializationError)
|
74
|
+
lambda { RightScale::SecureSerializer.load(YAML.dump(data)) }.should raise_error(RightScale::Serializer::SerializationError)
|
75
|
+
end
|
93
76
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
77
|
+
# Test with protocol version 11 and 12 since that is the boundary where msgpack was first supported
|
78
|
+
[[:msgpack, 12, JSON], [:json, 11, MessagePack]].each do |type, version, other_class|
|
79
|
+
|
80
|
+
context "using #{type.inspect}" do
|
81
|
+
|
82
|
+
before(:each) do
|
83
|
+
flexmock(other_class).should_receive(:dump).never
|
84
|
+
flexmock(other_class).should_receive(:load).never
|
85
|
+
@data = RightScale::Result.new("token", "to", ["results"], "from", nil, nil, nil, nil, [version, version])
|
86
|
+
@serializer = RightScale::Serializer.new(type)
|
87
|
+
end
|
88
|
+
|
89
|
+
it "unserializes signed data" do
|
90
|
+
RightScale::SecureSerializer.init(@serializer, @dump_id, @dump_store, false)
|
91
|
+
data = RightScale::SecureSerializer.dump(@data)
|
92
|
+
RightScale::SecureSerializer.init(@serializer, @load_id, @load_store, false)
|
93
|
+
RightScale::SecureSerializer.load(data).should == @data
|
94
|
+
end
|
95
|
+
|
96
|
+
it "unserializes encrypted data" do
|
97
|
+
RightScale::SecureSerializer.init(@serializer, @dump_id, @dump_store, true)
|
98
|
+
data = RightScale::SecureSerializer.dump(@data)
|
99
|
+
@serializer.load(data)["encrypted"].should be_true
|
100
|
+
RightScale::SecureSerializer.init(@serializer, @load_id, @load_store, false)
|
101
|
+
RightScale::SecureSerializer.load(data).should == @data
|
102
|
+
end
|
103
|
+
|
104
|
+
it "encrypt option on initialization overrides dump option" do
|
105
|
+
RightScale::SecureSerializer.init(@serializer, @dump_id, @dump_store, true)
|
106
|
+
data = RightScale::SecureSerializer.dump(@data, false)
|
107
|
+
@serializer.load(data)["encrypted"].should be_true
|
108
|
+
end
|
109
|
+
|
110
|
+
it "uses id when supplied to choose credentials" do
|
111
|
+
RightScale::SecureSerializer.init(@serializer, @dump_id, @dump_store, true)
|
112
|
+
data = RightScale::SecureSerializer.dump(@data)
|
113
|
+
RightScale::SecureSerializer.init(@serializer, @load_id, @load_store, false)
|
114
|
+
flexmock(@load_store).should_receive(:get_receiver).with("id").and_return([@load_cert, @load_key]).once
|
115
|
+
RightScale::SecureSerializer.load(data, "id").should == @data
|
116
|
+
end
|
117
|
+
|
118
|
+
it "must be able to retrieve certificate and key to decrypt message" do
|
119
|
+
RightScale::SecureSerializer.init(@serializer, @dump_id, @dump_store, true)
|
120
|
+
data = RightScale::SecureSerializer.dump(@data)
|
121
|
+
RightScale::SecureSerializer.init(@serializer, @dump_id, @load_store, false)
|
122
|
+
flexmock(@load_store).should_receive(:get_receiver).with("id").and_return([nil, @load_key], [@load_cert, nil]).twice
|
123
|
+
lambda { RightScale::SecureSerializer.load(data, "id") }.
|
124
|
+
should raise_error(RightScale::SecureSerializer::MissingCertificate, /Could not find a certificate/)
|
125
|
+
lambda { RightScale::SecureSerializer.load(data, "id") }.
|
126
|
+
should raise_error(RightScale::SecureSerializer::MissingPrivateKey, /Could not find a private key/)
|
127
|
+
end
|
98
128
|
end
|
99
|
-
|
100
129
|
end
|
101
130
|
|
102
131
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2009-
|
2
|
+
# Copyright (c) 2009-2013 RightScale Inc
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -133,7 +133,7 @@ describe RightScale::Serializer do
|
|
133
133
|
|
134
134
|
it "should cascade through available serializers" do
|
135
135
|
serializer = RightScale::Serializer.new
|
136
|
-
flexmock(serializer).should_receive(:cascade_serializers).with(:load, "olleh", [JSON, MessagePack]).once
|
136
|
+
flexmock(serializer).should_receive(:cascade_serializers).with(:load, "olleh", [JSON, MessagePack], nil).once
|
137
137
|
serializer.load("olleh")
|
138
138
|
end
|
139
139
|
|
@@ -159,6 +159,25 @@ describe RightScale::Serializer do
|
|
159
159
|
RightScale::Serializer.new(:json).load(serialized)
|
160
160
|
end
|
161
161
|
|
162
|
+
it "should pass optional id to SecureSerializer" do
|
163
|
+
object = [1, 2, 3]
|
164
|
+
serialized = "securely serialized"
|
165
|
+
flexmock(RightScale::SecureSerializer).should_receive(:load).with(serialized, "id").and_return(object).once
|
166
|
+
RightScale::Serializer.new(:secure).load(serialized, "id")
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should not pass optional id to MessagePack serializer" do
|
170
|
+
object = [1, 2, 3]
|
171
|
+
serialized = object.to_msgpack
|
172
|
+
RightScale::Serializer.new(:msgpack).load(serialized, "id").should == object
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should not pass optional id to JSON serializer" do
|
176
|
+
object = [1, 2, 3]
|
177
|
+
serialized = object.to_json
|
178
|
+
RightScale::Serializer.new(:json).load(serialized, "id").should == object
|
179
|
+
end
|
180
|
+
|
162
181
|
it "should raise SerializationError if packet could not be unserialized" do
|
163
182
|
flexmock(MessagePack).should_receive(:load).with("olleh").and_raise(StandardError).once
|
164
183
|
flexmock(JSON).should_receive(:load).with("olleh").and_raise(StandardError).once
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 91
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 16
|
9
|
+
- 2
|
10
|
+
version: 0.16.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Lee Kirchhoff
|
@@ -12,91 +17,131 @@ autorequire:
|
|
12
17
|
bindir: bin
|
13
18
|
cert_chain: []
|
14
19
|
|
15
|
-
date:
|
20
|
+
date: 2013-07-17 00:00:00 -07:00
|
21
|
+
default_executable:
|
16
22
|
dependencies:
|
17
23
|
- !ruby/object:Gem::Dependency
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
20
25
|
none: false
|
21
26
|
requirements:
|
22
27
|
- - ">="
|
23
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 29
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 4
|
33
|
+
- 1
|
24
34
|
version: 2.4.1
|
25
35
|
- - <
|
26
36
|
- !ruby/object:Gem::Version
|
37
|
+
hash: 7
|
38
|
+
segments:
|
39
|
+
- 3
|
40
|
+
- 0
|
27
41
|
version: "3.0"
|
42
|
+
requirement: *id001
|
28
43
|
type: :runtime
|
44
|
+
name: right_support
|
29
45
|
prerelease: false
|
30
|
-
version_requirements: *id001
|
31
46
|
- !ruby/object:Gem::Dependency
|
32
|
-
|
33
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
47
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
34
48
|
none: false
|
35
49
|
requirements:
|
36
50
|
- - ~>
|
37
51
|
- !ruby/object:Gem::Version
|
52
|
+
hash: 3
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
- 4
|
38
56
|
version: "0.4"
|
57
|
+
requirement: *id002
|
39
58
|
type: :runtime
|
59
|
+
name: right_amqp
|
40
60
|
prerelease: false
|
41
|
-
version_requirements: *id002
|
42
61
|
- !ruby/object:Gem::Dependency
|
43
|
-
|
44
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
62
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
45
63
|
none: false
|
46
64
|
requirements:
|
47
|
-
- -
|
65
|
+
- - ">="
|
48
66
|
- !ruby/object:Gem::Version
|
67
|
+
hash: 7
|
68
|
+
segments:
|
69
|
+
- 1
|
70
|
+
- 4
|
49
71
|
version: "1.4"
|
72
|
+
- - <=
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 7
|
75
|
+
segments:
|
76
|
+
- 1
|
77
|
+
- 7
|
78
|
+
- 6
|
79
|
+
version: 1.7.6
|
80
|
+
requirement: *id003
|
50
81
|
type: :runtime
|
82
|
+
name: json
|
51
83
|
prerelease: false
|
52
|
-
version_requirements: *id003
|
53
84
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
55
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
85
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
56
86
|
none: false
|
57
87
|
requirements:
|
58
88
|
- - ">="
|
59
89
|
- !ruby/object:Gem::Version
|
90
|
+
hash: 59
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
- 12
|
94
|
+
- 10
|
60
95
|
version: 0.12.10
|
61
96
|
- - <
|
62
97
|
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 2
|
101
|
+
- 0
|
63
102
|
version: "2.0"
|
103
|
+
requirement: *id004
|
64
104
|
type: :runtime
|
105
|
+
name: eventmachine
|
65
106
|
prerelease: false
|
66
|
-
version_requirements: *id004
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: right_popen
|
69
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
|
-
requirements:
|
72
|
-
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 1.0.11
|
75
|
-
type: :runtime
|
76
|
-
prerelease: false
|
77
|
-
version_requirements: *id005
|
78
107
|
- !ruby/object:Gem::Dependency
|
79
|
-
|
80
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
108
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
81
109
|
none: false
|
82
110
|
requirements:
|
83
|
-
- - "
|
111
|
+
- - ">="
|
84
112
|
- !ruby/object:Gem::Version
|
113
|
+
hash: 7
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
- 4
|
117
|
+
- 4
|
85
118
|
version: 0.4.4
|
119
|
+
- - <
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 7
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
- 6
|
125
|
+
version: "0.6"
|
126
|
+
requirement: *id005
|
86
127
|
type: :runtime
|
128
|
+
name: msgpack
|
87
129
|
prerelease: false
|
88
|
-
version_requirements: *id006
|
89
130
|
- !ruby/object:Gem::Dependency
|
90
|
-
|
91
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
131
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
92
132
|
none: false
|
93
133
|
requirements:
|
94
134
|
- - ~>
|
95
135
|
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
137
|
+
segments:
|
138
|
+
- 2
|
139
|
+
- 0
|
96
140
|
version: "2.0"
|
141
|
+
requirement: *id006
|
97
142
|
type: :runtime
|
143
|
+
name: net-ssh
|
98
144
|
prerelease: false
|
99
|
-
version_requirements: *id007
|
100
145
|
description: |
|
101
146
|
RightAgent provides a foundation for running an agent on a server to interface
|
102
147
|
in a secure fashion with other agents in the RightScale system. A RightAgent
|
@@ -217,6 +262,7 @@ files:
|
|
217
262
|
- spec/agent_config_spec.rb
|
218
263
|
- spec/agent_identity_spec.rb
|
219
264
|
- spec/agent_spec.rb
|
265
|
+
- spec/agent_tag_manager_spec.rb
|
220
266
|
- spec/command/agent_manager_commands_spec.rb
|
221
267
|
- spec/command/command_io_spec.rb
|
222
268
|
- spec/command/command_parser_spec.rb
|
@@ -226,7 +272,9 @@ files:
|
|
226
272
|
- spec/core_payload_types/dev_repository_spec.rb
|
227
273
|
- spec/core_payload_types/executable_bundle_spec.rb
|
228
274
|
- spec/core_payload_types/login_user_spec.rb
|
275
|
+
- spec/core_payload_types/recipe_instantiation_spec.rb
|
229
276
|
- spec/core_payload_types/right_script_attachment_spec.rb
|
277
|
+
- spec/core_payload_types/right_script_instantiation_spec.rb
|
230
278
|
- spec/core_payload_types/spec_helper.rb
|
231
279
|
- spec/dispatched_cache_spec.rb
|
232
280
|
- spec/dispatcher_spec.rb
|
@@ -263,6 +311,7 @@ files:
|
|
263
311
|
- spec/spec.win32.opts
|
264
312
|
- spec/spec_helper.rb
|
265
313
|
- spec/tracer_spec.rb
|
314
|
+
has_rdoc: true
|
266
315
|
homepage: https://github.com/rightscale/right_agent
|
267
316
|
licenses: []
|
268
317
|
|
@@ -279,20 +328,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
279
328
|
requirements:
|
280
329
|
- - ">="
|
281
330
|
- !ruby/object:Gem::Version
|
331
|
+
hash: 57
|
332
|
+
segments:
|
333
|
+
- 1
|
334
|
+
- 8
|
335
|
+
- 7
|
282
336
|
version: 1.8.7
|
283
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
284
338
|
none: false
|
285
339
|
requirements:
|
286
340
|
- - ">="
|
287
341
|
- !ruby/object:Gem::Version
|
288
|
-
hash:
|
342
|
+
hash: 3
|
289
343
|
segments:
|
290
344
|
- 0
|
291
345
|
version: "0"
|
292
346
|
requirements: []
|
293
347
|
|
294
348
|
rubyforge_project:
|
295
|
-
rubygems_version: 1.
|
349
|
+
rubygems_version: 1.3.7
|
296
350
|
signing_key:
|
297
351
|
specification_version: 3
|
298
352
|
summary: Agent for interfacing server with RightScale system
|