ridley-connectors 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1d5f17ffd3feb5cafb982a127e2395f533e8413
4
- data.tar.gz: 489a86773e6532a1e39896062c4057625cd64d0e
3
+ metadata.gz: 87c1f79723fb9e7686c92cf93e1ca18f44f1a84e
4
+ data.tar.gz: 454fa2d37b0d50f0a142bf4d6ff07008780fbb46
5
5
  SHA512:
6
- metadata.gz: 0e0d43263f510aafd2f797e00d6401af61bd6f98dce4461804de9d6c538808b709c45eef96ed2ea963ad61af8255da5cd0a19936b84fd6293a747a5f0792568d
7
- data.tar.gz: b4e15afa128530307f6b21c8dc857a6c26c1807d5ed53aecd3461efd68a126fee293eb6395bcb2be96522a71cd4374d766473f712a158d5624906af228ec8d31
6
+ metadata.gz: 3804e24b87910d76f17600b5bdcec241df61a0fe987e7665da5b53aa2137032201b03d7e379832e571a8468ed604ee139c78b7598f23fe4f75b555cf7ad4993c
7
+ data.tar.gz: 3ed6331456cb3d3ef1f01dce1379ae581250d1c5a1335824c9ac3e829b3058cb278619f97ccfcadf00e2f7adada6df7568face45ac0c8dbfc6898b7fbe59d22c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v.1.1.0
2
+
3
+ * [#2](https://github.com/RiotGames/ridley-connectors/pull/2) Copying an encrypted data bag should not expose the secret
4
+
1
5
  ## v.1.0.1
2
6
 
3
7
  * [#3](https://github.com/RiotGames/ridley-connectors/pull/3) Fix the broken Ridley::Client
@@ -54,7 +54,7 @@ module Ridley
54
54
  rescue Net::SSH::ConnectionTimeout, Timeout::Error
55
55
  response.exit_code = -1
56
56
  response.stderr = "Connection timed out"
57
- rescue Errno::EHOSTUNREACH
57
+ rescue SocketError, Errno::EHOSTUNREACH
58
58
  response.exit_code = -1
59
59
  response.stderr = "Host unreachable"
60
60
  rescue Errno::ECONNREFUSED
@@ -95,6 +95,7 @@ module Ridley
95
95
  context = BootstrapContext::Unix.new(options)
96
96
 
97
97
  log.info "Bootstrapping host: #{host}"
98
+ log.filter_param(context.boot_command)
98
99
  run(host, context.boot_command, options)
99
100
  end
100
101
 
@@ -131,6 +132,7 @@ module Ridley
131
132
  #
132
133
  # @return [HostConnector::Response]
133
134
  def put_secret(host, secret, options = {})
135
+ log.filter_param(secret)
134
136
  cmd = "echo '#{secret}' > /etc/chef/encrypted_data_bag_secret; chmod 0600 /etc/chef/encrypted_data_bag_secret"
135
137
  run(host, cmd, options)
136
138
  end
@@ -51,7 +51,7 @@ module Ridley
51
51
  command_uploaders << command_uploader = CommandUploader.new(connection)
52
52
  command = get_command(command, command_uploader)
53
53
 
54
- log.info "Running WinRM Command: '#{command}' on: '#{host}' as: '#{user}'"
54
+ log.info "Running WinRM command: '#{command}' on: '#{host}' as: '#{user}'"
55
55
 
56
56
  defer {
57
57
  output = connection.send(command_method, command) do |stdout, stderr|
@@ -121,6 +121,7 @@ module Ridley
121
121
  context = BootstrapContext::Windows.new(options)
122
122
 
123
123
  log.info "Bootstrapping host: #{host}"
124
+ log.filter_param(context.boot_command)
124
125
  run(host, context.boot_command, options)
125
126
  end
126
127
 
@@ -153,6 +154,7 @@ module Ridley
153
154
  #
154
155
  # @return [HostConnector::Response]
155
156
  def put_secret(host, secret, options = {})
157
+ log.filter_param(secret)
156
158
  command = "echo #{secret} > C:\\chef\\encrypted_data_bag_secret"
157
159
  run(host, command, options)
158
160
  end
@@ -1,5 +1,5 @@
1
1
  module Ridley
2
2
  module Connectors
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency 'celluloid', '~> 0.15'
21
21
  s.add_dependency 'celluloid-io', '~> 0.15'
22
22
  s.add_dependency 'net-ssh'
23
- s.add_dependency 'ridley', '~> 2.0.0'
23
+ s.add_dependency 'ridley', '~> 2.1.0'
24
24
  s.add_dependency 'winrm', '~> 1.1.0'
25
25
 
26
26
  s.add_development_dependency 'buff-ruby_engine', '~> 0.1'
@@ -17,10 +17,17 @@ describe Ridley::HostConnector::SSH do
17
17
  end
18
18
 
19
19
  describe "#bootstrap" do
20
+ let(:bootstrap_context) { Ridley::BootstrapContext::Unix.new(options) }
21
+
20
22
  it "sends a #run message to self to bootstrap a node" do
21
23
  connector.should_receive(:run).with(host, anything, options)
22
24
  connector.bootstrap(host, options)
23
25
  end
26
+
27
+ it "filters the whole command" do
28
+ expect(Ridley::Logging.logger).to receive(:filter_param).with(bootstrap_context.boot_command)
29
+ connector.bootstrap(host, options)
30
+ end
24
31
  end
25
32
 
26
33
  describe "#chef_client" do
@@ -41,6 +48,11 @@ describe Ridley::HostConnector::SSH do
41
48
  )
42
49
  connector.put_secret(host, secret, options)
43
50
  end
51
+
52
+ it "filters the secret" do
53
+ expect(Ridley::Logging.logger).to receive(:filter_param).with(secret)
54
+ connector.put_secret(host, secret, options)
55
+ end
44
56
  end
45
57
 
46
58
  describe "#ruby_script" do
@@ -4,6 +4,7 @@ describe Ridley::HostConnector::WinRM do
4
4
  subject { connector }
5
5
  let(:connector) { described_class.new }
6
6
  let(:host) { 'fake.riotgames.com' }
7
+ let(:command_uploader_double) { double('command_uploader', :cleanup => nil, :upload => nil, :command => nil) }
7
8
  let(:options) do
8
9
  {
9
10
  server_url: double('server_url'),
@@ -15,7 +16,10 @@ describe Ridley::HostConnector::WinRM do
15
16
  }
16
17
  end
17
18
 
18
- before { described_class::CommandUploader.stub(:new).and_return(double('command_uploader')) }
19
+ before do
20
+ described_class::CommandUploader.stub(:new).and_return(command_uploader_double)
21
+ ::WinRM::WinRMWebService.stub(:new).and_return(double(:set_timeout => nil, :run_cmd => {exitcode: 0}))
22
+ end
19
23
 
20
24
  describe "#get_command" do
21
25
  subject(:get_command) { connector.get_command(command, command_uploader_stub) }
@@ -98,10 +102,17 @@ describe Ridley::HostConnector::WinRM do
98
102
  end
99
103
 
100
104
  describe "#bootstrap" do
105
+ let(:bootstrap_context) { Ridley::BootstrapContext::Windows.new(options) }
106
+
101
107
  it "sends a #run message to self to bootstrap a node" do
102
108
  connector.should_receive(:run).with(host, anything, options)
103
109
  connector.bootstrap(host, options)
104
110
  end
111
+
112
+ it "filters the whole command" do
113
+ expect(Ridley::Logging.logger).to receive(:filter_param).with(bootstrap_context.boot_command)
114
+ connector.bootstrap(host, options)
115
+ end
105
116
  end
106
117
 
107
118
  describe "#chef_client" do
@@ -119,6 +130,10 @@ describe Ridley::HostConnector::WinRM do
119
130
  let(:encrypted_data_bag_secret_path) { fixtures_path.join("encrypted_data_bag_secret").to_s }
120
131
  let(:secret) { File.read(encrypted_data_bag_secret_path).chomp }
121
132
 
133
+ before do
134
+ Ridley::HostConnector::WinRM::CommandUploader.stub(:new).and_return(double(:cleanup => nil))
135
+ end
136
+
122
137
  it "receives a command to copy the secret" do
123
138
  connector.should_receive(:run).with(host,
124
139
  "echo #{secret} > C:\\chef\\encrypted_data_bag_secret",
@@ -127,6 +142,11 @@ describe Ridley::HostConnector::WinRM do
127
142
 
128
143
  put_secret
129
144
  end
145
+
146
+ it "filters the secret" do
147
+ expect(Ridley::Logging.logger).to receive(:filter_param).with(secret)
148
+ put_secret
149
+ end
130
150
  end
131
151
 
132
152
  describe "#ruby_script" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridley-connectors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-21 00:00:00.000000000 Z
12
+ date: 2013-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: 2.0.0
62
+ version: 2.1.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 2.0.0
69
+ version: 2.1.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: winrm
72
72
  requirement: !ruby/object:Gem::Requirement