conjur-cli 4.18.0 → 4.18.6
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 +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +23 -2
- data/Rakefile +1 -1
- data/bin/_conjur_completions.yaml +5 -0
- data/conjur.gemspec +4 -4
- data/features/conjurize.feature +8 -5
- data/features/dsl_user_create.feature +1 -1
- data/features/step_definitions/dsl_steps.rb +3 -1
- data/features/support/hooks.rb +4 -0
- data/lib/conjur/authn.rb +15 -2
- data/lib/conjur/cli.rb +5 -0
- data/lib/conjur/command/authn.rb +3 -2
- data/lib/conjur/command/env.rb +3 -4
- data/lib/conjur/command/init.rb +12 -8
- data/lib/conjur/conjurize.rb +25 -16
- data/lib/conjur/version.rb +1 -1
- data/spec/authn_spec.rb +21 -13
- data/spec/command/authn_spec.rb +10 -0
- data/spec/command/init_spec.rb +1 -0
- metadata +10 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48872bafebcf0d1adecc8364f839bd7318839c14
|
|
4
|
+
data.tar.gz: 523c5883db7eb7faf4afad5f31543e8629490685
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e00e1a4898d768816840ee41887b5ed59f6d3fa68d3bf1677ff0ce9388c88bb844b476581bf64e076b903b5fe6c7822047f30e68416d7fe789da7afbc85928aa
|
|
7
|
+
data.tar.gz: 018110603af0cda168cc4bc7d525fd12cf8e3332135abd2c73013bfaa7cacbf27ca471e8ae1b3ef83dc22a5daaf3faab144fb0c074c14a291af0bbdf2856f0b9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
# 4.18.5
|
|
2
|
+
|
|
3
|
+
* Bump conjur-api version to mime-types problem
|
|
4
|
+
|
|
5
|
+
# 4.18.4
|
|
6
|
+
|
|
7
|
+
* Revert "Find (and store) credentials by only a hostname as the machine in netrc"
|
|
8
|
+
|
|
9
|
+
# 4.18.3
|
|
10
|
+
|
|
11
|
+
* Use the latest conjur-ssh cookbook version for conjurize
|
|
12
|
+
|
|
13
|
+
# 4.18.2
|
|
14
|
+
|
|
15
|
+
* Require a recent version of netrc
|
|
16
|
+
* Complain if netrc is world readable
|
|
17
|
+
* Find (and store) credentials by only a hostname as the machine in netrc
|
|
18
|
+
* Make the command start up faster by lazy loading some gems
|
|
19
|
+
* `authn whoami` will notice if the user is logged in via env vars
|
|
20
|
+
* `conjurize` default conjur-ssh cookbook updated to 1.2.2
|
|
21
|
+
|
|
1
22
|
# 4.18.0
|
|
2
23
|
|
|
3
|
-
* New `conjurize` command
|
|
24
|
+
* New `conjurize` command
|
|
4
25
|
* Deprecate the `host enroll` command
|
|
5
26
|
* `variable create` command now takes an optional value for the variable after the variable id
|
|
6
27
|
* Configure "permissive" netrc to allow the `conjur` Unix group to read the `.netrc` or `conjur.identity` file.
|
|
@@ -14,7 +35,7 @@
|
|
|
14
35
|
# 4.16.0
|
|
15
36
|
|
|
16
37
|
* Add 'bootstrap' CLI command
|
|
17
|
-
* Raise a better error if conjur env encounters a variable with no value
|
|
38
|
+
* Raise a better error if conjur env encounters a variable with no value
|
|
18
39
|
|
|
19
40
|
# 4.15.0
|
|
20
41
|
|
data/Rakefile
CHANGED
|
@@ -11,7 +11,7 @@ Cucumber::Rake::Task.new :features
|
|
|
11
11
|
|
|
12
12
|
task :jenkins => ['ci:setup:rspec', :spec, 'ci:setup:cucumber_report_cleanup'] do
|
|
13
13
|
Cucumber::Rake::Task.new do |t|
|
|
14
|
-
t.cucumber_opts = "--format CI::Reporter::Cucumber"
|
|
14
|
+
t.cucumber_opts = "--format progress --format CI::Reporter::Cucumber --out features/reports"
|
|
15
15
|
end.runner.run
|
|
16
16
|
File.write('build_number', ENV['BUILD_NUMBER']) if ENV['BUILD_NUMBER']
|
|
17
17
|
end
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
:authenticate: true
|
|
18
18
|
:logout: true
|
|
19
19
|
:whoami: true
|
|
20
|
+
:bootstrap: true
|
|
20
21
|
:env:
|
|
21
22
|
:run: true
|
|
22
23
|
:check: true
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
:create: true
|
|
27
28
|
:list: true
|
|
28
29
|
:show: true
|
|
30
|
+
:retire: true
|
|
29
31
|
:members:
|
|
30
32
|
:list: true
|
|
31
33
|
:add: true
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
:host:
|
|
34
36
|
:create: true
|
|
35
37
|
:show: true
|
|
38
|
+
:retire: true
|
|
36
39
|
:list: true
|
|
37
40
|
:enroll: true
|
|
38
41
|
:layers: true
|
|
@@ -85,6 +88,7 @@
|
|
|
85
88
|
:user:
|
|
86
89
|
:create: true
|
|
87
90
|
:show: true
|
|
91
|
+
:retire: true
|
|
88
92
|
:list: true
|
|
89
93
|
:update_password: true
|
|
90
94
|
:update: true
|
|
@@ -92,6 +96,7 @@
|
|
|
92
96
|
:variable:
|
|
93
97
|
:create: true
|
|
94
98
|
:show: true
|
|
99
|
+
:retire: true
|
|
95
100
|
:list: true
|
|
96
101
|
:values:
|
|
97
102
|
:add: true
|
data/conjur.gemspec
CHANGED
|
@@ -17,15 +17,15 @@ Gem::Specification.new do |gem|
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
gem.add_dependency 'activesupport'
|
|
20
|
-
gem.add_dependency 'conjur-api', '
|
|
20
|
+
gem.add_dependency 'conjur-api', '~> 4.11.2'
|
|
21
21
|
gem.add_dependency 'gli', '>=2.8.0'
|
|
22
22
|
gem.add_dependency 'highline'
|
|
23
|
-
gem.add_dependency 'netrc'
|
|
23
|
+
gem.add_dependency 'netrc', '~> 0.10.2'
|
|
24
24
|
gem.add_dependency 'methadone'
|
|
25
25
|
gem.add_dependency 'deep_merge'
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
gem.add_runtime_dependency 'cas_rest_client'
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
gem.add_development_dependency 'rspec', '~> 3.0'
|
|
30
30
|
gem.add_development_dependency 'simplecov'
|
|
31
31
|
gem.add_development_dependency 'aruba', '~> 0.6.1'
|
data/features/conjurize.feature
CHANGED
|
@@ -58,10 +58,10 @@ CONJUR_IDENTITY
|
|
|
58
58
|
chmod 0600 /etc/conjur.identity
|
|
59
59
|
|
|
60
60
|
"""
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
Scenario: conjurize with SSH installation
|
|
63
63
|
When I conjurize "--ssh"
|
|
64
|
-
Then the stdout should contain
|
|
64
|
+
Then the stdout should contain:
|
|
65
65
|
"""
|
|
66
66
|
#!/bin/sh
|
|
67
67
|
set -e
|
|
@@ -108,14 +108,17 @@ CONJUR_IDENTITY
|
|
|
108
108
|
chmod 0600 /etc/conjur.identity
|
|
109
109
|
|
|
110
110
|
curl -L https://www.opscode.com/chef/install.sh | bash
|
|
111
|
-
chef-solo -r https://github.com/conjur-cookbooks/conjur-ssh/releases/download/v1.2.0/conjur-ssh-v1.2.0.tar.gz -o conjur-ssh
|
|
112
111
|
|
|
113
112
|
"""
|
|
113
|
+
And the output should match:
|
|
114
|
+
"""
|
|
115
|
+
chef-solo -r https:\/\/github.com\/conjur-cookbooks\/conjur-ssh\/releases\/download/v\d\.\d\.\d/conjur-ssh-v\d\.\d\.\d.tar.gz -o conjur-ssh
|
|
116
|
+
"""
|
|
114
117
|
|
|
115
118
|
Scenario: conjurize with arbitrary cookbook
|
|
116
119
|
When I conjurize "--conjur-cookbook-url https://example.com --conjur-run-list fry"
|
|
117
120
|
Then the stdout should contain "chef-solo -r https://example.com -o fry"
|
|
118
|
-
|
|
121
|
+
|
|
119
122
|
Scenario: conjurize with path to chef-solo
|
|
120
123
|
When I conjurize "--chef-executable /path/to/chef-solo --conjur-cookbook-url https://example.com --conjur-run-list fry"
|
|
121
124
|
Then the stdout should contain "/path/to/chef-solo -r https://example.com -o fry"
|
|
@@ -128,4 +131,4 @@ chef-solo -r https://github.com/conjur-cookbooks/conjur-ssh/releases/download/v1
|
|
|
128
131
|
And the stdout should contain "sudo -n tee /etc/conjur.identity > /dev/null << CONJUR_IDENTITY"
|
|
129
132
|
And the stdout should contain "sudo -n chmod 0600 /etc/conjur.identity"
|
|
130
133
|
And the stdout should contain "curl -L https://www.opscode.com/chef/install.sh | sudo -n bash"
|
|
131
|
-
|
|
134
|
+
|
|
@@ -12,7 +12,9 @@ end
|
|
|
12
12
|
Then(/^the model should contain "(.*?)" "(.*?)"$/) do |kind, id|
|
|
13
13
|
@mock_api.thing(kind, id).should_not be_nil
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
Then(/^the model should contain "(.*?)" \/(.*?)\/$/) do |kind, id|
|
|
16
|
+
@mock_api.thing_like(kind, Regexp.new(id)).should_not be_nil
|
|
17
|
+
end
|
|
16
18
|
Then(/^the "(.*?)" "(.*?)" should be owned by "(.*?)"$/) do |kind, id, owner|
|
|
17
19
|
step "the model should contain \"#{kind}\" \"#{id}\""
|
|
18
20
|
@mock_api.thing(kind, id).ownerid.should == owner
|
data/features/support/hooks.rb
CHANGED
|
@@ -11,6 +11,10 @@ class MockAPI
|
|
|
11
11
|
(@things[kind.to_sym] || []).find{|r| r.id == id}
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
def thing_like(kind, id_pattern)
|
|
15
|
+
(@things[kind.to_sym] || []).find{|r| id_pattern.match(r.id)}
|
|
16
|
+
end
|
|
17
|
+
|
|
14
18
|
def create_host(options = {})
|
|
15
19
|
id = options.delete(:id)
|
|
16
20
|
if id
|
data/lib/conjur/authn.rb
CHANGED
|
@@ -28,6 +28,12 @@ Netrc.configure do |config|
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
module Conjur::Authn
|
|
31
|
+
class NoCredentialsError < RuntimeError
|
|
32
|
+
def initialize
|
|
33
|
+
super "No Conjur credentials provided or found"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
31
37
|
autoload :API, 'conjur/authn-api'
|
|
32
38
|
class << self
|
|
33
39
|
def login(options = {})
|
|
@@ -50,11 +56,18 @@ module Conjur::Authn
|
|
|
50
56
|
end
|
|
51
57
|
|
|
52
58
|
def netrc
|
|
59
|
+
@netrc ||= read_netrc
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def read_netrc
|
|
53
63
|
args = []
|
|
54
64
|
if path = Conjur::Config[:netrc_path]
|
|
55
65
|
args.unshift(path)
|
|
66
|
+
else
|
|
67
|
+
path = Netrc.default_path
|
|
56
68
|
end
|
|
57
|
-
|
|
69
|
+
fail "netrc (#{path}) shouldn't be world-readable" if File.world_readable?(path)
|
|
70
|
+
Netrc.read(*args)
|
|
58
71
|
end
|
|
59
72
|
|
|
60
73
|
def get_credentials(options = {})
|
|
@@ -85,7 +98,7 @@ module Conjur::Authn
|
|
|
85
98
|
end
|
|
86
99
|
|
|
87
100
|
def ask_for_credentials(options = {})
|
|
88
|
-
raise
|
|
101
|
+
raise NoCredentialsError if options[:noask]
|
|
89
102
|
|
|
90
103
|
# also use stderr here, because we might be prompting for a password as part
|
|
91
104
|
# of a command like user:create that we'd want to send to a file.
|
data/lib/conjur/cli.rb
CHANGED
|
@@ -22,7 +22,12 @@ require 'gli'
|
|
|
22
22
|
# need this to prevent an active support bug in some versions
|
|
23
23
|
require 'active_support'
|
|
24
24
|
require 'active_support/deprecation'
|
|
25
|
+
require 'tmpdir'
|
|
25
26
|
|
|
27
|
+
# this makes mime/types gem load much faster by lazy loading
|
|
28
|
+
# mime types and caching them in binary form
|
|
29
|
+
ENV['RUBY_MIME_TYPES_LAZY_LOAD'] ||= 'true'
|
|
30
|
+
ENV['RUBY_MIME_TYPES_CACHE'] ||= File.join Dir.tmpdir, 'conjur.mimetype.cache'
|
|
26
31
|
|
|
27
32
|
module Conjur
|
|
28
33
|
autoload :Config, 'conjur/config'
|
data/lib/conjur/command/authn.rb
CHANGED
|
@@ -86,9 +86,10 @@ It should be running the CAS RESTful services at the /v1 path
|
|
|
86
86
|
authn.desc "Prints out the current logged in username"
|
|
87
87
|
authn.command :whoami do |c|
|
|
88
88
|
c.action do
|
|
89
|
-
|
|
89
|
+
begin
|
|
90
|
+
creds = Conjur::Authn.get_credentials(noask: true)
|
|
90
91
|
puts({account: Conjur::Core::API.conjur_account, username: creds[0]}.to_json)
|
|
91
|
-
|
|
92
|
+
rescue Conjur::Authn::NoCredentialsError
|
|
92
93
|
exit_now! 'Not logged in.', -1
|
|
93
94
|
end
|
|
94
95
|
end
|
data/lib/conjur/command/env.rb
CHANGED
|
@@ -17,10 +17,7 @@
|
|
|
17
17
|
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
18
18
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
19
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
#require 'conjur/authn'
|
|
22
|
-
#require 'conjur/command'
|
|
23
|
-
require 'conjur/conjurenv'
|
|
20
|
+
|
|
24
21
|
require 'tempfile'
|
|
25
22
|
|
|
26
23
|
class Conjur::Command::Env < Conjur::Command
|
|
@@ -41,6 +38,8 @@ class Conjur::Command::Env < Conjur::Command
|
|
|
41
38
|
end
|
|
42
39
|
|
|
43
40
|
def self.get_env_object options
|
|
41
|
+
require 'conjur/conjurenv'
|
|
42
|
+
|
|
44
43
|
if options[:yaml] and options[:c]!='.conjurenv'
|
|
45
44
|
exit_now! "Options -c and --yaml can not be provided together"
|
|
46
45
|
end
|
data/lib/conjur/command/init.rb
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
19
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
#
|
|
21
|
-
require 'highline'
|
|
22
21
|
require 'conjur/command'
|
|
23
22
|
require 'openssl'
|
|
24
23
|
require 'socket'
|
|
@@ -29,8 +28,7 @@ class Conjur::Command::Init < Conjur::Command
|
|
|
29
28
|
def self.write_file(filename, force, &block)
|
|
30
29
|
if File.exists?(filename)
|
|
31
30
|
unless force
|
|
32
|
-
|
|
33
|
-
force = true if hl.ask("File #{filename} exists. Overwrite (yes/no): ").strip == "yes"
|
|
31
|
+
force = true if highline.ask("File #{filename} exists. Overwrite (yes/no): ").strip == "yes"
|
|
34
32
|
end
|
|
35
33
|
exit_now! "Not overwriting #{filename}" unless force
|
|
36
34
|
end
|
|
@@ -56,9 +54,7 @@ class Conjur::Command::Init < Conjur::Command
|
|
|
56
54
|
c.flag "force"
|
|
57
55
|
|
|
58
56
|
c.action do |global_options,options,args|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
hostname = options[:hostname] || hl.ask("Enter the hostname (and optional port) of your Conjur endpoint: ").to_s
|
|
57
|
+
hostname = options[:hostname] || highline.ask("Enter the hostname (and optional port) of your Conjur endpoint: ").to_s
|
|
62
58
|
protocol, hostname = (hostname.scan %r(^(?:(.*)://)?(.*))).first
|
|
63
59
|
exit_now! "only https protocol supported" unless protocol.nil? || protocol == 'https'
|
|
64
60
|
if hostname
|
|
@@ -70,7 +66,7 @@ class Conjur::Command::Init < Conjur::Command
|
|
|
70
66
|
account = Conjur::Core::API.info['account'] or raise "Expecting 'account' in Core info"
|
|
71
67
|
else
|
|
72
68
|
# using .to_s to overcome https://github.com/JEG2/highline/issues/69
|
|
73
|
-
|
|
69
|
+
highline.ask("Enter your organization account name: ").to_s
|
|
74
70
|
end
|
|
75
71
|
|
|
76
72
|
if (certificate = options[:certificate]).blank?
|
|
@@ -87,7 +83,7 @@ class Conjur::Command::Init < Conjur::Command
|
|
|
87
83
|
|
|
88
84
|
puts "\nPlease verify this certificate on the appliance using command:
|
|
89
85
|
openssl x509 -fingerprint -noout -in ~conjur/etc/ssl/conjur.pem\n\n"
|
|
90
|
-
exit_now! "You decided not to trust the certificate" unless
|
|
86
|
+
exit_now! "You decided not to trust the certificate" unless highline.ask("Trust this certificate (yes/no): ").strip == "yes"
|
|
91
87
|
end
|
|
92
88
|
end
|
|
93
89
|
|
|
@@ -146,4 +142,12 @@ class Conjur::Command::Init < Conjur::Command
|
|
|
146
142
|
ssock.close if ssock
|
|
147
143
|
sock.close if sock
|
|
148
144
|
end
|
|
145
|
+
|
|
146
|
+
private
|
|
147
|
+
|
|
148
|
+
def self.highline
|
|
149
|
+
# isolated here so that highline is only loaded on demand
|
|
150
|
+
require 'highline'
|
|
151
|
+
@hl ||= HighLine.new $stdin, $stderr
|
|
152
|
+
end
|
|
149
153
|
end
|
data/lib/conjur/conjurize.rb
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
require 'methadone'
|
|
2
2
|
require 'json'
|
|
3
|
+
require 'open-uri'
|
|
3
4
|
require 'conjur/version.rb'
|
|
4
5
|
|
|
6
|
+
def latest_conjur_ssh_release
|
|
7
|
+
url = 'https://api.github.com/repos/conjur-cookbooks/conjur-ssh/releases'
|
|
8
|
+
resp = open(url)
|
|
9
|
+
json = JSON.parse(resp.read)
|
|
10
|
+
latest = json[0]['assets'].select {|asset| asset['name'] =~ /conjur-ssh-v\d.\d.\d.tar.gz/}[0]
|
|
11
|
+
latest['browser_download_url']
|
|
12
|
+
end
|
|
13
|
+
|
|
5
14
|
module Conjur
|
|
6
15
|
class Conjurize
|
|
7
16
|
include Methadone::Main
|
|
8
17
|
include Methadone::CLILogging
|
|
9
|
-
|
|
18
|
+
|
|
10
19
|
description <<-DESC
|
|
11
20
|
Generate a script to install Conjur onto a machine. "conjurize" is designed to be used
|
|
12
21
|
in a piped execution, along with "conjur host create" and "ssh". For example:
|
|
@@ -15,7 +24,7 @@ conjur host create myhost.example.com | tee host.json | conjurize --ssh | ssh my
|
|
|
15
24
|
DESC
|
|
16
25
|
|
|
17
26
|
version Conjur::VERSION
|
|
18
|
-
|
|
27
|
+
|
|
19
28
|
main do
|
|
20
29
|
input = if input_file = options[:f]
|
|
21
30
|
File.read(input_file)
|
|
@@ -23,10 +32,10 @@ DESC
|
|
|
23
32
|
STDIN.read
|
|
24
33
|
end
|
|
25
34
|
host = JSON.parse input
|
|
26
|
-
|
|
35
|
+
|
|
27
36
|
login = host['id'] or raise "No 'id' field in host JSON"
|
|
28
37
|
api_key = host['api_key'] or raise "No 'api_key' field in host JSON"
|
|
29
|
-
|
|
38
|
+
|
|
30
39
|
require 'conjur/cli'
|
|
31
40
|
if conjur_config = options[:c]
|
|
32
41
|
Conjur::Config.load [ conjur_config ]
|
|
@@ -34,29 +43,29 @@ DESC
|
|
|
34
43
|
Conjur::Config.load
|
|
35
44
|
end
|
|
36
45
|
Conjur::Config.apply
|
|
37
|
-
|
|
46
|
+
|
|
38
47
|
conjur_cookbook_url = conjur_run_list = nil
|
|
39
|
-
|
|
48
|
+
|
|
40
49
|
conjur_run_list = options[:"conjur-run-list"]
|
|
41
50
|
conjur_cookbook_url = options[:"conjur-cookbook-url"]
|
|
42
51
|
chef_executable = options[:"chef-executable"]
|
|
43
|
-
|
|
52
|
+
|
|
44
53
|
if options[:ssh]
|
|
45
54
|
conjur_run_list ||= "conjur-ssh"
|
|
46
|
-
conjur_cookbook_url ||=
|
|
55
|
+
conjur_cookbook_url ||= latest_conjur_ssh_release()
|
|
47
56
|
end
|
|
48
|
-
|
|
49
|
-
sudo = lambda{|str|
|
|
57
|
+
|
|
58
|
+
sudo = lambda{|str|
|
|
50
59
|
[ options[:sudo] ? "sudo -n" : nil, str ].compact.join(" ")
|
|
51
60
|
}
|
|
52
|
-
|
|
61
|
+
|
|
53
62
|
header = <<-HEADER
|
|
54
63
|
#!/bin/sh
|
|
55
64
|
set -e
|
|
56
65
|
|
|
57
66
|
# Implementation note: 'tee' is used as a sudo-friendly 'cat' to populate a file with the contents provided below.
|
|
58
67
|
HEADER
|
|
59
|
-
|
|
68
|
+
|
|
60
69
|
configure_conjur = <<-CONFIGURE
|
|
61
70
|
#{sudo.call 'tee'} /etc/conjur.conf > /dev/null << CONJUR_CONF
|
|
62
71
|
account: #{Conjur.configuration.account}
|
|
@@ -77,13 +86,13 @@ machine #{Conjur.configuration.appliance_url}/authn
|
|
|
77
86
|
CONJUR_IDENTITY
|
|
78
87
|
#{sudo.call 'chmod'} 0600 /etc/conjur.identity
|
|
79
88
|
CONFIGURE
|
|
80
|
-
|
|
89
|
+
|
|
81
90
|
install_chef = if conjur_cookbook_url && !chef_executable
|
|
82
91
|
%Q(curl -L https://www.opscode.com/chef/install.sh | #{sudo.call 'bash'})
|
|
83
92
|
else
|
|
84
93
|
nil
|
|
85
94
|
end
|
|
86
|
-
|
|
95
|
+
|
|
87
96
|
chef_executable ||= "chef-solo"
|
|
88
97
|
|
|
89
98
|
run_chef = if conjur_cookbook_url
|
|
@@ -91,10 +100,10 @@ CONJUR_IDENTITY
|
|
|
91
100
|
else
|
|
92
101
|
nil
|
|
93
102
|
end
|
|
94
|
-
|
|
103
|
+
|
|
95
104
|
puts [ header, configure_conjur, install_chef, run_chef ].compact.join("\n")
|
|
96
105
|
end
|
|
97
|
-
|
|
106
|
+
|
|
98
107
|
on("-c CONJUR_CONFIG_FILE", "Overrides defaults (CONJURRC env var, ~/.conjurrc, /etc/conjur.conf).")
|
|
99
108
|
on("-f HOST_JSON_FILE", "Host login and API key can be read from the output emitted from 'conjur host create'. This data can be obtained from stdin, or from a file.")
|
|
100
109
|
on("--chef-executable PATH", "If specified, the designated chef-solo executable is used, otherwise Chef is installed on the target machine.")
|
data/lib/conjur/version.rb
CHANGED
data/spec/authn_spec.rb
CHANGED
|
@@ -2,38 +2,46 @@ require 'conjur/authn'
|
|
|
2
2
|
require 'conjur/config'
|
|
3
3
|
|
|
4
4
|
describe Conjur::Authn do
|
|
5
|
+
let(:netrc) { Netrc.read '' }
|
|
6
|
+
before do
|
|
7
|
+
Conjur::Authn.instance_variable_set("@netrc", netrc)
|
|
8
|
+
end
|
|
9
|
+
|
|
5
10
|
describe "credentials from environment" do
|
|
6
|
-
before
|
|
11
|
+
before do
|
|
7
12
|
Conjur::Authn.instance_variable_set("@credentials", nil)
|
|
8
13
|
expect(ENV).to receive(:[]).with("CONJUR_AUTHN_LOGIN").and_return "the-login"
|
|
9
14
|
expect(ENV).to receive(:[]).with("CONJUR_AUTHN_API_KEY").and_return "the-api-key"
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
after do
|
|
12
18
|
Conjur::Authn.instance_variable_set("@credentials", nil)
|
|
13
|
-
|
|
19
|
+
end
|
|
20
|
+
|
|
14
21
|
it "are used to authn" do
|
|
15
22
|
expect(Conjur::Authn.get_credentials).to eq([ "the-login", "the-api-key" ])
|
|
16
23
|
end
|
|
24
|
+
|
|
17
25
|
it "are not written to netrc" do
|
|
18
|
-
|
|
26
|
+
expect(Conjur::Authn).not_to receive(:write_credentials)
|
|
19
27
|
Conjur::Authn.get_credentials
|
|
20
28
|
end
|
|
21
29
|
end
|
|
30
|
+
|
|
22
31
|
describe "netrc" do
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Conjur::Authn.instance_variable_set("@netrc", nil)
|
|
29
|
-
}
|
|
32
|
+
let(:netrc) { nil }
|
|
33
|
+
before do
|
|
34
|
+
allow(Conjur::Config).to receive(:[]).with(:netrc_path).and_return path
|
|
35
|
+
end
|
|
36
|
+
|
|
30
37
|
context "with specified netrc_path" do
|
|
31
|
-
let(:path) {
|
|
38
|
+
let(:path) { "/a/dummy/netrc/path" }
|
|
32
39
|
it "consults Conjur::Config for netrc_path" do
|
|
33
40
|
expect(Netrc).to receive(:read).with(path).and_return netrc = double("netrc")
|
|
34
41
|
expect(Conjur::Authn.netrc).to eq(netrc)
|
|
35
42
|
end
|
|
36
43
|
end
|
|
44
|
+
|
|
37
45
|
context "without specified netrc_path" do
|
|
38
46
|
let(:path) { nil }
|
|
39
47
|
it "uses default netrc path" do
|
data/spec/command/authn_spec.rb
CHANGED
|
@@ -44,6 +44,16 @@ describe Conjur::Command::Authn do
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
|
+
|
|
48
|
+
context "when login credentials are available in the environment" do
|
|
49
|
+
before do
|
|
50
|
+
expect(ENV).to receive(:[]).with("CONJUR_AUTHN_LOGIN").and_return username
|
|
51
|
+
expect(ENV).to receive(:[]).with("CONJUR_AUTHN_API_KEY").and_return 'the-password'
|
|
52
|
+
it "prints the current account and username to stdout" do
|
|
53
|
+
expect { invoke }.to write({ account: account, username: username }.to_json)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
47
57
|
|
|
48
58
|
context "when logged in", logged_in: true do
|
|
49
59
|
describe_command 'authn:logout' do
|
data/spec/command/init_spec.rb
CHANGED
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.18.
|
|
4
|
+
version: 4.18.6
|
|
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:
|
|
12
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -29,16 +29,16 @@ dependencies:
|
|
|
29
29
|
name: conjur-api
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
|
-
- -
|
|
32
|
+
- - ~>
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: 4.11.
|
|
34
|
+
version: 4.11.2
|
|
35
35
|
type: :runtime
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- -
|
|
39
|
+
- - ~>
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: 4.11.
|
|
41
|
+
version: 4.11.2
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: gli
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -71,16 +71,16 @@ dependencies:
|
|
|
71
71
|
name: netrc
|
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
|
73
73
|
requirements:
|
|
74
|
-
- -
|
|
74
|
+
- - ~>
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version:
|
|
76
|
+
version: 0.10.2
|
|
77
77
|
type: :runtime
|
|
78
78
|
prerelease: false
|
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
|
81
|
-
- -
|
|
81
|
+
- - ~>
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version:
|
|
83
|
+
version: 0.10.2
|
|
84
84
|
- !ruby/object:Gem::Dependency
|
|
85
85
|
name: methadone
|
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|