conjur-cli 4.28.1 → 4.28.2

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: 1fa1d02d354078c3b74ddc346be49d07e84681c6
4
- data.tar.gz: 1e65f0dddc2fb55dcae4afcf0cce470a89671dda
3
+ metadata.gz: 840c544d5183fcf90aa59bf7a42e6cf690607c0d
4
+ data.tar.gz: 20a2f241ec1acc83f84623faa9ea97c60803960a
5
5
  SHA512:
6
- metadata.gz: 9a30df7c0d8e0a9bd82002f9e00a43c96cb9adf054a417b4b2b1c190bede3e50799930f645cb0f34e75ac34bb1111ec4d02afdd8b0ab4088b77fcbe8bd7740dc
7
- data.tar.gz: d9bea26c97e7d92700e0082df19f04e43a2e9d1353537c5d9bf3e9172ff0b1d4877b7512f033cc0b92d3772d0fde3e86fdd521d343aa92bf4db43f3452be5ab4
6
+ metadata.gz: de5e19dcd506890c7e27276a58a5f89f00af5f8e1bb9b40cd865ba9087b41fc866995b0348d068bd3532603992323b89ee78cdd23ea0e810897540544f2a07df
7
+ data.tar.gz: 065b00d3f9ec129e5cbd2906a213ab44735456b19d0936e7417afa597c75e33034063dd20fd32cc7c3b8bb86aba635a20036ebf77c414745c1fe858d5fd7bd87
@@ -1,3 +1,6 @@
1
+ # 4.28.2
2
+ * `--collection` is now optional (with no default) for both `conjur script execute` and `conjur policy load`.
3
+
1
4
  # 4.28.1
2
5
  * Add `--collection` option for `conjur script execute`. Scripts are now portable across environments, like policies.
3
6
 
@@ -0,0 +1,5 @@
1
+ #!/bin/bash -e
2
+
3
+ bundle update
4
+ bundle exec rake jenkins
5
+ bundle exec rake build
@@ -79,6 +79,18 @@ module Conjur
79
79
  command.arg_name 'ROLE'
80
80
  command.flag [:'as-role']
81
81
  end
82
+
83
+ def collection_option command
84
+ command.desc 'An optional prefix for created roles and resources'
85
+ command.arg_name 'collection'
86
+ command.flag [:collection]
87
+ end
88
+
89
+ def context_option command
90
+ command.desc "Load context from this config file, and save it when finished. The file permissions will be 0600 by default."
91
+ command.arg_name "FILE"
92
+ command.flag [:c, :context]
93
+ end
82
94
 
83
95
  def interactive_option command
84
96
  command.arg_name 'interactive'
@@ -20,39 +20,17 @@
20
20
  #
21
21
  require 'conjur/command/dsl_command'
22
22
 
23
- require 'etc'
24
- require 'socket'
25
-
26
23
  class Conjur::Command::Policy < Conjur::DSLCommand
27
- class << self
28
- def default_collection_user
29
- # More accurate than Etc.getlogin
30
- Etc.getpwuid(Process.uid).name
31
- end
32
-
33
- def default_collection_hostname
34
- Socket.gethostname
35
- end
36
-
37
- def default_collection_name
38
- [ default_collection_user, default_collection_hostname ].join('@')
39
- end
40
- end
41
-
42
24
  desc "Manage policies"
43
25
  command :policy do |policy|
44
26
  policy.desc "Load a policy from Conjur DSL"
45
27
  policy.long_desc <<-DESC
46
- This method is EXPERIMENTAL and subject to change
47
-
48
28
  Loads a Conjur policy from DSL, applying particular conventions to the role and resource
49
29
  ids.
50
30
 
51
- The first path element of each id is the collection. Policies are separated into collections
52
- according to software development lifecycle. The default collection for a policy is $USER@$HOSTNAME,
53
- in other words, the username and hostname on which the policy is created. This is appropriate for
54
- policy development and local testing. Once tested, policies can be created in more official
55
- environments such as ci, stage, and production.
31
+ The first path element of each id is the collection. Policies can be separated into collections
32
+ according to software development lifecycle. This allows you to migrate the same policy across environments.
33
+ Often-used collection names: ci, stage, and production.
56
34
 
57
35
  The second path element of each id is the policy name and version, following the convention
58
36
  policy-x.y.z, where x, y, and z are the semantic version of the policy.
