conjur-cli 4.21.0 → 4.21.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c37f9ccccef777e9cc90ab9dd9d83c167f59e8f
4
- data.tar.gz: 00970eef162d3ff5f69b09bff7196234e61dfe97
3
+ metadata.gz: 42c5699c45672978a67be3e037c53b212fb232d3
4
+ data.tar.gz: 4288dda53317d3fe79ea7d255d12cf21681a2abf
5
5
  SHA512:
6
- metadata.gz: 538be1cde61f32cfe2db688d7bb399a9f44e85ca6e75ea1327e2a15cb1a1eade78a0265512b89a53fa2b9ef333828bc471c48ca18a23228fbe817d23abd8c4d9
7
- data.tar.gz: bd3c351d0493ff5a2bbccbd5b510a76c4f28b3c3225da8c62de87f34b287ec332f7c43622be241fbdc6cf71e942e6d8408b64afacefd644f2785a465efb1781f
6
+ metadata.gz: 48ef1a3766bcabca227c830c2801ded50ba83870e53d01e559a663fea813d078c42cb69c1316a227b000db10790ce8a2f91d1d31b98cf67002a83211e23d0e80
7
+ data.tar.gz: 43c0a98e20cc612567e74929856428dd7004615d5f33fb5c2176d7c0328fd6827c5ac87f4997be839f2f566593908deafdc8ccb898de4889bf2ba419633b3a7a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 4.21.1
2
+
3
+ * Configure trust to the new certificate in `conjur init`, before attempting to contact the Conjur server
4
+
1
5
  # 4.21.0
2
6
 
3
7
  * Use user cache dir for mimetype cache
@@ -53,12 +53,12 @@ class Conjur::Command::Bootstrap < Conjur::Command
53
53
  puts "Adminship granted"
54
54
  end
55
55
 
56
- if (attic = api.user("attic")).exists?
57
- puts "User 'attic' exists"
58
- else
59
- puts "Creating user 'attic'"
60
- attic = api.create_user("attic")
61
- end
56
+ if (attic = api.user("attic")).exists?
57
+ puts "User 'attic' exists"
58
+ else
59
+ puts "Creating user 'attic'"
60
+ attic = api.create_user("attic")
61
+ end
62
62
  end
63
63
  end
64
64
  end
@@ -61,14 +61,6 @@ class Conjur::Command::Init < Conjur::Command
61
61
  Conjur.configuration.core_url = "https://#{hostname}/api"
62
62
  end
63
63
 
64
- account = options[:account]
65
- account ||= if hostname
66
- account = Conjur::Core::API.info['account'] or raise "Expecting 'account' in Core info"
67
- else
68
- # using .to_s to overcome https://github.com/JEG2/highline/issues/69
69
- highline.ask("Enter your organization account name: ").to_s
70
- end
71
-
72
64
  if (certificate = options[:certificate]).blank?
73
65
  unless hostname.blank?
74
66
  connect_hostname = if hostname.include?(':')
@@ -86,6 +78,16 @@ class Conjur::Command::Init < Conjur::Command
86
78
  exit_now! "You decided not to trust the certificate" unless highline.ask("Trust this certificate (yes/no): ").strip == "yes"
87
79
  end
88
80
  end
81
+
82
+ configure_cert_store certificate
83
+
84
+ account = options[:account]
85
+ account ||= if hostname
86
+ account = Conjur::Core::API.info['account'] or raise "Expecting 'account' in Core info"
87
+ else
88
+ # using .to_s to overcome https://github.com/JEG2/highline/issues/69
89
+ highline.ask("Enter your organization account name: ").to_s
90
+ end
89
91
 
90
92
  exit_now! "account is required" if account.blank?
91
93
 
@@ -120,7 +122,15 @@ class Conjur::Command::Init < Conjur::Command
120
122
  puts "Wrote configuration to #{config_file}"
121
123
  end
122
124
  end
123
-
125
+
126
+ def self.configure_cert_store certificate
127
+ unless certificate.blank?
128
+ cert_file = Tempfile.new("conjur_cert")
129
+ File.write cert_file.path, certificate
130
+ OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE.add_file cert_file.path
131
+ end
132
+ end
133
+
124
134
  def self.get_certificate connect_hostname
125
135
  include OpenSSL::SSL
126
136
  host, port = connect_hostname.split ':'
@@ -19,6 +19,6 @@
19
19
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  #
21
21
  module Conjur
22
- VERSION = "4.21.0"
22
+ VERSION = "4.21.1"
23
23
  ::Version=VERSION
24
24
  end
@@ -83,25 +83,10 @@ describe Conjur::Command::Init do
83
83
  end
84
84
  end
85
85
 
86
- # KEG: These tests have a nasty habit of hanging
87
- # describe_command 'init -a the-account -h google.com' do
88
- # it "writes the config and cert" do
89
- # HighLine.any_instance.stub(:ask).and_return "yes"
90
- # File.should_receive(:open).twice
91
- # invoke
92
- # end
93
- # end
94
- # describe_command 'init -a the-account -h https://google.com' do
95
- # it "writes the config and cert" do
96
- # HighLine.any_instance.stub(:ask).and_return "yes"
97
- # File.should_receive(:open).twice
98
- # invoke
99
- # end
100
- # end
101
-
102
86
  describe_command 'init -a the-account -h localhost -c the-cert' do
103
87
  it "writes config and cert files" do
104
88
  expect(File).to receive(:open).twice
89
+ expect(Conjur::Command::Init).to receive(:configure_cert_store).with "the-cert"
105
90
  invoke
106
91
  end
107
92
  end
data/spec/spec_helper.rb CHANGED
@@ -29,6 +29,7 @@ require 'conjur/command/rspec/helpers'
29
29
  ENV['CONJURRC'] = '/dev/null'
30
30
 
31
31
  require 'conjur/cli'
32
+ require 'conjur/api'
32
33
 
33
34
  shared_context "fresh config" do
34
35
  before {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.0
4
+ version: 4.21.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-04-07 00:00:00.000000000 Z
12
+ date: 2015-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport