conjur-cli 5.6.6 → 6.0.0.rc1

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.
Files changed (203) hide show
  1. checksums.yaml +5 -5
  2. data/.dockerignore +1 -1
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +1 -1
  5. data/APPLIANCE_VERSION +1 -1
  6. data/CHANGELOG.md +3 -42
  7. data/Gemfile +4 -7
  8. data/Humanfile.md +31 -0
  9. data/Jenkinsfile +34 -63
  10. data/README.md +41 -55
  11. data/Rakefile +5 -1
  12. data/bin/conjur +0 -2
  13. data/build-deb.sh +1 -3
  14. data/ci/cli-test.sh +6 -0
  15. data/ci/package.sh +3 -1
  16. data/ci/publish.sh +2 -2
  17. data/ci/secrets/publish.yml +2 -2
  18. data/ci/wait_for_server.sh +10 -0
  19. data/conjur-cli.gemspec +7 -7
  20. data/dev/docker-compose.yml +24 -0
  21. data/dev/start.sh +15 -0
  22. data/dev/stop.sh +5 -0
  23. data/docker-compose.yml +30 -0
  24. data/features/authentication/authenticate.feature +34 -0
  25. data/features/authentication/login.feature +13 -0
  26. data/features/authentication/logout.feature +15 -0
  27. data/{acceptance-features → features}/authentication/whoami.feature +0 -0
  28. data/features/authorization/resource/annotate.feature +22 -0
  29. data/features/authorization/resource/check.feature +47 -0
  30. data/{acceptance-features → features}/authorization/resource/exists.feature +18 -6
  31. data/features/authorization/resource/permitted_roles.feature +35 -0
  32. data/features/authorization/resource/show.feature +34 -0
  33. data/features/authorization/role/exists.feature +28 -0
  34. data/features/authorization/role/members.feature +45 -0
  35. data/features/authorization/role/memberships.feature +43 -0
  36. data/features/conjurenv/check.feature +34 -0
  37. data/features/conjurenv/run.feature +15 -0
  38. data/{acceptance-features → features}/conjurenv/template.feature +8 -3
  39. data/{acceptance-features → features}/directory/user/update_password.feature +8 -2
  40. data/{acceptance-features → features}/directory/variable/value.feature +9 -5
  41. data/{acceptance-features → features}/directory/variable/values-add.feature +8 -3
  42. data/features/hostfactory/tokens.feature +22 -0
  43. data/features/pubkeys/show.feature +18 -0
  44. data/features/step_definitions/authn_steps.rb +22 -0
  45. data/features/step_definitions/cli_steps.rb +28 -0
  46. data/features/step_definitions/file_steps.rb +12 -0
  47. data/features/step_definitions/flow_control_steps.rb +7 -0
  48. data/features/step_definitions/graph_steps.rb +4 -3
  49. data/{acceptance-features → features}/step_definitions/http_steps.rb +0 -0
  50. data/features/step_definitions/overrides.rb +9 -0
  51. data/features/step_definitions/policy_steps.rb +11 -0
  52. data/{acceptance-features → features}/step_definitions/trusted_proxy_steps.rb +0 -0
  53. data/features/support/blank.yml +1 -0
  54. data/features/support/env.rb +21 -7
  55. data/features/support/hooks.rb +31 -116
  56. data/features/support/world.rb +16 -76
  57. data/jenkins.sh +33 -0
  58. data/lib/conjur/authenticator.rb +83 -0
  59. data/lib/conjur/authn.rb +5 -20
  60. data/lib/conjur/cli.rb +13 -6
  61. data/lib/conjur/command.rb +30 -350
  62. data/lib/conjur/command/authn.rb +23 -15
  63. data/lib/conjur/command/host_factories.rb +2 -74
  64. data/lib/conjur/command/hosts.rb +6 -113
  65. data/lib/conjur/command/init.rb +20 -35
  66. data/lib/conjur/command/{secrets.rb → policies.rb} +33 -22
  67. data/lib/conjur/command/pubkeys.rb +3 -63
  68. data/lib/conjur/command/resources.rb +45 -162
  69. data/lib/conjur/command/roles.rb +11 -181
  70. data/lib/conjur/command/rspec/helpers.rb +0 -1
  71. data/lib/conjur/command/rspec/mock_services.rb +4 -4
  72. data/lib/conjur/command/users.rb +2 -159
  73. data/lib/conjur/command/variables.rb +5 -218
  74. data/lib/conjur/complete.rb +2 -2
  75. data/lib/conjur/config.rb +1 -11
  76. data/lib/conjur/conjurenv.rb +12 -9
  77. data/lib/conjur/identifier_manipulation.rb +3 -5
  78. data/lib/conjur/version.rb +2 -2
  79. data/{publish-rubygem.sh → publish.sh} +0 -4
  80. data/spec/authn_spec.rb +4 -0
  81. data/spec/command/hosts_spec.rb +2 -69
  82. data/spec/command/init_spec.rb +16 -11
  83. data/spec/command/pubkeys_spec.rb +1 -46
  84. data/spec/command/resources_spec.rb +21 -170
  85. data/spec/command/roles_spec.rb +5 -181
  86. data/spec/command/users_spec.rb +3 -79
  87. data/spec/command_spec.rb +1 -20
  88. data/spec/complete_spec.rb +1 -23
  89. data/spec/config_spec.rb +1 -1
  90. data/spec/spec_helper.rb +4 -5
  91. data/test.sh +29 -25
  92. metadata +92 -212
  93. data/.githooks/pre_commit/run_specs.rb +0 -23
  94. data/Dockerfile +0 -15
  95. data/Dockerfile.fpm +0 -18
  96. data/Dockerfile.publish +0 -12
  97. data/Dockerfile.standalone +0 -33
  98. data/Dockerfile.validate-packaging +0 -9
  99. data/VERSION +0 -1
  100. data/acceptance-features/audit/audit_event_send.feature +0 -107
  101. data/acceptance-features/audit/fetch.feature +0 -16
  102. data/acceptance-features/audit/send.feature +0 -51
  103. data/acceptance-features/authentication/authenticate.feature +0 -10
  104. data/acceptance-features/authentication/login.feature +0 -12
  105. data/acceptance-features/authentication/logout.feature +0 -13
  106. data/acceptance-features/authorization/resource/annotate.feature +0 -35
  107. data/acceptance-features/authorization/resource/check.feature +0 -24
  108. data/acceptance-features/authorization/resource/create.feature +0 -21
  109. data/acceptance-features/authorization/resource/deny.feature +0 -12
  110. data/acceptance-features/authorization/resource/give.feature +0 -24
  111. data/acceptance-features/authorization/resource/permit.feature +0 -20
  112. data/acceptance-features/authorization/resource/permitted_roles.feature +0 -16
  113. data/acceptance-features/authorization/resource/show.feature +0 -28
  114. data/acceptance-features/authorization/role/create.feature +0 -13
  115. data/acceptance-features/authorization/role/exists.feature +0 -19
  116. data/acceptance-features/authorization/role/grant_to.feature +0 -21
  117. data/acceptance-features/authorization/role/graph.feature +0 -57
  118. data/acceptance-features/authorization/role/members.feature +0 -23
  119. data/acceptance-features/authorization/role/memberships.feature +0 -27
  120. data/acceptance-features/bootstrap.feature +0 -13
  121. data/acceptance-features/conjurenv/check.feature +0 -21
  122. data/acceptance-features/conjurenv/run.feature +0 -10
  123. data/acceptance-features/directory/group/create.feature +0 -20
  124. data/acceptance-features/directory/group/retire.feature +0 -54
  125. data/acceptance-features/directory/host/create.feature +0 -23
  126. data/acceptance-features/directory/host/retire.feature +0 -6
  127. data/acceptance-features/directory/hostfactory/create.feature +0 -28
  128. data/acceptance-features/directory/hostfactory/tokens.feature +0 -16
  129. data/acceptance-features/directory/layer/create.feature +0 -10
  130. data/acceptance-features/directory/layer/hosts-add.feature +0 -9
  131. data/acceptance-features/directory/layer/hosts-remove.feature +0 -10
  132. data/acceptance-features/directory/layer/retire.feature +0 -43
  133. data/acceptance-features/directory/user/create.feature +0 -23
  134. data/acceptance-features/directory/user/retire.feature +0 -6
  135. data/acceptance-features/directory/variable/create.feature +0 -14
  136. data/acceptance-features/directory/variable/retire.feature +0 -17
  137. data/acceptance-features/dsl/policy_owner.feature +0 -45
  138. data/acceptance-features/dsl/resource_owner.feature +0 -17
  139. data/acceptance-features/dsl/retire.feature +0 -15
  140. data/acceptance-features/global-privilege/elevate.feature +0 -20
  141. data/acceptance-features/global-privilege/reveal.privilege +0 -20
  142. data/acceptance-features/pubkeys/add.feature +0 -22
  143. data/acceptance-features/pubkeys/delete.feature +0 -9
  144. data/acceptance-features/pubkeys/names.feature +0 -26
  145. data/acceptance-features/pubkeys/show.feature +0 -27
  146. data/acceptance-features/step_definitions/cli_steps.rb +0 -57
  147. data/acceptance-features/step_definitions/graph_steps.rb +0 -22
  148. data/acceptance-features/step_definitions/user_steps.rb +0 -51
  149. data/acceptance-features/support/env.rb +0 -23
  150. data/acceptance-features/support/hooks.rb +0 -178
  151. data/acceptance-features/support/world.rb +0 -176
  152. data/acceptance-features/trusted_proxies.feature +0 -82
  153. data/bin/conjurize +0 -26
  154. data/bin/jsonfield +0 -70
  155. data/build-standalone +0 -6
  156. data/deprecations.sh +0 -38
  157. data/features/conjurize.feature +0 -134
  158. data/features/dsl_context.feature +0 -36
  159. data/features/dsl_host_create.feature +0 -11
  160. data/features/dsl_ownership.feature +0 -30
  161. data/features/dsl_permission.feature +0 -45
  162. data/features/dsl_resource_create.feature +0 -23
  163. data/features/dsl_role_create.feature +0 -11
  164. data/features/dsl_user_create.feature +0 -23
  165. data/features/jsonfield.feature +0 -49
  166. data/features/role_graph.feature +0 -58
  167. data/features/step_definitions/conjurize_steps.rb +0 -5
  168. data/features/step_definitions/dsl_steps.rb +0 -52
  169. data/features/support/conjur.conf +0 -6
  170. data/lib/conjur/command/assets.rb +0 -121
  171. data/lib/conjur/command/audit.rb +0 -155
  172. data/lib/conjur/command/bootstrap.rb +0 -129
  173. data/lib/conjur/command/dsl_command.rb +0 -75
  174. data/lib/conjur/command/elevate.rb +0 -76
  175. data/lib/conjur/command/field.rb +0 -45
  176. data/lib/conjur/command/groups.rb +0 -208
  177. data/lib/conjur/command/ids.rb +0 -34
  178. data/lib/conjur/command/layers.rb +0 -211
  179. data/lib/conjur/command/ldapsync.rb +0 -118
  180. data/lib/conjur/command/rspec/audit_helpers.rb +0 -68
  181. data/lib/conjur/command/rubydsl.rb +0 -93
  182. data/lib/conjur/command/script.rb +0 -48
  183. data/lib/conjur/command/server.rb +0 -67
  184. data/lib/conjur/conjurize.rb +0 -71
  185. data/lib/conjur/conjurize/script.rb +0 -150
  186. data/lib/conjur/dsl/runner.rb +0 -273
  187. data/publish-deb.sh +0 -6
  188. data/push-image +0 -29
  189. data/spec/command/assets_spec.rb +0 -115
  190. data/spec/command/audit_spec.rb +0 -376
  191. data/spec/command/elevate_spec.rb +0 -28
  192. data/spec/command/env_spec.rb +0 -168
  193. data/spec/command/groups_spec.rb +0 -77
  194. data/spec/command/host_factories_spec.rb +0 -38
  195. data/spec/command/layers_spec.rb +0 -35
  196. data/spec/command/ldapsync_spec.rb +0 -28
  197. data/spec/command/rubydsl_spec.rb +0 -63
  198. data/spec/command/variable_expiration_spec.rb +0 -164
  199. data/spec/command/variables_spec.rb +0 -192
  200. data/spec/conjurize/script_spec.rb +0 -62
  201. data/spec/conjurize_spec.rb +0 -70
  202. data/spec/dsl/runner_spec.rb +0 -93
  203. data/spec/env_spec.rb +0 -214