@@ -65,21 +43,19 @@ owner of the policy role is the logged-in user (you), as always.
65
43
  policy.arg_name "FILE"
66
44
  policy.command :load do |c|
67
45
  acting_as_option(c)
68
-
69
- c.desc "Policy collection, defaulting to $USER@$HOSTNAME"
70
- c.arg_name "collection"
71
- c.flag [:collection]
72
-
73
- c.desc "Load context from this config file, and save it when finished. The file permissions will be 0600 by default."
74
- c.arg_name "FILE"
75
- c.flag [:c, :context]
76
-
77
- c.action do |global_options,options,args|
78
- collection = options[:collection] || default_collection_name
79
-
80
- run_script args, options do |runner, &block|
81
- runner.scope collection do
82
- block.call
46
+ collection_option(c)
47
+ context_option(c)
48
+
49
+ c.action do |_, options, args|
50
+ collection = options[:collection]
51
+
52
+ if collection.nil?
53
+ run_script args, options
54
+ else
55
+ run_script args, options do |runner, &block|
56
+ runner.scope collection do
57
+ block.call
58
+ end
83
59
  end
84
60
  end
85
61
  end
@@ -20,48 +20,26 @@
20
20
  #
21
21
  require 'conjur/command/dsl_command'
22
22
 
23
- require 'etc'
24
- require 'socket'
25
-
26
23
  class Conjur::Command::Script < Conjur::DSLCommand
27
- class << self
28
- def default_collection_user
29
- # More accurate than Etc.getlogin
30
- Etc.getpwuid(Process.uid).name
31
- end
32
-
33
- def default_collection_hostname
34
- Socket.gethostname
35
- end
36
-
37
- def default_collection_name
38
- [ default_collection_user, default_collection_hostname ].join('@')
39
- end
40
- end
41
-
42
24
  desc "Execute Conjur DSL scripts"
43
25
  command :script do |script|
44
26
  script.desc "Run a Conjur DSL script"
45
27
  script.arg_name "script"
46
28
  script.command :execute do |c|
47
29
  acting_as_option(c)
48
-
49
- c.desc "Script collection (target environment)"
50
- c.arg_name "collection"
51
- c.default_value default_collection_name
52
- c.flag [:collection]
53
-
54
-
55
- c.desc "Load context from this config file, and save it when finished. The file permissions will be 0600 by default."
56
- c.arg_name "FILE"
57
- c.flag [:c, :context]
58
-
59
- c.action do |global_options,options,args|
60
- collection = options[:collection] || default_collection_name
61
-
62
- run_script args, options do |runner, &block|
63
- runner.scope collection do
64
- block.call
30
+ collection_option(c)
31
+ context_option(c)
32
+
33
+ c.action do |_, options, args|
34
+ collection = options[:collection]
35
+
36
+ if collection.nil?
37
+ run_script args, options
38
+ else
39
+ run_script args, options do |runner, &block|
40
+ runner.scope collection do
41
+ block.call
42
+ end
65
43
  end
66
44
  end
67
45
  end
@@ -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.28.1"
22
+ VERSION = "4.28.2"
23
23
  ::Version=VERSION
24
24
  end
@@ -2,18 +2,6 @@ require 'spec_helper'
2
2
  require 'conjur/dsl/runner'
3
3
 
4
4
  describe Conjur::Command::Policy do
5
- describe ".default_collection_user" do
6
- it "returns the current username" do
7
- expect(Conjur::Command::Policy.default_collection_user).to eq(`whoami`.strip)
8
- end
9
- end
10
-
11
- describe ".default_collection_hostname" do
12
- it "returns the current hostname" do
13
- expect(Conjur::Command::Policy.default_collection_hostname).to eq(`hostname`.strip)
14
- end
15
- end
16
-
17
5
  context "when logged in", logged_in: true do
18
6
  let(:role) do
19
7
  double("role", exists?: true, api_key: "the-api-key", roleid: "the-role")
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.28.1
4
+ version: 4.28.2
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-11-24 00:00:00.000000000 Z
12
+ date: 2015-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -377,6 +377,7 @@ files:
377
377
  - features/support/hooks.rb
378
378
  - features/support/host.json
379
379
  - features/support/world.rb
380
+ - jenkins.sh
380
381
  - lib/conjur.rb
381
382
  - lib/conjur/audit/follower.rb
382
383
  - lib/conjur/authn.rb