vagrant-zanzibar 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Zanzibar
2
- [![Gem Version](https://badge.fury.io/rb/zanzibar.svg)](http://badge.fury.io/rb/zanzibar)
2
+ [![Gem Version](https://badge.fury.io/rb/vagrant-zanzibar.svg)](http://badge.fury.io/rb/vagrant-zanzibar)
3
3
 
4
- Zanzibar is a utility to retrieve secrets from a Secret Server installation. It supports retrieval of a password, public/private key, or secret attachment.
4
+ vagrant-zanzibar is a fork of zanzibar intended to work with Vagrant environments to retrieve secrets from a Secret Server installation. It supports retrieval of a password, public/private key, or secret attachment.
5
5
 
6
6
  ## Installation
7
7
 
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'zanzibar'
11
+ gem 'vagrant-zanzibar'
12
12
  ```
13
13
 
14
14
  And then execute:
@@ -17,57 +17,52 @@ And then execute:
17
17
 
18
18
  Or install it yourself as:
19
19
 
20
- $ gem install zanzibar
20
+ $ gem install vagrant-zanzibar
21
21
 
22
22
  ## Usage
23
23
 
24
- In your ruby project, rakefile, etc., create a new Zanzibar object. The constructor takes a hash of optional parameters for the WSDL location, the domain of the Secret Server, a hash of global variables to pass to savon (necessary for windows environments with self-signed certs) and a password for the current user (intended to be passed in through some encryption method, unless you really want a plaintext password there.). All of these parameters are optional and the user will be prompted to enter them if they are missing.
24
+ Here is an example Vagrantfile, using vagrant-orchestrate.
25
25
 
26
26
  ```ruby
27
- my_object = Zanzibar::Zanzibar.new(:domain => 'my.domain.net', :wsdl => 'my.scrt.srvr.com/webservices/sswebservice.asmx?wdsl', :pwd => get_encrypted_password_from_somewhere)
28
- ```
29
-
30
- Example:
31
-
32
- ```ruby
33
- require 'zanzibar'
34
-
35
- ## Constructor takes hash as argument, all optional :domain, :wsdl, :pwd, :globals
36
- secrets = Zanzibar::Zanzibar.new(:domain => 'mydomain.net', :wsdl => "https://my.scrt.server/webservices/sswebservice.asmx?wsdl")
37
- # On windows with self-signed certs,
38
- # Zanzibar::Zanzibar.new(:domain => 'mydomain.net', :wsdl => "https://my.scrt.server/webservices/sswebservice.asmx?wsdl", :globals => {:ssl_verify_mode => :none})
39
-
40
- ## Simple password -> takes secret id as argument
41
- secrets.get_password(1234)
42
-
43
- ## Private Key -> takes hash as argument, requires :scrt_id, :type, optional :scrt_item_id, :path
44
- secrets.download_secret_file(:scrt_id => 2345, :path => 'secrets/', :type => "Private Key")
45
-
46
- ## Public Key -> takes hash as argument, requires :scrt_id, :type, optional :scrt_item_id, :path
47
- secrets.download_secret_file(:scrt_id => 2345, :path => 'secrets/', :type => "Public Key")
48
-
49
- ## Attachment; only supports secrets with single attachment -> takes hash as argument, requires :scrt_id, :path, optional :scrt_item_id, :path
50
- secrets.download_secret_file(:scrt_id => 2345, :path => 'secrets/', :type => "Attachment")
51
-
52
- ```
53
-
54
- ### Command Line
55
-
56
- Zanzibar comes bundled with the `zanzibar` command-line utility that can be used for fetching passwords and downloading keys from outside of Ruby.
57
-
58
- `zanzibar` supports most actions provided by Zanzibar itself. Because it operates on the command-line, it can be used as part of a pipeline or within a bash script.
59
-
60
- ```bash
61
- # if you don't pipe in a password, you will be prompted to enter one.
62
- # this will download the private key from secret 1984 to the current directory
63
- cat ./local-password | zanzibar 1984 -s server.example.com -d example.com -t privatekey
27
+ require 'vagrant-zanzibar'
28
+
29
+ zanzibar = Zanzibar::Zanzibar.new(:wsdl => "https://mysecretserver.com/webservices/sswebservice.asmx?wsdl", :domain => 'mydomain.net')
30
+
31
+ managed_servers = %w( myserver1.net )
32
+
33
+ required_plugins = %w( vagrant-managed-servers vagrant-triggers vagrant-zanzibar)
34
+ required_plugins.each do |plugin|
35
+ system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
36
+ end
37
+ Vagrant.configure("2") do |config|
38
+ config.ssh.username = "user"
39
+ config.ssh.private_key_path = zanzibar.download_secret_file(:scrt_id => 1234, :type => "Private Key")
40
+
41
+ config.trigger.before :provision do
42
+ # This password needs to be checked out
43
+ zanzibar.get_password(3456)
44
+ end
45
+
46
+ config.trigger.after :destroy do
47
+ zanzibar.check_in_secrets
48
+ end
49
+
50
+ managed_servers.each do |instance|
51
+ config.vm.define "managed-#{instance}" do |box|
52
+ box.vm.box = "tknerr/managed-server-dummy"
53
+ box.vm.box_url = "./dummy.box"
54
+ box.vm.provider :managed do |provider|
55
+ provider.server = instance
56
+ end
57
+ end
58
+ end
59
+ end
64
60
 
65
- ssh user@someremote -i ./private_key
66
61
  ```
67
62
 
68
63
  ## Contributing
69
64
 
70
- 1. Fork it ( https://github.com/Cimpress-MCP/zanzibar/fork )
65
+ 1. Fork it ( https://github.com/Cimpress-MCP/vagrant-zanzibar/fork )
71
66
  2. Create your feature branch (`git checkout -b my-new-feature`)
72
67
  3. Commit your changes (`git commit -am 'Add some feature'`)
73
68
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module Zanzibar
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -86,7 +86,7 @@ module Zanzibar
86
86
  def check_in_secrets
87
87
  failures = []
88
88
  token = get_token
89
- @@secrets.each do |secret_id|
89
+ @@secrets.uniq.each do |secret_id|
90
90
  begin
91
91
  response = @@client.request(:wsdl, :check_in) { soap.body = { token: token, secretId: secret_id} }
92
92
  .hash[:envelope][:body][:check_in_response][:check_in_result][:errors]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-zanzibar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  segments:
140
140
  - 0
141
- hash: 447247425
141
+ hash: -429271053
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  none: false
144
144
  requirements:
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: 447247425
150
+ hash: -429271053
151
151
  requirements: []
152
152
  rubyforge_project:
153
153
  rubygems_version: 1.8.24