data/ci/cli-test.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/bash -ex
2
+
3
+ bundle install
4
+
5
+ # If we got passed arguments, run that as the test command. Otherwise, run the full suite of tests.
6
+ ${@-bundle exec rake jenkins}
data/ci/package.sh CHANGED
@@ -9,7 +9,9 @@ rake build
9
9
 
10
10
  gem install --no-ri --no-rdoc --install-dir /tmp/gems pkg/*.gem
11
11
 
12
+ ITERATION=$(date +%s)
13
+
12
14
  find /tmp/gems/cache -name '*.gem' | xargs -rn1 \
13
- fpm --prefix $(gem environment gemdir) -s gem -t deb
15
+ fpm --prefix $(gem environment gemdir) --iteration $ITERATION -s gem -t deb
14
16
 
15
17
  cp -a *.deb /share
data/ci/publish.sh CHANGED
@@ -26,10 +26,10 @@ for package in *.deb; do
26
26
  -v $PWD/tmp/deb:/src \
27
27
  conjur-cli-publish \
28
28
  upload \
29
- --url https://conjurinc.jfrog.io/conjurinc \
29
+ --url https://conjurinc.artifactoryonline.com/conjurinc \
30
30
  --user $ART_USERNAME \
31
31
  --password $ART_PASSWORD \
32
32
  --deb "$distribution"/"$component"/amd64 \
33
33
  $package \
34
- debian-private/
34
+ debian-local
35
35
  done
@@ -1,2 +1,2 @@
1
- ART_USERNAME: !var ci/artifactory/users/jenkins/username
2
- ART_PASSWORD: !var ci/artifactory/users/jenkins/password
1
+ ART_USERNAME: !var artifactory/users/jenkins/username
2
+ ART_PASSWORD: !var artifactory/users/jenkins/password
@@ -0,0 +1,10 @@
1
+ #!/bin/bash -e
2
+
3
+ for i in $(seq 10); do
4
+ curl -o /dev/null -fs -X OPTIONS http://conjur > /dev/null && break
5
+ echo .
6
+ sleep 2
7
+ done
8
+
9
+ # So we fail if the server isn't up yet:
10
+ curl -o /dev/null -fs -X OPTIONS http://conjur > /dev/null
data/conjur-cli.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require File.expand_path('../lib/conjur/version', __FILE__)
3
+ require "English"
3
4
 
4
5
  Gem::Specification.new do |gem|
5
6
  gem.authors = ["Rafal Rzepecki", "Kevin Gilpin"]
@@ -8,25 +9,23 @@ Gem::Specification.new do |gem|
8
9
  gem.homepage = "https://github.com/conjurinc/cli-ruby"
9
10
  gem.license = 'MIT'
10
11
 
11
- gem.files = `git ls-files`.split($\) + Dir['build_number']
12
+ gem.files = (`git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
13
+ .select { |x| x !~ /^Dockerfile/ }
14
+ ) + Dir["build_number"]
12
15
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
17
  gem.name = "conjur-cli"
15
18
  gem.require_paths = ["lib"]
16
19
  gem.version = Conjur::VERSION
17
20
 
18
- gem.add_dependency 'activesupport', '>= 4.2', '< 6'
19
- gem.add_dependency 'conjur-api', '~> 4.30'
21
+ gem.add_dependency 'activesupport'
22
+ gem.add_dependency 'conjur-api', '~> 5.0.0.beta'
20
23
  gem.add_dependency 'gli', '>=2.8.0'
21
24
  gem.add_dependency 'highline', '~> 1.7'
22
25
  gem.add_dependency 'netrc', '~> 0.10'
23
- gem.add_dependency 'methadone', '~> 1.9'
24
26
  gem.add_dependency 'deep_merge', '~> 1.0'
25
27
  gem.add_dependency 'xdg', '~> 2.2'
26
28
  gem.add_dependency 'table_print', '~> 1.5'
27
- gem.add_dependency 'semantic', '>= 1.4.1'
28
-
29
- gem.add_runtime_dependency 'cas_rest_client', '~> 1.3'
30
29
 
31
30
  gem.add_development_dependency 'rspec', '~> 3.0'
32
31
  gem.add_development_dependency 'simplecov'
@@ -38,4 +37,5 @@ Gem::Specification.new do |gem|
38
37
  gem.add_development_dependency 'json_spec'
39
38
  gem.add_development_dependency 'cucumber-api'
40
39
  gem.add_development_dependency 'addressable'
40
+ gem.add_development_dependency 'pry-byebug'
41
41
  end
@@ -0,0 +1,24 @@
1
+ version: '2'
2
+ services:
3
+ pg:
4
+ image: postgres:9.3
5
+
6
+ conjur:
7
+ image: cyberark/conjur
8
+ command: server -a cucumber
9
+ environment:
10
+ DATABASE_URL: postgres://postgres@pg/postgres
11
+ CONJUR_DATA_KEY:
12
+
13
+ cli:
14
+ build:
15
+ dockerfile: Dockerfile.standalone
16
+ context: ..
17
+ entrypoint: sleep
18
+ command: infinity
19
+ environment:
20
+ CONJUR_APPLIANCE_URL: http://conjur
21
+ CONJUR_ACCOUNT: cucumber
22
+ working_dir: /src/conjur-cli
23
+ volumes:
24
+ - ..:/src/conjur-cli
data/dev/start.sh ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/bash -ex
2
+
3
+ export COMPOSE_PROJECT_NAME=clirubydev
4
+
5
+ docker-compose build
6
+
7
+ if [ ! -f data_key ]; then
8
+ echo "Generating data key"
9
+ docker-compose run --no-deps --rm conjur data-key generate > data_key
10
+ fi
11
+
12
+ export POSSUM_DATA_KEY="$(cat data_key)"
13
+
14
+ docker-compose up -d
15
+ docker-compose exec cli bash
data/dev/stop.sh ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash -ex
2
+
3
+ export COMPOSE_PROJECT_NAME=clirubydev
4
+
5
+ docker-compose down -v
@@ -0,0 +1,30 @@
1
+ version: '2'
2
+ services:
3
+ pg:
4
+ image: postgres:9.3
5
+
6
+ conjur:
7
+ image: cyberark/conjur
8
+ command: server -a cucumber
9
+ depends_on:
10
+ - pg
11
+ environment:
12
+ - CONJUR_DATA_KEY
13
+ - DATABASE_URL=postgres://postgres@pg/postgres
14
+
15
+ test:
16
+ image: cli-test:${RUBY_VERSION}
17
+ build:
18
+ context: .
19
+ dockerfile: Dockerfile.${RUBY_VERSION}
20
+ entrypoint: ci/cli-test.sh
21
+ environment:
22
+ - DATABASE_URL=postgres://postgres@pg/postgres
23
+ - RAILS_ENV=test
24
+ - CONJUR_APPLIANCE_URL=http://conjur
25
+ - CONJUR_ACCOUNT=cucumber
26
+ - CONJUR_AUTHN_LOGIN=admin
27
+ - CONJUR_AUTHN_API_KEY
28
+ volumes:
29
+ - .:/src
30
+
@@ -0,0 +1,34 @@
1
+ Feature: Authenticate a role
2
+
3
+ Scenario: Get a JSON token
4
+ When I successfully run `conjur authn authenticate`
5
+ Then the JSON should have "data"
6
+ And the JSON should have "signature"
7
+
8
+ Scenario: Get an auth token as HTTP Authorize header
9
+ When I successfully run `conjur authn authenticate -H`
10
+ Then the output should match /Authorization: Token token=".*"/
11
+
12
+ Scenario: The API key of a new user is available and can be used to authenticate.
13
+ Given I load the policy:
14
+ """
15
+ - !user alice
16
+ """
17
+ And I login as "alice"
18
+ When I successfully run `conjur authn authenticate`
19
+ Then the JSON at "data" should be "alice"
20
+
21
+ @announce-command
22
+ @announce-output
23
+ Scenario: The access token can be continuously refreshed in a file.
24
+ When I run `env CONJUR_TOKEN_LIFESPAN=2 CONJUR_TOKEN_REFRESH_DELAY=1 CONJURAPI_LOG=stderr conjur authn authenticate -f /tmp/token` interactively
25
+ And I run `sleep inf`
26
+ Then the output should contain:
27
+ """
28
+ Authenticating admin to account cucumber
29
+ Refreshed Conjur auth token to "/tmp/token"
30
+ Authenticating admin to account cucumber
31
+ Refreshed Conjur auth token to "/tmp/token"
32
+ Authenticating admin to account cucumber
33
+ Refreshed Conjur auth token to "/tmp/token"
34
+ """
@@ -0,0 +1,13 @@
1
+ Feature: Login a new user
2
+
3
+ Background:
4
+ Given I load the policy:
5
+ """
6
+ - !user alice
7
+ """
8
+
9
+ @restore-login
10
+ Scenario: Login a new user with a password
11
+ When I run `conjur authn login alice` interactively
12
+ And I type the API key for "alice"
13
+ Then the exit status should be 0
@@ -0,0 +1,15 @@
1
+ Feature: Logout the user
2
+
3
+ Background:
4
+ Given I load the policy:
5
+ """
6
+ - !user alice
7
+ """
8
+
9
+ @restore-login
10
+ Scenario: Login a logged-in user
11
+ When I run `conjur authn login alice` interactively
12
+ And I type the API key for "alice"
13
+ Then the exit status should be 0
14
+ And I successfully run `conjur authn logout`
15
+ Then the stdout from "conjur authn logout" should contain exactly "Logged out\n"
@@ -0,0 +1,22 @@
1
+ Feature: Annotate a resource
2
+
3
+ Background:
4
+ Given I load the policy:
5
+ """
6
+ - !resource
7
+ kind: food
8
+ id: bacon
9
+ annotations:
10
+ preparation-style: crispy
11
+ """
12
+
13
+ Scenario: Annotations are stored and returned when the resource is displayed
14
+ When I successfully run `conjur show food:bacon`
15
+ And the JSON at "annotations" should have 1 entry
16
+ And the JSON at "annotations/0/name" should be "preparation-style"
17
+ And the JSON at "annotations/0/value" should be "crispy"
18
+
19
+ Scenario: Annotations are searchable
20
+ When I successfully run `conjur list --inspect -k food -s "crispy"`
21
+ Then the JSON should have 1 entry
22
+ And the JSON at "0/annotations/preparation-style" should be "crispy"
@@ -0,0 +1,47 @@
1
+ Feature: Checking permissions on a resource
2
+
3
+ Background:
4
+ Given I load the policy:
5
+ """
6
+ - !resource
7
+ kind: food
8
+ id: bacon
9
+
10
+ - !role
11
+ kind: job
12
+ id: cook
13
+ """
14
+
15
+ Scenario: By default I check my own privilege
16
+ In this case, I have the privilege because I own the resource
17
+
18
+ When I successfully run `conjur check food:bacon fry`
19
+ Then the stdout should contain exactly "true"
20
+
21
+ Scenario: I can check the privileges of roles that I own
22
+ And I successfully run `conjur check -r job:cook food:bacon fry`
23
+ Then the stdout should contain exactly "false"
24
+
25
+ Scenario: I can check the privileges of roles that I own
26
+ Given I apply the policy:
27
+ """
28
+ - !resource
29
+ kind: food
30
+ id: bacon
31
+
32
+ - !role
33
+ kind: job
34
+ id: cook
35
+
36
+ - !permit
37
+ role: !role
38
+ kind: job
39
+ id: cook
40
+ resource: !resource
41
+ kind: food
42
+ id: bacon
43
+ privilege: fry
44
+ """
45
+ And I reset the command list
46
+ And I successfully run `conjur check -r job:cook food:bacon fry`
47
+ Then the stdout should contain exactly "true"
@@ -1,18 +1,30 @@
1
1
  Feature: Test the existence of a resource
2
2
 
3
3
  Scenario: Existing resources can be detected
4
- Given I successfully run `conjur resource create food:$ns/bacon`
4
+ Given I load the policy:
5
+ """
6
+ - !resource
7
+ kind: food
8
+ id: bacon
9
+ """
5
10
  And I reset the command list
6
- When I successfully run `conjur resource exists food:$ns/bacon`
11
+ When I successfully run `conjur resource exists food:bacon`
7
12
  Then the stdout should contain exactly "true"
8
13
 
9
14
  Scenario: Non-existent resources are reported as such
10
- When I successfully run `conjur resource exists food:$ns/bacon`
15
+ When I successfully run `conjur resource exists food:bacon`
11
16
  Then the stdout should contain exactly "false"
12
17
 
13
18
  Scenario: Even foreign user can check existence of a resource
14
- Given I successfully run `conjur resource create food:$ns/bacon`
15
- And I login as a new user
19
+ Given I load the policy:
20
+ """
21
+ - !resource
22
+ kind: food
23
+ id: bacon
24
+
25
+ - !user alice
26
+ """
27
+ And I login as "alice"
16
28
  And I reset the command list
17
- And I run `conjur resource exists food:$ns/bacon`
29
+ And I run `conjur resource exists food:bacon`
18
30
  Then the stdout should contain exactly "true"
@@ -0,0 +1,35 @@
1
+ Feature: List roles which have a permission on a resource
2
+
3
+ Background:
4
+ Given I load the policy:
5
+ """
6
+ - !user alice
7
+
8
+ - !resource
9
+ kind: food
10
+ id: bacon
11
+ owner: !user alice
12
+ """
13
+
14
+ Scenario: The owner of a resource is always listed in permitted_roles
15
+ When I successfully run `conjur resource permitted_roles food:bacon fry`
16
+ Then the JSON should include "cucumber:user:alice"
17
+
18
+ Scenario: When a permission is granted to a new user, the user is listed in permitted_roles
19
+ Given I apply the policy:
20
+ """
21
+ - !user bob
22
+
23
+ - !resource
24
+ kind: food
25
+ id: bacon
26
+
27
+ - !permit
28
+ role: !user bob
29
+ privilege: fry
30
+ resource: !resource
31
+ kind: food
32
+ id: bacon
33
+ """
34
+ When I successfully run `conjur resource permitted_roles food:bacon fry`
35
+ Then the JSON should include "cucumber:user:bob"
@@ -0,0 +1,34 @@
1
+ Feature: Show a resource
2
+
3
+ Background:
4
+ Given I load the policy:
5
+ """
6
+ - !user eve
7
+
8
+ - !user alice
9
+
10
+ - !resource
11
+ kind: food
12
+ id: bacon
13
+
14
+ - !permit
15
+ role: !user alice
16
+ privilege: fry
17
+ resource: !resource
18
+ kind: food
19
+ id: bacon
20
+ """
21
+
22
+ Scenario: Showing a resource displays all its fields
23
+ When I successfully run `conjur show food:bacon`
24
+ Then the JSON should have "id"
25
+ And the JSON should have "owner"
26
+ And the JSON should have "permissions"
27
+ And the JSON should have "annotations"
28
+
29
+ Scenario: You can show any resource if you have a privilege on it
30
+ Once alice has a permission to fry bacon, she can show everything
31
+ about bacon.
32
+
33
+ And I login as "alice"
34
+ Then I successfully run `conjur show food:bacon`
@@ -0,0 +1,28 @@
1
+ Feature: Test existence of a role
2
+
3
+ Scenario: A never-created role does not exist
4
+ When I successfully run `conjur role exists --json food:nonesuch`
5
+ Then the JSON at "exists" should be false
6
+
7
+ Scenario: A created role does exist
8
+ Given I load the policy:
9
+ """
10
+ - !role
11
+ kind: job
12
+ id: cook
13
+ """
14
+ And I successfully run `conjur role exists --json job:cook`
15
+ Then the JSON at "exists" should be true
16
+
17
+ Scenario: Even foreign user can check existance of a role
18
+ Given I load the policy:
19
+ """
20
+ - !user alice
21
+
22
+ - !role
23
+ kind: job
24
+ id: cook
25
+ """
26
+ And I login as "alice"
27
+ And I run `conjur role exists --json job:cook`
28
+ Then the JSON at "exists" should be true