poise-tls-remote-file 1.0.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 +11 -0
- data/.kitchen.yml +3 -0
- data/.travis.yml +56 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +34 -0
- data/LICENSE +201 -0
- data/README.md +82 -0
- data/Rakefile +17 -0
- data/chef/attributes/default.rb +24 -0
- data/lib/poise_tls_remote_file.rb +21 -0
- data/lib/poise_tls_remote_file/cheftie.rb +17 -0
- data/lib/poise_tls_remote_file/resources.rb +26 -0
- data/lib/poise_tls_remote_file/resources/poise_tls_remote_file.rb +148 -0
- data/lib/poise_tls_remote_file/version.rb +20 -0
- data/poise-tls-remote-file.gemspec +41 -0
- data/test/cookbook/files/ca.crt +33 -0
- data/test/cookbook/files/ca.key +51 -0
- data/test/cookbook/files/client.crt +29 -0
- data/test/cookbook/files/client.csr +27 -0
- data/test/cookbook/files/client.key +51 -0
- data/test/cookbook/files/client.pem +80 -0
- data/test/cookbook/files/server.crt +30 -0
- data/test/cookbook/files/server.csr +27 -0
- data/test/cookbook/files/server.key +51 -0
- data/test/cookbook/metadata.rb +19 -0
- data/test/cookbook/recipes/default.rb +96 -0
- data/test/gemfiles/chef-12.10.gemfile +23 -0
- data/test/gemfiles/chef-12.11.gemfile +23 -0
- data/test/gemfiles/chef-12.12.gemfile +22 -0
- data/test/gemfiles/chef-12.13.gemfile +22 -0
- data/test/gemfiles/chef-12.14.gemfile +19 -0
- data/test/gemfiles/chef-12.15.gemfile +19 -0
- data/test/gemfiles/chef-12.16.gemfile +19 -0
- data/test/gemfiles/chef-12.17.gemfile +19 -0
- data/test/gemfiles/chef-12.18.gemfile +19 -0
- data/test/gemfiles/chef-12.19.gemfile +19 -0
- data/test/gemfiles/chef-12.5.gemfile +23 -0
- data/test/gemfiles/chef-12.6.gemfile +23 -0
- data/test/gemfiles/chef-12.7.gemfile +23 -0
- data/test/gemfiles/chef-12.8.gemfile +23 -0
- data/test/gemfiles/chef-12.9.gemfile +23 -0
- data/test/gemfiles/chef-12.gemfile +19 -0
- data/test/gemfiles/chef-13.0.gemfile +19 -0
- data/test/gemfiles/chef-13.gemfile +19 -0
- data/test/gemfiles/master.gemfile +24 -0
- data/test/integration/default/serverspec/default_spec.rb +30 -0
- data/test/spec/resources/poise_tls_remote_file_spec.rb +330 -0
- data/test/spec/spec_helper.rb +19 -0
- metadata +192 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.16.42'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.17.44'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.18.31'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.19.36'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.5.1'
|
20
|
+
gem 'rack', '< 2'
|
21
|
+
gem 'foodcritic', '< 8'
|
22
|
+
gem 'fauxhai', '<= 3.9.0'
|
23
|
+
gem 'chefspec', '< 6'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.6.0'
|
20
|
+
gem 'rack', '< 2'
|
21
|
+
gem 'foodcritic', '< 8'
|
22
|
+
gem 'fauxhai', '<= 3.9.0'
|
23
|
+
gem 'chefspec', '< 6'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.7.2'
|
20
|
+
gem 'rack', '< 2'
|
21
|
+
gem 'foodcritic', '< 8'
|
22
|
+
gem 'fauxhai', '<= 3.9.0'
|
23
|
+
gem 'chefspec', '< 6'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.8.1'
|
20
|
+
gem 'rack', '< 2'
|
21
|
+
gem 'foodcritic', '< 8'
|
22
|
+
gem 'fauxhai', '<= 3.9.0'
|
23
|
+
gem 'chefspec', '< 6'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.9.41'
|
20
|
+
gem 'rack', '< 2'
|
21
|
+
gem 'foodcritic', '< 8'
|
22
|
+
gem 'fauxhai', '<= 3.9.0'
|
23
|
+
gem 'chefspec', '< 6'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.19'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 13.0.118'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 13.0'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', github: 'chef/chef'
|
20
|
+
gem 'ohai', github: 'chef/ohai'
|
21
|
+
gem 'halite', github: 'poise/halite'
|
22
|
+
gem 'poise', github: 'poise/poise'
|
23
|
+
gem 'poise-boiler', github: 'poise/poise-boiler'
|
24
|
+
gem 'poise-service', github: 'poise/poise-service'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'serverspec'
|
18
|
+
set :backend, :exec
|
19
|
+
|
20
|
+
describe file('/output') do
|
21
|
+
its(:content) { is_expected.to eq "Hello world\n" }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe file('/output2') do
|
25
|
+
its(:content) { is_expected.to eq "Hello world\n" }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe file('/output3') do
|
29
|
+
its(:content) { is_expected.to eq "Hello world\n" }
|
30
|
+
end
|
@@ -0,0 +1,330 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2017, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe PoiseTlsRemoteFile::Resources::PoiseTlsRemoteFile do
|
20
|
+
step_into(:tls_remote_file)
|
21
|
+
let(:tempfile) { Tempfile.new('chefout') }
|
22
|
+
let(:stub_http_response) { double('Net::HTTPResponse', http_version: '1.1', code: '200', msg: 'OK') }
|
23
|
+
let(:stub_cert_store) { double('OpenSSL::X509::Store') }
|
24
|
+
let(:stub_http) { double('Net::HTTP', proxy_address: nil, cert_store: stub_cert_store) }
|
25
|
+
before { override_attributes['test_tempfile'] = tempfile.path }
|
26
|
+
after { tempfile.close! }
|
27
|
+
before do
|
28
|
+
# Stub file loading.
|
29
|
+
allow(IO).to receive(:read).and_call_original
|
30
|
+
allow(IO).to receive(:read).with('/test/client.crt') { IO.read(File.expand_path('../../../cookbook/files/client.crt', __FILE__)) }
|
31
|
+
allow(IO).to receive(:read).with('/test/client.key') { IO.read(File.expand_path('../../../cookbook/files/client.key', __FILE__)) }
|
32
|
+
allow(IO).to receive(:read).with('/test/client.pem') { IO.read(File.expand_path('../../../cookbook/files/client.pem', __FILE__)) }
|
33
|
+
allow(IO).to receive(:read).with('/test/ca.crt') { IO.read(File.expand_path('../../../cookbook/files/ca.crt', __FILE__)) }
|
34
|
+
# Stub core HTTP stuffs.
|
35
|
+
allow(Net::HTTP).to receive(:new).and_return(stub_http)
|
36
|
+
allow(stub_http).to receive(:proxy_port=).with(nil)
|
37
|
+
allow(stub_http).to receive(:use_ssl=).with(true)
|
38
|
+
allow(stub_http).to receive(:verify_mode=).with(1)
|
39
|
+
allow(stub_http).to receive(:cert_store=)
|
40
|
+
allow(stub_http).to receive(:read_timeout=).with(300)
|
41
|
+
allow(stub_http).to receive(:open_timeout=).with(300)
|
42
|
+
allow(stub_http).to receive(:request).and_yield(stub_http_response)
|
43
|
+
allow(stub_cert_store).to receive(:set_default_paths)
|
44
|
+
allow(stub_http_response).to receive(:error!)
|
45
|
+
allow(stub_http_response).to receive(:each)
|
46
|
+
# Attributes.
|
47
|
+
override_attributes['poise-tls-remote-file'] = {}
|
48
|
+
end
|
49
|
+
recipe do
|
50
|
+
tls_remote_file node['test_tempfile'] do
|
51
|
+
source 'https://example.com/'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
CA_FINGERPRINT = 'fb:f0:76:db:c2:02:c8:53:47:9e:fd:cd:53:e0:99:58'
|
56
|
+
CLIENT_FINGERPRINT = '84:9f:57:30:e7:74:d1:fd:d5:a2:d7:72:9c:02:a0:3c'
|
57
|
+
SERVER_FINGERPRINT = 'c9:cd:24:86:65:13:33:19:11:0f:0d:06:6f:63:3f:dd'
|
58
|
+
|
59
|
+
def expect_cert(fingerprint)
|
60
|
+
expect(stub_http).to receive(:cert=) do |cert|
|
61
|
+
expect(cert.public_key.fingerprint).to eq fingerprint
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def expect_key(fingerprint)
|
66
|
+
expect(stub_http).to receive(:key=) do |key|
|
67
|
+
expect(key.fingerprint).to eq fingerprint
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def expect_add_cert(fingerprint)
|
72
|
+
expect(stub_cert_store).to receive(:add_cert) do |cert|
|
73
|
+
expect(cert.public_key.fingerprint).to eq fingerprint
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'with client_cert' do
|
78
|
+
recipe do
|
79
|
+
tls_remote_file node['test_tempfile'] do
|
80
|
+
source 'https://example.com/'
|
81
|
+
client_cert '/test/client.crt'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it do
|
86
|
+
expect_cert(CLIENT_FINGERPRINT)
|
87
|
+
run_chef
|
88
|
+
end
|
89
|
+
end # /context with client_cert
|
90
|
+
|
91
|
+
context 'with client_key' do
|
92
|
+
recipe do
|
93
|
+
tls_remote_file node['test_tempfile'] do
|
94
|
+
source 'https://example.com/'
|
95
|
+
client_key '/test/client.key'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it do
|
100
|
+
expect_key(CLIENT_FINGERPRINT)
|
101
|
+
run_chef
|
102
|
+
end
|
103
|
+
end # /context with client_key
|
104
|
+
|
105
|
+
context 'with both client_cert and client_key' do
|
106
|
+
recipe do
|
107
|
+
tls_remote_file node['test_tempfile'] do
|
108
|
+
source 'https://example.com/'
|
109
|
+
client_cert '/test/client.crt'
|
110
|
+
client_key '/test/client.key'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
it do
|
115
|
+
expect_cert(CLIENT_FINGERPRINT)
|
116
|
+
expect_key(CLIENT_FINGERPRINT)
|
117
|
+
run_chef
|
118
|
+
end
|
119
|
+
end # /context with both client_cert and client_key
|
120
|
+
|
121
|
+
context 'with ca string' do
|
122
|
+
recipe do
|
123
|
+
tls_remote_file node['test_tempfile'] do
|
124
|
+
source 'https://example.com/'
|
125
|
+
ca '/test/ca.crt'
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it do
|
130
|
+
expect_add_cert(CA_FINGERPRINT)
|
131
|
+
run_chef
|
132
|
+
end
|
133
|
+
end # /context with ca string
|
134
|
+
|
135
|
+
context 'with ca array' do
|
136
|
+
recipe do
|
137
|
+
tls_remote_file node['test_tempfile'] do
|
138
|
+
source 'https://example.com/'
|
139
|
+
ca %w{/test/ca.crt /test/client.crt}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
it do
|
144
|
+
expect_add_cert(CA_FINGERPRINT)
|
145
|
+
expect_add_cert(CLIENT_FINGERPRINT)
|
146
|
+
run_chef
|
147
|
+
end
|
148
|
+
end # /context with ca array
|
149
|
+
|
150
|
+
context 'with a literal client_cert' do
|
151
|
+
recipe do
|
152
|
+
tls_remote_file node['test_tempfile'] do
|
153
|
+
source 'https://example.com/'
|
154
|
+
client_cert <<-EOH
|
155
|
+
-----BEGIN CERTIFICATE-----
|
156
|
+
MIIFEjCCAvoCAQIwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQVUxEzARBgNV
|
157
|
+
BAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0
|
158
|
+
ZDAeFw0xNzA0MTQwNjIxNTRaFw0xODA0MTQwNjIxNTRaMFkxCzAJBgNVBAYTAkFV
|
159
|
+
MRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRz
|
160
|
+
IFB0eSBMdGQxEjAQBgNVBAMTCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQAD
|
161
|
+
ggIPADCCAgoCggIBANsqb+c62APAmf3/TAVBq54e9fJgHshr/I8L0qzj2M5oD7Sr
|
162
|
+
C+9U01mLSIeJu+CPINpRihR7L0iMT92hBFStlnivdCt+471q/vQTlfOl54DRgvm5
|
163
|
+
FD10LOkNagSMa9jziSo+25yBKtojrPUN4bt0FjMMDqix/T6P/8xDx+g8hP63CCll
|
164
|
+
ygwIlvO508IM6+trAqaNbgy7lOhrlKcAjNt86n/hmFV+chdgr5dVYZ5JULtfKNuk
|
165
|
+
oFLSL56R9pMAGl/v43FsD6w4G2pFndJip5+f46L30gQ7GqkfduPHCjGWwO7r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Gjnm8MuxKxWxc9MwAKdWZDzv0KaP/
|
181
|
+
TKsEDqY1v+5YEeoLzp6AXIPIpj7IuJGArQBI/ASaSr3hpJm7RM2VZIMXwVN6O1S5
|
182
|
+
iopdV1Wu+B3qDhl9WQpSAra/n/SuMCp821PhSuaRoG/VQyRbNiV63ERSRgmh21Kz
|
183
|
+
Uuiq6QmL
|
184
|
+
-----END CERTIFICATE-----
|
185
|
+
EOH
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
it do
|
190
|
+
expect_cert(SERVER_FINGERPRINT)
|
191
|
+
run_chef
|
192
|
+
end
|
193
|
+
end # /context with a literal client_cert
|
194
|
+
|
195
|
+
context 'with a literal client_key' do
|
196
|
+
recipe do
|
197
|
+
tls_remote_file node['test_tempfile'] do
|
198
|
+
source 'https://example.com/'
|
199
|
+
client_key <<-EOH
|
200
|
+
-----BEGIN RSA PRIVATE KEY-----
|
201
|
+
MIIJKwIBAAKCAgEA2ypv5zrYA8CZ/f9MBUGrnh718mAeyGv8jwvSrOPYzmgPtKsL
|
202
|
+
71TTWYtIh4m74I8g2lGKFHsvSIxP3aEEVK2WeK90K37jvWr+9BOV86XngNGC+bkU
|
203
|
+
PXQs6Q1qBIxr2POJKj7bnIEq2iOs9Q3hu3QWMwwOqLH9Po//zEPH6DyE/rcIKWXK
|
204
|
+
DAiW87nTwgzr62sCpo1uDLuU6GuUpwCM23zqf+GYVX5yF2Cvl1VhnklQu18o26Sg
|
205
|
+
UtIvnpH2kwAaX+/jcWwPrDgbakWd0mKnn5/jovfSBDsaqR9248cKMZbA7utDoXMz
|
206
|
+
YhUMhX6WScTGkYYWRwWM+2tek5WJztpMOTvzGGw67/vcifoo0TpAtxFUoWRQh+EU
|
207
|
+
ZaNJd1fl9Uu0+IAPT6NtPqpNvBvzO2AcNRvEFmap4t5ptRo22tuRoAxok0hbnn9q
|
208
|
+
iIP0JOa1uyXRYUsP4KOLwiS/WfAAi5X53ZwtIwU5/qQhAeMEDr0mpJSq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Ts23cx2NqjezA0JbGgiUJljoaHT50HWGFe993DU9V57/yRvVG
|
239
|
+
3R9ORDcCggEBAJwDftfuYsQgBeTrtXKUtiIyC7BeqOcEuy1iAMT9a8okYZysOHDG
|
240
|
+
H1ZmqkSN6l79b4g77d/E9zLZzPCVV5F9BCMCYCrnX53jnTVOlL3WqEA+FcLddsLm
|
241
|
+
Sx54zUqZMWA150ID4IL9MzJE1PqloatWK5L7iDV3qgWvrsgM0EIJ5XKKB/obVXty
|
242
|
+
nBi6A6UzD9SoF5dsMNTU7bCjmfR2JUL1mzUPm0nzAKuTMJ44ujPtT4REbUEQFiWd
|
243
|
+
QHMOKar5fxnuI2bRZkmgzGqI1kFNR5hsOKBkafYKUtYvgF1VpyjLCyJustGWBrWy
|
244
|
+
B/D9TAD+nZ6kj5Py+7gQU8HvEFoDUpHQ5j0CggEBAJnJgAjeD4VWpKe73Hbvs297
|
245
|
+
vLWf7LrBSYzInIF08B7i4Zrk9paxGrYfMQvNFgjHne3tQ0Wt747obp91zIpc6mEF
|
246
|
+
pxkq+gAJNdnr1HZF0goX396bvUSSSrkHhzECUFaBk6GkatOStSG3P6qfY5b9GUNj
|
247
|
+
q6Y3TehyKWn15NJuAXCCcW3iQP6eRPpb8SE+0GUfhNl3jImCsTBAfJf/0RzXy47s
|
248
|
+
paNbbb+V1ebmBHVwkNTDN7eZYhgEUhVd2EsxUaOa+Ow59SL6rLVBSK2NC8ttjR9v
|
249
|
+
sMhZt11Wrp4bbHh80a+Mw8SPoLMhCCIJzmFjwFoY8pspjK1ql6HTltHakloxY7o=
|
250
|
+
-----END RSA PRIVATE KEY-----
|
251
|
+
EOH
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
it do
|
256
|
+
expect_key(SERVER_FINGERPRINT)
|
257
|
+
run_chef
|
258
|
+
end
|
259
|
+
end # /context with a literal client_key
|
260
|
+
|
261
|
+
context 'with a literal ca' do
|
262
|
+
recipe do
|
263
|
+
tls_remote_file node['test_tempfile'] do
|
264
|
+
source 'https://example.com/'
|
265
|
+
ca <<-EOH
|
266
|
+
-----BEGIN CERTIFICATE-----
|
267
|
+
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
|
294
|
+
Uuiq6QmL
|
295
|
+
-----END CERTIFICATE-----
|
296
|
+
EOH
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
it do
|
301
|
+
expect_add_cert(SERVER_FINGERPRINT)
|
302
|
+
run_chef
|
303
|
+
end
|
304
|
+
end # /context with a literal ca
|
305
|
+
|
306
|
+
|
307
|
+
context 'with node["poise-tls-remote-file"]["client_cert"]' do
|
308
|
+
before { override_attributes['poise-tls-remote-file']['client_cert'] = '/test/client.crt' }
|
309
|
+
it do
|
310
|
+
expect_cert(CLIENT_FINGERPRINT)
|
311
|
+
run_chef
|
312
|
+
end
|
313
|
+
end # /context with node["poise-tls-remote-file"]["client_cert"]
|
314
|
+
|
315
|
+
context 'with node["poise-tls-remote-file"]["client_key"]' do
|
316
|
+
before { override_attributes['poise-tls-remote-file']['client_key'] = '/test/client.key' }
|
317
|
+
it do
|
318
|
+
expect_key(CLIENT_FINGERPRINT)
|
319
|
+
run_chef
|
320
|
+
end
|
321
|
+
end # /context with node["poise-tls-remote-file"]["client_key"]
|
322
|
+
|
323
|
+
context 'with node["poise-tls-remote-file"]["ca"]' do
|
324
|
+
before { override_attributes['poise-tls-remote-file']['ca'] = '/test/ca.crt' }
|
325
|
+
it do
|
326
|
+
expect_add_cert(CA_FINGERPRINT)
|
327
|
+
run_chef
|
328
|
+
end
|
329
|
+
end # /context with node["poise-tls-remote-file"]["ca"]
|
330
|
+
end
|