right_agent 2.7.0 → 2.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74c2e07823dff52a0a487855918d9fe020f4509b
4
- data.tar.gz: b9fc140fd85dc787e63a04880e3b195024ca0f42
3
+ metadata.gz: 100645d31290fa736c6f19228c9b4734d0669d21
4
+ data.tar.gz: b1dde62a9adf3fa76e78e1e5e236c5e12b7634d7
5
5
  SHA512:
6
- metadata.gz: a17751f1a016b2e81cdebb0281449c90db0be2cf4e8c17062d54ce36ee29d1517c4d2c1686debf81f75c34f4ae054d109ff9b3f45453b9db27070affb3df7f9b
7
- data.tar.gz: f5720ae5a981c8b54a6d3d811fc8f35e8c0ea8c02d573c29fc78e9011c28fbf33aa7d9d089c0337f2a653f250f120cc94fa0403337a23b98681f6728f3037a70
6
+ metadata.gz: 138aa3b2f6242e7ae7b0b01118d41e204a40035924b382f86da63185141571290437562789420933469e4cd0c999e76cd7986213de677517edc9587ef4d089d0
7
+ data.tar.gz: d1565bec72373642246386dd4911aaabafe6d41a57bda81d352816622e98e4954c5329e1096bd4985710db420a762bd290620b6abd1cd474672064d843b4fa48
@@ -1,3 +1,5 @@
1
+ require 'digest/sha2'
2
+
1
3
  #
2
4
  # Copyright (c) 2009-2011 RightScale Inc
3
5
  #
@@ -44,6 +46,30 @@ module RightScale
44
46
  [ @audit_id, @created_at.to_i, @exclusive, @users ]
45
47
  end
46
48
 
49
+ # Compute a cryptographic hash of the information in this policy; helps
50
+ # callers compare two policies to see if they are equivalent.
51
+ # @see https://github.com/rightscale/cmaro/domain/login_policy.go
52
+ def fingerprint
53
+ h = Digest::SHA2.new
54
+ h << (self.exclusive ? 'true' : 'false')
55
+
56
+ users = self.users.sort { |a, b| a.uuid <=> b.uuid }
57
+ users.each do |u|
58
+ h << format(",(%d,%s,%s,%d,%s",
59
+ u.uuid, u.common_name,
60
+ (u.superuser ? 'true' : 'false'),
61
+ (u.expires_at ? u.expires_at.to_i : 0),
62
+ u.username)
63
+
64
+ u.public_key_fingerprints.each do |fp|
65
+ h << "," << fp
66
+ end
67
+ h << ')'
68
+ end
69
+
70
+ h.hexdigest
71
+ end
72
+
47
73
  # Utility method to parse an SSH2-format public key and return a 4-tuple consisting
48
74
  # of its constituent parts:
49
75
  # * leading comment (optional)
@@ -99,7 +99,7 @@ module RightScale
99
99
  # @param [Exception, String] exception raised
100
100
  # @param [Packet, Hash] packet associated with exception
101
101
  # @param [Object] agent object reporting error
102
- # @param [String] component or service area where error occurred
102
+ # @param [String,Object] component or service area where error occurred
103
103
  #
104
104
  # @return [TrueClass] always true
105
105
  def notify(exception, packet = nil, agent = nil, component = nil)
@@ -117,6 +117,8 @@ module RightScale
117
117
  params = uuid = nil
118
118
  end
119
119
 
120
+ component = component.class.name unless component.is_a?(String)
121
+
120
122
  n = Airbrake.build_notice(
121
123
  exception,
122
124
  { component: component, action: action },
@@ -25,8 +25,8 @@ require 'rbconfig'
25
25
 
26
26
  Gem::Specification.new do |spec|
27
27
  spec.name = 'right_agent'
28
- spec.version = '2.7.0'
29
- spec.date = '2016-05-20'
28
+ spec.version = '2.7.2'
29
+ spec.date = '2016-07-25'
30
30
  spec.authors = ['Lee Kirchhoff', 'Raphael Simon', 'Tony Spataro', 'Scott Messier']
31
31
  spec.email = 'lee@rightscale.com'
32
32
  spec.homepage = 'https://github.com/rightscale/right_agent'
@@ -0,0 +1,51 @@
1
+ #
2
+ # Copyright (c) 2009-2011 RightScale Inc
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
24
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'right_agent', 'core_payload_types'))
25
+
26
+ describe RightScale::LoginPolicy do
27
+ describe '#fingerprint' do
28
+ let(:finger0) { 'abd8e6410457ad1681123bc5997de6efc8dd3c2f' }
29
+
30
+ let(:finger1) { '21fdda62b604e30ef36f8af3b42eb74832492808' }
31
+
32
+ let(:golang) { '0f4bba48af7f56e72cb00bfe5551f3f8a796f946fb10ad925459b7d4e6ff45f8' }
33
+
34
+ let(:u0) do
35
+ RightScale::LoginUser.new(1, 'alice', 'ssh-rsa aaa', 'alice@initech.com', false, nil, nil, nil, [finger0])
36
+ end
37
+
38
+ let(:u1) do
39
+ ea = Time.at(2147483647)
40
+ RightScale::LoginUser.new(2, 'bob', 'ssh-rsa bbb', 'bob@initech.com', false, ea, nil, nil, [finger1])
41
+ end
42
+
43
+ let(:policy) do
44
+ RightScale::LoginPolicy.new(0, nil, false, [u0, u1])
45
+ end
46
+
47
+ it 'should interoperate with golang' do
48
+ policy.fingerprint.should == golang
49
+ end
50
+ end
51
+ end
@@ -46,6 +46,26 @@ module LoginUserSpec
46
46
  end
