vault 0.7.2 → 0.7.3

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: 933d25d03026ad5f7cfd36a4497b3a73dc85a948
4
- data.tar.gz: 84346c63501c8cfbe638e5e7d06f1764cc7f7a86
3
+ metadata.gz: 49716b95ff7c1b7e1a0a8a2d453ead50ff87c958
4
+ data.tar.gz: feaa17a437a8b90822902c3242bd0cd1d6ad9e82
5
5
  SHA512:
6
- metadata.gz: f1e82fc4b467b617a07685f3d7feb4d0c9f9dbe57a78c636f55306fd21d82db2a9310359d599911774f0ad16c3b4752cec0d24177980e810b6fb9dba62660f36
7
- data.tar.gz: 794835b7143c14d711d1f8c16e43c84f97fa21377151e52f2546934a970fe3e1fce84406cec320373031b501eb43747b694e29f6f9839843ebab4f944e8e2528
6
+ metadata.gz: 92a96b4abdfd34d4c9432d4ef1e04a4619b855d10c5432d89620f3095b958f4982d188e9251697683cabcf803c112608e645919819068fcd7cb0508474dd01ff
7
+ data.tar.gz: 2757bdad26d92299f73ded6cefca605f4f28c528737f6ab790303c61634e15000c1d8ed08fee299bfb5ec5ffcf245884814acd87c91e22d5b85033ded005ea41
@@ -1,5 +1,13 @@
1
1
  # Vault Ruby Changelog
2
2
 
3
+ ## v0.7.3 (October 25, 2016)
4
+
5
+ BUG FIXES
6
+
7
+ - Allow options to be set on `Vault` as well as any `Vault::Client`
8
+ instance to be used properly.
9
+ - Remove Ruby 2.0 syntax in favor of Ruby 1.9
10
+
3
11
  ## v0.7.2 (October 24, 2016)
4
12
 
5
13
  BUG FIXES
@@ -75,72 +75,85 @@ module Vault
75
75
  instance_variable_set(:"@#{key}", value)
76
76
  end
77
77
 
78
- @nhp = PersistentHTTP.new(name: "vault-ruby")
78
+ @lock = Mutex.new
79
+ @nhp = nil
80
+ end
81
+
82
+ def pool
83
+ @lock.synchronize do
84
+ return @nhp if @nhp
85
+
86
+ @nhp = PersistentHTTP.new(name: "vault-ruby")
79
87
 
80
- if proxy_address
81
- proxy_uri = URI.parse "http://#{proxy_address}"
88
+ if proxy_address
89
+ proxy_uri = URI.parse "http://#{proxy_address}"
82
90
 
83
- proxy_uri.port = proxy_port if proxy_port
91
+ proxy_uri.port = proxy_port if proxy_port
84
92
 
85
- if proxy_username
86
- proxy_uri.user = proxy_username
87
- proxy_uri.password = proxy_password
93
+ if proxy_username
94
+ proxy_uri.user = proxy_username
95
+ proxy_uri.password = proxy_password
96
+ end
97
+
98
+ @nhp.proxy = proxy_uri
88
99
  end
89
100
 
90
- @nhp.proxy = proxy_uri
91
- end
101
+ # Use a custom open timeout
102
+ if open_timeout || timeout
103
+ @nhp.open_timeout = (open_timeout || timeout).to_i
104
+ end
92
105
 
93
- # Use a custom open timeout
94
- if open_timeout || timeout
95
- @nhp.open_timeout = (open_timeout || timeout).to_i
96
- end
106
+ # Use a custom read timeout
107
+ if read_timeout || timeout
108
+ @nhp.read_timeout = (read_timeout || timeout).to_i
109
+ end
97
110
 
98
- # Use a custom read timeout
99
- if read_timeout || timeout
100
- @nhp.read_timeout = (read_timeout || timeout).to_i
101
- end
111
+ @nhp.verify_mode = OpenSSL::SSL::VERIFY_PEER
102
112
 
103
- @nhp.verify_mode = OpenSSL::SSL::VERIFY_PEER
113
+ # Vault requires TLS1.2
114
+ @nhp.ssl_version = "TLSv1_2"
104
115
 
