conjur-asset-layer-api 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/conjur-asset-layer-version.rb +1 -1
- data/lib/conjur/command/layers.rb +57 -0
- data/lib/conjur/layer.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e93a7c855bdc715040ff6e0bfbb3438446a3868
|
4
|
+
data.tar.gz: 66b7b240115a76f615adf87574a41db86037704b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6e711a6bc92e4da9581bc1bc262ad2b426ce55e193e9ecb101207e62901c23fc5139e287c92b277cd4b7ece73357951159ff5d0a97d50e02ff1e508469f4667
|
7
|
+
data.tar.gz: 89be42ae54025c6981f3349939452bd452137f6c14c4e1dd78aa82931889c3d76397f8fd73ab7e2c1be97f8f75d8df6c16dd5650d9b8de9f03eebf30bdf8c44c
|
@@ -12,6 +12,26 @@ class Conjur::Command::Layers < Conjur::Command
|
|
12
12
|
end
|
13
13
|
hostid
|
14
14
|
end
|
15
|
+
|
16
|
+
def self.interpret_layer_privilege(privilege)
|
17
|
+
case privilege
|
18
|
+
when 'execute'
|
19
|
+
'use_host'
|
20
|
+
when 'update'
|
21
|
+
'admin_host'
|
22
|
+
else
|
23
|
+
exit_now! "Invalid privilege '#{privilege}'. Acceptable values are : execute, update"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.parse_layer_permission_args(global_options, options, args)
|
28
|
+
id = require_arg(args, "layer")
|
29
|
+
role = require_arg(args, "role")
|
30
|
+
privilege = require_arg(args, "privilege")
|
31
|
+
role_name = interpret_layer_privilege privilege
|
32
|
+
[ id, role_name, role ]
|
33
|
+
end
|
34
|
+
|
15
35
|
|
16
36
|
desc "Create a new layer"
|
17
37
|
arg_name "id"
|
@@ -92,6 +112,43 @@ class Conjur::Command::Layers < Conjur::Command
|
|
92
112
|
puts "Layer provisioned by #{provisioner}"
|
93
113
|
end
|
94
114
|
end
|
115
|
+
|
116
|
+
desc "Permit a privilege on hosts in the layer"
|
117
|
+
long_desc <<-DESC
|
118
|
+
Privilege may be : execute, update
|
119
|
+
DESC
|
120
|
+
arg_name "layer role privilege"
|
121
|
+
command :"hosts:permit" do |c|
|
122
|
+
c.action do |global_options,options,args|
|
123
|
+
id, role_name, role = parse_layer_permission_args(global_options, options, args)
|
124
|
+
api.layer(id).add_member role_name, role
|
125
|
+
puts "Permission granted"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
desc "Remove a privilege on hosts in the layer"
|
130
|
+
arg_name "layer role privilege"
|
131
|
+
command :"hosts:deny" do |c|
|
132
|
+
c.action do |global_options,options,args|
|
133
|
+
id, role_name, role = parse_layer_permission_args(global_options, options, args)
|
134
|
+
api.layer(id).remove_member role_name, role
|
135
|
+
puts "Permission removed"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
desc "List roles that have permission on the hosts"
|
140
|
+
arg_name "layer privilege"
|
141
|
+
command :"hosts:permitted_roles" do |c|
|
142
|
+
c.action do |global_options,options,args|
|
143
|
+
id = require_arg(args, "layer")
|
144
|
+
role_name = interpret_layer_privilege require_arg(args, "privilege")
|
145
|
+
|
146
|
+
members = api.layer(id).hosts_members(role_name).map(&:member).select do |m|
|
147
|
+
m.kind != "@"
|
148
|
+
end
|
149
|
+
display members.map(&:roleid)
|
150
|
+
end
|
151
|
+
end
|
95
152
|
|
96
153
|
desc "Add a host to an layer"
|
97
154
|
arg_name "layer host"
|
data/lib/conjur/layer.rb
CHANGED
@@ -22,6 +22,11 @@ module Conjur
|
|
22
22
|
RestClient::Resource.new(self["hosts/#{fully_escape hostid}"].url, options).delete
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
# Lists the roles that have been granted access to the hosts owned roles.
|
27
|
+
def hosts_members(role_name)
|
28
|
+
owned_role(role_name).members
|
29
|
+
end
|
25
30
|
|
26
31
|
def hosts
|
27
32
|
self.attributes['hosts'].collect do |id|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conjur-asset-layer-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: conjur-api
|