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 +4 -4
- data/CHANGELOG.md +3 -0
- data/jenkins.sh +5 -0
- data/lib/conjur/command.rb +12 -0
- data/lib/conjur/command/policy.rb +16 -40
- data/lib/conjur/command/script.rb +13 -35
- data/lib/conjur/version.rb +1 -1
- data/spec/command/policy_spec.rb +0 -12
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 840c544d5183fcf90aa59bf7a42e6cf690607c0d
|
4
|
+
data.tar.gz: 20a2f241ec1acc83f84623faa9ea97c60803960a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de5e19dcd506890c7e27276a58a5f89f00af5f8e1bb9b40cd865ba9087b41fc866995b0348d068bd3532603992323b89ee78cdd23ea0e810897540544f2a07df
|
7
|
+
data.tar.gz: 065b00d3f9ec129e5cbd2906a213ab44735456b19d0936e7417afa597c75e33034063dd20fd32cc7c3b8bb86aba635a20036ebf77c414745c1fe858d5fd7bd87
|
data/CHANGELOG.md
CHANGED
data/jenkins.sh
ADDED
data/lib/conjur/command.rb
CHANGED
@@ -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
|
52
|
-
according to software development lifecycle.
|
53
|
-
|
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
|
70
|
-
|
71
|
-
c.
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
50
|
-
|
51
|
-
c.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
data/lib/conjur/version.rb
CHANGED
data/spec/command/policy_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|