conjur-api 4.19.0 → 4.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/conjur-api/version.rb +1 -1
- data/lib/conjur/api.rb +18 -11
- data/lib/conjur/base.rb +1 -1
- data/lib/conjur/cert_utils.rb +47 -0
- data/lib/conjur/configuration.rb +11 -15
- data/spec/lib/cert_utils_spec.rb +81 -0
- data/spec/lib/configuration_spec.rb +53 -1
- data/spec/vendor/rest_client_spec.rb +9 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 901ca102477411588107366adff9780e60eca7c2
|
4
|
+
data.tar.gz: 710a9dc4be2dce8bb3f7130ade8120563ee61e19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad298e7f945003d44306c6b9eb8b90a072ccde560735b8a092b1581a7847a3efcecc37f4d16f33f272a2b8b5d5d0c655fe767e7ddcd67b643616ca7767519cc2
|
7
|
+
data.tar.gz: 582dec6a6727e502be95af2b7024944e9ad9c260dc465710400d6e600af59a644b5df030264449b685831e064a7371a503cc11e2301ae4605c1f376cbd309427
|
data/CHANGELOG.md
CHANGED
data/lib/conjur-api/version.rb
CHANGED
data/lib/conjur/api.rb
CHANGED
@@ -42,24 +42,31 @@ require 'conjur/layer-api'
|
|
42
42
|
require 'conjur/pubkeys-api'
|
43
43
|
require 'conjur-api/version'
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
extend Conjur::BuildFromResponse
|
50
|
-
|
45
|
+
# Monkey patch RestClient::Request so it always uses
|
46
|
+
# :ssl_cert_store. (RestClient::Resource uses Request to send
|
47
|
+
# requests, so it sees :ssl_cert_store, too).
|
48
|
+
class RestClient::Request
|
51
49
|
alias_method :initialize_without_defaults, :initialize
|
52
50
|
|
53
|
-
def
|
54
|
-
initialize_without_defaults url, default_options.merge(options || {}), &block
|
55
|
-
end
|
56
|
-
|
57
|
-
def default_options
|
51
|
+
def default_args
|
58
52
|
{
|
59
53
|
ssl_cert_store: OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE
|
60
54
|
}
|
61
55
|
end
|
62
56
|
|
57
|
+
def initialize args
|
58
|
+
initialize_without_defaults default_args.merge(args)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
class RestClient::Resource
|
65
|
+
include Conjur::Escape
|
66
|
+
include Conjur::LogSource
|
67
|
+
include Conjur::Cast
|
68
|
+
extend Conjur::BuildFromResponse
|
69
|
+
|
63
70
|
# @api private
|
64
71
|
# @deprecated
|
65
72
|
# The account used by the core service. This is deprecated in favor of {Conjur.account} and
|
data/lib/conjur/base.rb
CHANGED
@@ -175,7 +175,7 @@ module Conjur
|
|
175
175
|
# An optional IP address to be recorded in the audit record for any actions performed by this API instance.
|
176
176
|
attr_reader :remote_ip
|
177
177
|
|
178
|
-
#@!attribute [
|
178
|
+
#@!attribute [rw] privilege
|
179
179
|
# The optional global privilege (e.g. 'elevate' or 'reveal') which should be attempted on the request.
|
180
180
|
attr_accessor :privilege
|
181
181
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2015 Conjur Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
#
|
21
|
+
|
22
|
+
module Conjur
|
23
|
+
module CertUtils
|
24
|
+
CERT_RE = /-----BEGIN CERTIFICATE-----\n.*?\n-----END CERTIFICATE-----\n/m
|
25
|
+
|
26
|
+
class << self
|
27
|
+
# Parse X509 DER-encoded certificates from a string
|
28
|
+
# @param certs [String] certificate(s) to parse in DER form
|
29
|
+
# @return [Array<OpenSSL::X509::Certificate>] certificates contained in the string
|
30
|
+
def parse_certs certs
|
31
|
+
# fix any mangled namespace
|
32
|
+
certs = certs.gsub /\s+/, "\n"
|
33
|
+
certs.gsub! "-----BEGIN\nCERTIFICATE-----", '-----BEGIN CERTIFICATE-----'
|
34
|
+
certs.gsub! "-----END\nCERTIFICATE-----", '-----END CERTIFICATE-----'
|
35
|
+
certs += "\n" unless certs[-1] == "\n"
|
36
|
+
|
37
|
+
certs.scan(CERT_RE).map do |cert|
|
38
|
+
begin
|
39
|
+
OpenSSL::X509::Certificate.new cert
|
40
|
+
rescue OpenSSL::X509::CertificateError => exn
|
41
|
+
raise exn, "Invalid certificate:\n#{cert} (#{exn.message})"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/conjur/configuration.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (C) 2013 Conjur Inc
|
2
|
+
# Copyright (C) 2013-2015 Conjur Inc
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
5
|
# this software and associated documentation files (the "Software"), to deal in
|
@@ -20,6 +20,9 @@
|
|
20
20
|
#
|
21
21
|
|
22
22
|
require 'set'
|
23
|
+
|
24
|
+
require 'conjur/cert_utils'
|
25
|
+
|
23
26
|
module Conjur
|
24
27
|
|
25
28
|
class << self
|
@@ -409,7 +412,13 @@ module Conjur
|
|
409
412
|
# @return [Boolean] whether a certificate was added to the store.
|
410
413
|
def apply_cert_config! store=OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE
|
411
414
|
if ssl_certificate
|
412
|
-
|
415
|
+
CertUtils.parse_certs(ssl_certificate).each do |cert|
|
416
|
+
begin
|
417
|
+
store.add_cert cert
|
418
|
+
rescue OpenSSL::X509::StoreError => ex
|
419
|
+
raise unless ex.message == 'cert already in hash table'
|
420
|
+
end
|
421
|
+
end
|
413
422
|
elsif cert_file
|
414
423
|
store.add_file cert_file
|
415
424
|
else
|
@@ -420,19 +429,6 @@ module Conjur
|
|
420
429
|
|
421
430
|
private
|
422
431
|
|
423
|
-
def add_cert_string store, str
|
424
|
-
str = str.gsub(/\s+/, "\n")
|
425
|
-
str.gsub!("-----BEGIN\n", "-----BEGIN ")
|
426
|
-
str.gsub!("-----END\n", "-----END ")
|
427
|
-
store.add_cert OpenSSL::X509::Certificate.new str
|
428
|
-
rescue OpenSSL::X509::CertificateError => ex
|
429
|
-
$stderr.puts "Invalid certificate:"
|
430
|
-
$stderr.puts str
|
431
|
-
raise ex
|
432
|
-
rescue OpenSSL::X509::StoreError => ex
|
433
|
-
raise ex unless ex.message == 'cert already in hash table'
|
434
|
-
end
|
435
|
-
|
436
432
|
def global_service_url(service_name, service_port_offset)
|
437
433
|
if appliance_url
|
438
434
|
URI.join(appliance_url + '/', service_name).to_s
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper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eStZFVDbC4ZEueRd9KAe
|
39
|
+
4IZ5FxdpFYkPBgt2lBYeydYKRShyYrDKye1uJBDkeplNaYW4cS4mOhYuRkdKn7MH
|
40
|
+
uY/xb1lFAgMBAAGjgYkwgYYwKQYDVR0RBCIwIIILY3VrZS1tYXN0ZXKCCWxvY2Fs
|
41
|
+
aG9zdIIGY29uanVyMB0GA1UdDgQWBBRHpGF7aQbHdORYgQKDC2hV6NzEKzAfBgNV
|
42
|
+
HSMEGDAWgBRHpGF7aQbHdORYgQKDC2hV6NzEKzAMBgNVHRMEBTADAQH/MAsGA1Ud
|
43
|
+
DwQEAwIB5jANBgkqhkiG9w0BAQsFAAOCAQEAGZT9Wek1hYluIVaxu03wSKCKIJ4p
|
44
|
+
KxTHw+mLDapg1y9t3Fa/5IQQK0Bx0xGU2qWiQKjda3vdFPJWO6l6XJvsUY5Nwtm5
|
45
|
+
Gcsk8l3L/zWCrjrFTH3TdVad5E+DTwVhThelmEjw68AyM+WuOL61j0MItd9mLW74
|
46
|
+
Lv2zouj9nQBdnUBHWQ0EL/9d5cfaCVu/bFlDfYt7Yj0IzXCuaWZfJeHodU1hmqVX
|
47
|
+
BvYRjnTB2LSxfmSnkrCeFPmhE11bWVtsLIdrGIgtEMX0/s9xg58QuNnva1U3pJsW
|
48
|
+
RjvSxre4Xg2qlI9Laybb4oZ4g6DI8hRbL0VdFAsveg6SXg2RxgJcXeJUFw==
|
49
|
+
-----END CERTIFICATE-----
|
50
|
+
"""
|
51
|
+
end
|
52
|
+
|
53
|
+
let(:cert1) { OpenSSL::X509::Certificate.new cert1_raw }
|
54
|
+
let(:cert2) { OpenSSL::X509::Certificate.new cert2_raw }
|
55
|
+
|
56
|
+
it 'parses a certificate' do
|
57
|
+
expect(Conjur::CertUtils.parse_certs(cert1_raw).map(&:to_der))\
|
58
|
+
.to eq [cert1.to_der]
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'parses two certificates' do
|
62
|
+
expect(Conjur::CertUtils.parse_certs(cert1_raw + cert2_raw).map(&:to_der))\
|
63
|
+
.to eq [cert1.to_der, cert2.to_der]
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'parses the certificate correctly even if the whitespace is wrong' do
|
67
|
+
bad_whitespace = cert1_raw.gsub "\n", " "
|
68
|
+
expect(Conjur::CertUtils.parse_certs(bad_whitespace).map(&:to_der))\
|
69
|
+
.to eq [cert1.to_der]
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'shows a bad cert in error message' do
|
73
|
+
bad_cert = "-----BEGIN CERTIFICATE-----\nfoo\n-----END CERTIFICATE-----\n"
|
74
|
+
expect do
|
75
|
+
Conjur::CertUtils.parse_certs(bad_cert)
|
76
|
+
end.to raise_error(OpenSSL::X509::CertificateError) do |exn|
|
77
|
+
expect(exn.message).to include bad_cert
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -238,7 +238,7 @@ describe Conjur::Configuration do
|
|
238
238
|
|
239
239
|
context 'when both are given' do
|
240
240
|
let(:cert_file){ '/path/to/cert.pem' }
|
241
|
-
let(:ssl_certificate){
|
241
|
+
let(:ssl_certificate){ "-----BEGIN CERTIFICATE-----\nfoo\n-----END CERTIFICATE-----\n" }
|
242
242
|
let(:cert){ double('certificate') }
|
243
243
|
it 'calls store.add_cert with a certificate created from ssl_certificate' do
|
244
244
|
expect(OpenSSL::X509::Certificate).to receive(:new).with(ssl_certificate).once.and_return cert
|
@@ -320,5 +320,57 @@ CERT
|
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
323
|
+
context 'with two certificates in a string' do
|
324
|
+
let(:cert_file) { nil }
|
325
|
+
let(:ssl_certificate) do
|
326
|
+
"""-----BEGIN CERTIFICATE-----
|
327
|
+
MIIDPjCCAiagAwIBAgIVAKW1gdmOFrXt6xB0iQmYQ4z8Pf+kMA0GCSqGSIb3DQEB
|
328
|
+
CwUAMD0xETAPBgNVBAoTCGN1Y3VtYmVyMRIwEAYDVQQLEwlDb25qdXIgQ0ExFDAS
|
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AQH/MAsGA1Ud
|
360
|
+
DwQEAwIB5jANBgkqhkiG9w0BAQsFAAOCAQEAGZT9Wek1hYluIVaxu03wSKCKIJ4p
|
361
|
+
KxTHw+mLDapg1y9t3Fa/5IQQK0Bx0xGU2qWiQKjda3vdFPJWO6l6XJvsUY5Nwtm5
|
362
|
+
Gcsk8l3L/zWCrjrFTH3TdVad5E+DTwVhThelmEjw68AyM+WuOL61j0MItd9mLW74
|
363
|
+
Lv2zouj9nQBdnUBHWQ0EL/9d5cfaCVu/bFlDfYt7Yj0IzXCuaWZfJeHodU1hmqVX
|
364
|
+
BvYRjnTB2LSxfmSnkrCeFPmhE11bWVtsLIdrGIgtEMX0/s9xg58QuNnva1U3pJsW
|
365
|
+
RjvSxre4Xg2qlI9Laybb4oZ4g6DI8hRbL0VdFAsveg6SXg2RxgJcXeJUFw==
|
366
|
+
-----END CERTIFICATE-----
|
367
|
+
"""
|
368
|
+
end
|
369
|
+
|
370
|
+
it 'adds both to the store' do
|
371
|
+
expect(store).to receive(:add_cert).twice
|
372
|
+
expect(subject).to be_truthy
|
373
|
+
end
|
374
|
+
end
|
323
375
|
end
|
324
376
|
end
|
@@ -30,6 +30,15 @@ describe RestClient::Request do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
context 'default arguments' do
|
34
|
+
let(:cache) { nil }
|
35
|
+
let(:lazy) { false }
|
36
|
+
it "sets cert_store to OpenSSL's default cert store" do
|
37
|
+
request = RestClient::Request.new(method: 'GET', url: 'http://example.com')
|
38
|
+
expect(request.ssl_opts[:cert_store]).to eq(OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
33
42
|
def reinit_mime_types!
|
34
43
|
# pretend to initialize MIME::Types from scratch
|
35
44
|
MIME::Types.instance_variable_set :@__types__, nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conjur-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.19.
|
4
|
+
version: 4.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafal Rzepecki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -261,6 +261,7 @@ files:
|
|
261
261
|
- lib/conjur/base.rb
|
262
262
|
- lib/conjur/build_from_response.rb
|
263
263
|
- lib/conjur/cast.rb
|
264
|
+
- lib/conjur/cert_utils.rb
|
264
265
|
- lib/conjur/configuration.rb
|
265
266
|
- lib/conjur/core-api.rb
|
266
267
|
- lib/conjur/deputy.rb
|
@@ -308,6 +309,7 @@ files:
|
|
308
309
|
- spec/lib/asset_spec.rb
|
309
310
|
- spec/lib/audit_spec.rb
|
310
311
|
- spec/lib/build_from_response_spec.rb
|
312
|
+
- spec/lib/cert_utils_spec.rb
|
311
313
|
- spec/lib/configuration_spec.rb
|
312
314
|
- spec/lib/deputy_spec.rb
|
313
315
|
- spec/lib/exists_spec.rb
|
@@ -376,6 +378,7 @@ test_files:
|
|
376
378
|
- spec/lib/asset_spec.rb
|
377
379
|
- spec/lib/audit_spec.rb
|
378
380
|
- spec/lib/build_from_response_spec.rb
|
381
|
+
- spec/lib/cert_utils_spec.rb
|
379
382
|
- spec/lib/configuration_spec.rb
|
380
383
|
- spec/lib/deputy_spec.rb
|
381
384
|
- spec/lib/exists_spec.rb
|