47
47
 
48
48
  describe RightScale::LoginUser do
49
+ context '.fingerprint' do
50
+ # Shared with CMARO specs. See https://github.com/rightscale/cmaro/domain/login_policy_test.go
51
+ let(:keys) {
52
+ [
53
+ 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDW5pCQxyHOX/GoBtCypA312KPW4xGG9KgYueU11AH+s3NnhNWRxV0NFxyBpS9ti5trgRQtz96nslbhv3xwOMhxi6phHr3RM1gFsP2KCzmWrVtwnivL/EEP4exT8ksnS6tM0o4YcK35R+pqCcef6zvu0+36PeUCMxPMXui37Q2DH8VW2oAtv4yXgaZKIPf+6T86Nl1lfXYwSa49RVWIugcCZ1hlOWxTA7Qp1zmP1VQsl10o7NlK5ftOhgZkvu8KBPmL8qqD9YzoQgHpAx77cquV1if3ZcZIDCCbzo5mD60uEiBzNssE38aMilc9XtRR4b0Wb+/ousfzbOe8lB0hGRfZ alice@initech.com',
54
+ 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMJRT7/ESoJwmMY5pD5cXcHU24pXnBYv9hSaYcowshuSTRtCYr+7RRcxtGy7vSI6IFiA1+8fp0RXMN0XwGC1wx2ndOWFW4pHNy7wNr8CDJDnl4wyL90XK6MJQBqpmHL+NMA9YyVixzPYrW/foaRUyP/uTr5fVnTySvfQHSmqwDD5NcwJqt4Gz4w47hNKwlCwXq1DG5+KyR5n2SdpcdIkZLB9H8luvTLucv4ozoibi7JNYkJ+mR1oumcXrvUDDO24cvIBYyoVLGIFXcP5jvshijcEzmRz8/lzeJ0fzJXIN+rs7fuunJkuC/85fHwroeae5RB82HLOHWapGX6taevrBp bob@initech.com'
55
+ ]
56
+ }
57
+ let(:fingerprints) do
58
+ [
59
+ 'abd8e6410457ad1681123bc5997de6efc8dd3c2f',
60
+ '21fdda62b604e30ef36f8af3b42eb74832492808'
61
+ ]
62
+ end
63
+
64
+ it 'interoperates with golang' do
65
+ described_class.fingerprint(keys[0]).should == fingerprints[0]
66
+ described_class.fingerprint(keys[1]).should == fingerprints[1]
67
+ end
68
+ end
49
69
 
50
70
  # ensures that the serialization downgrade case works.
51
71
  def test_serialization_downgrade(user, public_key)
@@ -35,7 +35,7 @@ describe RightScale::ErrorTracker do
35
35
  @agent_name = "test_agent"
36
36
  @shard_id = 9
37
37
  @endpoint = "https://airbrake.com"
38
- @api_key = "secret"
38
+ @api_key = '1'
39
39
  @trace_level = RightScale::Agent::TRACE_LEVEL
40
40
  @tracker = RightScale::ErrorTracker.instance
41
41
  @log = flexmock(RightScale::Log)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Kirchhoff
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-05-20 00:00:00.000000000 Z
14
+ date: 2016-07-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: right_support
@@ -330,6 +330,7 @@ files:
330
330
  - spec/core_payload_types/dev_repositories_spec.rb
331
331
  - spec/core_payload_types/dev_repository_spec.rb
332
332
  - spec/core_payload_types/executable_bundle_spec.rb
333
+ - spec/core_payload_types/login_policy_spec.rb
333
334
  - spec/core_payload_types/login_user_spec.rb
334
335
  - spec/core_payload_types/recipe_instantiation_spec.rb
335
336
  - spec/core_payload_types/right_script_attachment_spec.rb