105
- # Vault requires TLS1.2
106
- @nhp.ssl_version = "TLSv1_2"
116
+ # Only use secure ciphers
117
+ @nhp.ciphers = ssl_ciphers
107
118
 
108
- # Only use secure ciphers
109
- @nhp.ciphers = ssl_ciphers
119
+ # Custom pem files, no problem!
120
+ pem = ssl_pem_contents || (ssl_pem_file ? File.read(ssl_pem_file) : nil)
121
+ if pem
122
+ @nhp.cert = OpenSSL::X509::Certificate.new(pem)
123
+ @nhp.key = OpenSSL::PKey::RSA.new(pem, ssl_pem_passphrase)
124
+ end
110
125
 
111
- # Custom pem files, no problem!
112
- pem = ssl_pem_contents || (ssl_pem_file ? File.read(ssl_pem_file) : nil)
113
- if pem
114
- @nhp.cert = OpenSSL::X509::Certificate.new(pem)
115
- @nhp.key = OpenSSL::PKey::RSA.new(pem, ssl_pem_passphrase)
116
- end
126
+ # Use custom CA cert for verification
127
+ if ssl_ca_cert
128
+ @nhp.ca_file = ssl_ca_cert
129
+ end
117
130
 
118
- # Use custom CA cert for verification
119
- if ssl_ca_cert
120
- @nhp.ca_file = ssl_ca_cert
121
- end
131
+ # Use custom CA path that contains CA certs
132
+ if ssl_ca_path
133
+ @nhp.ca_path = ssl_ca_path
134
+ end
122
135
 
123
- # Use custom CA path that contains CA certs
124
- if ssl_ca_path
125
- @nhp.ca_path = ssl_ca_path
126
- end
136
+ if ssl_cert_store
137
+ @nhp.cert_store = ssl_cert_store
138
+ end
127
139
 
128
- if ssl_cert_store
129
- @nhp.cert_store = ssl_cert_store
130
- end
140
+ # Naughty, naughty, naughty! Don't blame me when someone hops in
141
+ # and executes a MITM attack!
142
+ if !ssl_verify
143
+ @nhp.verify_mode = OpenSSL::SSL::VERIFY_NONE
144
+ end
131
145
 
132
- # Naughty, naughty, naughty! Don't blame me when someone hops in
133
- # and executes a MITM attack!
134
- if !ssl_verify
135
- @nhp.verify_mode = OpenSSL::SSL::VERIFY_NONE
136
- end
146
+ # Use custom timeout for connecting and verifying via SSL
147
+ if ssl_timeout || timeout
148
+ @nhp.ssl_timeout = (ssl_timeout || timeout).to_i
149
+ end
137
150
 
138
- # Use custom timeout for connecting and verifying via SSL
139
- if ssl_timeout || timeout
140
- @nhp.ssl_timeout = (ssl_timeout || timeout).to_i
151
+ @nhp
141
152
  end
142
153
  end
143
154
 
155
+ private :pool
156
+
144
157
  # Creates and yields a new client object with the given token. This may be
145
158
  # used safely in a threadsafe manner because the original client remains
146
159
  # unchanged. The value of the block is returned.
@@ -253,7 +266,7 @@ module Vault
253
266
  begin
254
267
  # Create a connection using the block form, which will ensure the socket
255
268
  # is properly closed in the event of an error.
256
- response = @nhp.request(uri, request)
269
+ response = pool.request(uri, request)
257
270
 
258
271
  case response
259
272
  when Net::HTTPRedirection
@@ -505,7 +505,7 @@ class PersistentHTTP
505
505
  # Defaults to 1/4 the number of allowed file handles. You can have no more
506
506
  # than this many threads with active HTTP transactions.
507
507
 
508
- def initialize name: nil, proxy: nil, pool_size: DEFAULT_POOL_SIZE
508
+ def initialize name=nil, proxy=nil, pool_size=DEFAULT_POOL_SIZE
509
509
  @name = name
510
510
 
511
511
  @debug_output = nil
@@ -1,3 +1,3 @@
1
1
  module Vault
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-24 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler