vagrant-zanzibar 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +12 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +13 -0
- data/README.md +74 -0
- data/Rakefile +11 -0
- data/bin/zamioculcas +2 -0
- data/bin/zanzibar +72 -0
- data/lib/vagrant-zanzibar.rb +213 -0
- data/lib/vagrant-zanzibar/version.rb +3 -0
- data/spec/responses/attachment_response.xml +12 -0
- data/spec/responses/authenticate_response.xml +12 -0
- data/spec/responses/download_private_key_response.xml +12 -0
- data/spec/responses/download_public_key_response.xml +12 -0
- data/spec/responses/get_secret_response.xml +57 -0
- data/spec/responses/get_secret_with_attachment_response.xml +57 -0
- data/spec/responses/get_secret_with_keys_response.xml +47 -0
- data/spec/scrt.wsdl +629 -0
- data/spec/spec/spec_helper.rb +95 -0
- data/spec/zanzibar_spec.rb +113 -0
- data/zanzibar.gemspec +26 -0
- metadata +167 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
require 'webmock/rspec'
|
18
|
+
require 'codeclimate-test-reporter'
|
19
|
+
CodeClimate::TestReporter.start
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
# rspec-expectations config goes here. You can use an alternate
|
23
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
24
|
+
# assertions if you prefer.
|
25
|
+
config.expect_with :rspec do |expectations|
|
26
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
27
|
+
# and `failure_message` of custom matchers include text for helper methods
|
28
|
+
# defined using `chain`, e.g.:
|
29
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
30
|
+
# # => "be bigger than 2 and smaller than 4"
|
31
|
+
# ...rather than:
|
32
|
+
# # => "be bigger than 2"
|
33
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
34
|
+
end
|
35
|
+
|
36
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
37
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
38
|
+
config.mock_with :rspec do |mocks|
|
39
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
40
|
+
# a real object. This is generally recommended, and will default to
|
41
|
+
# `true` in RSpec 4.
|
42
|
+
mocks.verify_partial_doubles = true
|
43
|
+
end
|
44
|
+
|
45
|
+
config.after(:suite) do
|
46
|
+
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
47
|
+
end
|
48
|
+
|
49
|
+
# The settings below are suggested to provide a good initial experience
|
50
|
+
# with RSpec, but feel free to customize to your heart's content.
|
51
|
+
# # These two settings work together to allow you to limit a spec run
|
52
|
+
# # to individual examples or groups you care about by tagging them with
|
53
|
+
# # `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
54
|
+
# # get run.
|
55
|
+
# config.filter_run :focus
|
56
|
+
# config.run_all_when_everything_filtered = true
|
57
|
+
#
|
58
|
+
# # Limits the available syntax to the non-monkey patched syntax that is recommended.
|
59
|
+
# # For more details, see:
|
60
|
+
# # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
61
|
+
# # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
62
|
+
# # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
63
|
+
# config.disable_monkey_patching!
|
64
|
+
#
|
65
|
+
# # This setting enables warnings. It's recommended, but in some cases may
|
66
|
+
# # be too noisy due to issues in dependencies.
|
67
|
+
# config.warnings = true
|
68
|
+
#
|
69
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
70
|
+
# # file, and it's useful to allow more verbose output when running an
|
71
|
+
# # individual spec file.
|
72
|
+
# if config.files_to_run.one?
|
73
|
+
# # Use the documentation formatter for detailed output,
|
74
|
+
# # unless a formatter has already been configured
|
75
|
+
# # (e.g. via a command-line flag).
|
76
|
+
# config.default_formatter = 'doc'
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# # Print the 10 slowest examples and example groups at the
|
80
|
+
# # end of the spec run, to help surface which specs are running
|
81
|
+
# # particularly slow.
|
82
|
+
# config.profile_examples = 10
|
83
|
+
#
|
84
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
85
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
86
|
+
# # the seed, which is printed after each run.
|
87
|
+
# # --seed 1234
|
88
|
+
# config.order = :random
|
89
|
+
#
|
90
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
91
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
92
|
+
# # test failures related to randomization by passing the same `--seed` value
|
93
|
+
# # as the one that triggered the failure.
|
94
|
+
# Kernel.srand config.seed
|
95
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'vagrant-zanzibar'
|
2
|
+
require 'savon'
|
3
|
+
require 'webmock'
|
4
|
+
require 'rspec'
|
5
|
+
require 'webmock/rspec'
|
6
|
+
|
7
|
+
include WebMock::API
|
8
|
+
|
9
|
+
describe 'Zanzibar Test' do
|
10
|
+
client = Zanzibar::Zanzibar.new(domain: 'zanzitest.net', pwd: 'password', wsdl: 'spec/scrt.wsdl')
|
11
|
+
auth_xml = File.read('spec/responses/authenticate_response.xml')
|
12
|
+
secret_xml = File.read('spec/responses/get_secret_response.xml')
|
13
|
+
secret_with_key_xml = File.read('spec/responses/get_secret_with_keys_response.xml')
|
14
|
+
secret_with_attachment_xml = File.read('spec/responses/get_secret_with_attachment_response.xml')
|
15
|
+
private_key_xml = File.read('spec/responses/download_private_key_response.xml')
|
16
|
+
public_key_xml = File.read('spec/responses/download_public_key_response.xml')
|
17
|
+
attachment_xml = File.read('spec/responses/attachment_response.xml')
|
18
|
+
|
19
|
+
it 'should return an auth token' do
|
20
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
21
|
+
.to_return(body: auth_xml, status: 200)
|
22
|
+
|
23
|
+
expect(client.get_token).to eq('imatoken')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should get a secret' do
|
27
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
28
|
+
.to_return(body: auth_xml, status: 200).then
|
29
|
+
.to_return(body: secret_xml, status: 200)
|
30
|
+
|
31
|
+
expect(client.get_secret(1234)[:secret][:name]).to eq('Zanzi Test Secret')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should get a password' do
|
35
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
36
|
+
.to_return(body: auth_xml, status: 200).then
|
37
|
+
.to_return(body: secret_xml, status: 200)
|
38
|
+
|
39
|
+
expect(client.get_password(1234)).to eq('zanziUserPassword')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should download a private key' do
|
43
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
44
|
+
.to_return(body: auth_xml, status: 200).then
|
45
|
+
.to_return(body: secret_with_key_xml, status: 200).then
|
46
|
+
.to_return(body: private_key_xml, status: 200)
|
47
|
+
|
48
|
+
client.download_secret_file(scrt_id: 2345, type: 'Private Key')
|
49
|
+
expect(File.exist? 'zanzi_key')
|
50
|
+
expect(File.read('zanzi_key')).to eq("-----BEGIN RSA PRIVATE KEY -----\nzanzibarTestPassword\n-----END RSA PRIVATE KEY-----\n")
|
51
|
+
File.delete('zanzi_key')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should download a private key legacy' do
|
55
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
56
|
+
.to_return(body: auth_xml, status: 200).then
|
57
|
+
.to_return(body: secret_with_key_xml, status: 200).then
|
58
|
+
.to_return(body: private_key_xml, status: 200)
|
59
|
+
|
60
|
+
client.download_private_key(scrt_id: 2345)
|
61
|
+
expect(File.exist? 'zanzi_key')
|
62
|
+
expect(File.read('zanzi_key')).to eq("-----BEGIN RSA PRIVATE KEY -----\nzanzibarTestPassword\n-----END RSA PRIVATE KEY-----\n")
|
63
|
+
File.delete('zanzi_key')
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should download a public key' do
|
67
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
68
|
+
.to_return(body: auth_xml, status: 200).then
|
69
|
+
.to_return(body: secret_with_key_xml, status: 200).then
|
70
|
+
.to_return(body: public_key_xml, status: 200)
|
71
|
+
|
72
|
+
client.download_secret_file(scrt_id: 2345, type: 'Public Key')
|
73
|
+
expect(File.exist? 'zanzi_key.pub')
|
74
|
+
expect(File.read('zanzi_key.pub')).to eq("1234PublicKey5678==\n")
|
75
|
+
File.delete('zanzi_key.pub')
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should download a public key legacy' do
|
79
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
80
|
+
.to_return(body: auth_xml, status: 200).then
|
81
|
+
.to_return(body: secret_with_key_xml, status: 200).then
|
82
|
+
.to_return(body: public_key_xml, status: 200)
|
83
|
+
|
84
|
+
client.download_public_key(scrt_id: 2345)
|
85
|
+
expect(File.exist? 'zanzi_key.pub')
|
86
|
+
expect(File.read('zanzi_key.pub')).to eq("1234PublicKey5678==\n")
|
87
|
+
File.delete('zanzi_key.pub')
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should download an attachment' do
|
91
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
92
|
+
.to_return(body: auth_xml, status: 200).then
|
93
|
+
.to_return(body: secret_with_attachment_xml, status: 200).then
|
94
|
+
.to_return(body: attachment_xml, status: 200)
|
95
|
+
|
96
|
+
client.download_secret_file(scrt_id: 3456, type: 'Attachment')
|
97
|
+
expect(File.exist? 'attachment.txt')
|
98
|
+
expect(File.read('attachment.txt')).to eq("I am a secret attachment\n")
|
99
|
+
File.delete('attachment.txt')
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should download an attachment legacy' do
|
103
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
104
|
+
.to_return(body: auth_xml, status: 200).then
|
105
|
+
.to_return(body: secret_with_attachment_xml, status: 200).then
|
106
|
+
.to_return(body: attachment_xml, status: 200)
|
107
|
+
|
108
|
+
client.download_attachment(scrt_id: 3456)
|
109
|
+
expect(File.exist? 'attachment.txt')
|
110
|
+
expect(File.read('attachment.txt')).to eq("I am a secret attachment\n")
|
111
|
+
File.delete('attachment.txt')
|
112
|
+
end
|
113
|
+
end
|
data/zanzibar.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-zanzibar/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'vagrant-zanzibar'
|
8
|
+
spec.version = Zanzibar::VERSION
|
9
|
+
spec.authors = ['Jason Davis-Cooke']
|
10
|
+
spec.email = ['jdaviscooke@cimpress.com']
|
11
|
+
spec.summary = 'Retrieve secrets from Secret Server'
|
12
|
+
spec.description = 'Programatically get secrets from Secret Server via the Web Service API. This is for use specifically with Vagrant which requires an old version of savon'
|
13
|
+
spec.homepage = 'https://github.com/Cimpress-MCP/vagrant-zanzibar'
|
14
|
+
spec.license = 'Apache 2.0'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'rubyntlm', '~> 0.1.1'
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rubocop', '~>0.18.1'
|
25
|
+
spec.add_dependency 'savon', '0.9.5'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-zanzibar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jason Davis-Cooke
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rubyntlm
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.7'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.7'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '10.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rubocop
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.18.1
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.18.1
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: savon
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - '='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.9.5
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - '='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.9.5
|
94
|
+
description: Programatically get secrets from Secret Server via the Web Service API.
|
95
|
+
This is for use specifically with Vagrant which requires an old version of savon
|
96
|
+
email:
|
97
|
+
- jdaviscooke@cimpress.com
|
98
|
+
executables:
|
99
|
+
- zamioculcas
|
100
|
+
- zanzibar
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- .rspec
|
106
|
+
- .travis.yml
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- bin/zamioculcas
|
112
|
+
- bin/zanzibar
|
113
|
+
- lib/vagrant-zanzibar.rb
|
114
|
+
- lib/vagrant-zanzibar/version.rb
|
115
|
+
- spec/responses/attachment_response.xml
|
116
|
+
- spec/responses/authenticate_response.xml
|
117
|
+
- spec/responses/download_private_key_response.xml
|
118
|
+
- spec/responses/download_public_key_response.xml
|
119
|
+
- spec/responses/get_secret_response.xml
|
120
|
+
- spec/responses/get_secret_with_attachment_response.xml
|
121
|
+
- spec/responses/get_secret_with_keys_response.xml
|
122
|
+
- spec/scrt.wsdl
|
123
|
+
- spec/spec/spec_helper.rb
|
124
|
+
- spec/zanzibar_spec.rb
|
125
|
+
- zanzibar.gemspec
|
126
|
+
homepage: https://github.com/Cimpress-MCP/vagrant-zanzibar
|
127
|
+
licenses:
|
128
|
+
- Apache 2.0
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
hash: 583603041
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
segments:
|
149
|
+
- 0
|
150
|
+
hash: 583603041
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project:
|
153
|
+
rubygems_version: 1.8.24
|
154
|
+
signing_key:
|
155
|
+
specification_version: 3
|
156
|
+
summary: Retrieve secrets from Secret Server
|
157
|
+
test_files:
|
158
|
+
- spec/responses/attachment_response.xml
|
159
|
+
- spec/responses/authenticate_response.xml
|
160
|
+
- spec/responses/download_private_key_response.xml
|
161
|
+
- spec/responses/download_public_key_response.xml
|
162
|
+
- spec/responses/get_secret_response.xml
|
163
|
+
- spec/responses/get_secret_with_attachment_response.xml
|
164
|
+
- spec/responses/get_secret_with_keys_response.xml
|
165
|
+
- spec/scrt.wsdl
|
166
|
+
- spec/spec/spec_helper.rb
|
167
|
+
- spec/zanzibar_spec.rb
|