conjur-cli 5.6.6 → 6.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.dockerignore +1 -1
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/APPLIANCE_VERSION +1 -1
- data/CHANGELOG.md +3 -42
- data/Gemfile +4 -7
- data/Humanfile.md +31 -0
- data/Jenkinsfile +34 -63
- data/README.md +41 -55
- data/Rakefile +5 -1
- data/bin/conjur +0 -2
- data/build-deb.sh +1 -3
- data/ci/cli-test.sh +6 -0
- data/ci/package.sh +3 -1
- data/ci/publish.sh +2 -2
- data/ci/secrets/publish.yml +2 -2
- data/ci/wait_for_server.sh +10 -0
- data/conjur-cli.gemspec +7 -7
- data/dev/docker-compose.yml +24 -0
- data/dev/start.sh +15 -0
- data/dev/stop.sh +5 -0
- data/docker-compose.yml +30 -0
- data/features/authentication/authenticate.feature +34 -0
- data/features/authentication/login.feature +13 -0
- data/features/authentication/logout.feature +15 -0
- data/{acceptance-features → features}/authentication/whoami.feature +0 -0
- data/features/authorization/resource/annotate.feature +22 -0
- data/features/authorization/resource/check.feature +47 -0
- data/{acceptance-features → features}/authorization/resource/exists.feature +18 -6
- data/features/authorization/resource/permitted_roles.feature +35 -0
- data/features/authorization/resource/show.feature +34 -0
- data/features/authorization/role/exists.feature +28 -0
- data/features/authorization/role/members.feature +45 -0
- data/features/authorization/role/memberships.feature +43 -0
- data/features/conjurenv/check.feature +34 -0
- data/features/conjurenv/run.feature +15 -0
- data/{acceptance-features → features}/conjurenv/template.feature +8 -3
- data/{acceptance-features → features}/directory/user/update_password.feature +8 -2
- data/{acceptance-features → features}/directory/variable/value.feature +9 -5
- data/{acceptance-features → features}/directory/variable/values-add.feature +8 -3
- data/features/hostfactory/tokens.feature +22 -0
- data/features/pubkeys/show.feature +18 -0
- data/features/step_definitions/authn_steps.rb +22 -0
- data/features/step_definitions/cli_steps.rb +28 -0
- data/features/step_definitions/file_steps.rb +12 -0
- data/features/step_definitions/flow_control_steps.rb +7 -0
- data/features/step_definitions/graph_steps.rb +4 -3
- data/{acceptance-features → features}/step_definitions/http_steps.rb +0 -0
- data/features/step_definitions/overrides.rb +9 -0
- data/features/step_definitions/policy_steps.rb +11 -0
- data/{acceptance-features → features}/step_definitions/trusted_proxy_steps.rb +0 -0
- data/features/support/blank.yml +1 -0
- data/features/support/env.rb +21 -7
- data/features/support/hooks.rb +31 -116
- data/features/support/world.rb +16 -76
- data/jenkins.sh +33 -0
- data/lib/conjur/authenticator.rb +83 -0
- data/lib/conjur/authn.rb +5 -20
- data/lib/conjur/cli.rb +13 -6
- data/lib/conjur/command.rb +30 -350
- data/lib/conjur/command/authn.rb +23 -15
- data/lib/conjur/command/host_factories.rb +2 -74
- data/lib/conjur/command/hosts.rb +6 -113
- data/lib/conjur/command/init.rb +20 -35
- data/lib/conjur/command/{secrets.rb → policies.rb} +33 -22
- data/lib/conjur/command/pubkeys.rb +3 -63
- data/lib/conjur/command/resources.rb +45 -162
- data/lib/conjur/command/roles.rb +11 -181
- data/lib/conjur/command/rspec/helpers.rb +0 -1
- data/lib/conjur/command/rspec/mock_services.rb +4 -4
- data/lib/conjur/command/users.rb +2 -159
- data/lib/conjur/command/variables.rb +5 -218
- data/lib/conjur/complete.rb +2 -2
- data/lib/conjur/config.rb +1 -11
- data/lib/conjur/conjurenv.rb +12 -9
- data/lib/conjur/identifier_manipulation.rb +3 -5
- data/lib/conjur/version.rb +2 -2
- data/{publish-rubygem.sh → publish.sh} +0 -4
- data/spec/authn_spec.rb +4 -0
- data/spec/command/hosts_spec.rb +2 -69
- data/spec/command/init_spec.rb +16 -11
- data/spec/command/pubkeys_spec.rb +1 -46
- data/spec/command/resources_spec.rb +21 -170
- data/spec/command/roles_spec.rb +5 -181
- data/spec/command/users_spec.rb +3 -79
- data/spec/command_spec.rb +1 -20
- data/spec/complete_spec.rb +1 -23
- data/spec/config_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -5
- data/test.sh +29 -25
- metadata +92 -212
- data/.githooks/pre_commit/run_specs.rb +0 -23
- data/Dockerfile +0 -15
- data/Dockerfile.fpm +0 -18
- data/Dockerfile.publish +0 -12
- data/Dockerfile.standalone +0 -33
- data/Dockerfile.validate-packaging +0 -9
- data/VERSION +0 -1
- data/acceptance-features/audit/audit_event_send.feature +0 -107
- data/acceptance-features/audit/fetch.feature +0 -16
- data/acceptance-features/audit/send.feature +0 -51
- data/acceptance-features/authentication/authenticate.feature +0 -10
- data/acceptance-features/authentication/login.feature +0 -12
- data/acceptance-features/authentication/logout.feature +0 -13
- data/acceptance-features/authorization/resource/annotate.feature +0 -35
- data/acceptance-features/authorization/resource/check.feature +0 -24
- data/acceptance-features/authorization/resource/create.feature +0 -21
- data/acceptance-features/authorization/resource/deny.feature +0 -12
- data/acceptance-features/authorization/resource/give.feature +0 -24
- data/acceptance-features/authorization/resource/permit.feature +0 -20
- data/acceptance-features/authorization/resource/permitted_roles.feature +0 -16
- data/acceptance-features/authorization/resource/show.feature +0 -28
- data/acceptance-features/authorization/role/create.feature +0 -13
- data/acceptance-features/authorization/role/exists.feature +0 -19
- data/acceptance-features/authorization/role/grant_to.feature +0 -21
- data/acceptance-features/authorization/role/graph.feature +0 -57
- data/acceptance-features/authorization/role/members.feature +0 -23
- data/acceptance-features/authorization/role/memberships.feature +0 -27
- data/acceptance-features/bootstrap.feature +0 -13
- data/acceptance-features/conjurenv/check.feature +0 -21
- data/acceptance-features/conjurenv/run.feature +0 -10
- data/acceptance-features/directory/group/create.feature +0 -20
- data/acceptance-features/directory/group/retire.feature +0 -54
- data/acceptance-features/directory/host/create.feature +0 -23
- data/acceptance-features/directory/host/retire.feature +0 -6
- data/acceptance-features/directory/hostfactory/create.feature +0 -28
- data/acceptance-features/directory/hostfactory/tokens.feature +0 -16
- data/acceptance-features/directory/layer/create.feature +0 -10
- data/acceptance-features/directory/layer/hosts-add.feature +0 -9
- data/acceptance-features/directory/layer/hosts-remove.feature +0 -10
- data/acceptance-features/directory/layer/retire.feature +0 -43
- data/acceptance-features/directory/user/create.feature +0 -23
- data/acceptance-features/directory/user/retire.feature +0 -6
- data/acceptance-features/directory/variable/create.feature +0 -14
- data/acceptance-features/directory/variable/retire.feature +0 -17
- data/acceptance-features/dsl/policy_owner.feature +0 -45
- data/acceptance-features/dsl/resource_owner.feature +0 -17
- data/acceptance-features/dsl/retire.feature +0 -15
- data/acceptance-features/global-privilege/elevate.feature +0 -20
- data/acceptance-features/global-privilege/reveal.privilege +0 -20
- data/acceptance-features/pubkeys/add.feature +0 -22
- data/acceptance-features/pubkeys/delete.feature +0 -9
- data/acceptance-features/pubkeys/names.feature +0 -26
- data/acceptance-features/pubkeys/show.feature +0 -27
- data/acceptance-features/step_definitions/cli_steps.rb +0 -57
- data/acceptance-features/step_definitions/graph_steps.rb +0 -22
- data/acceptance-features/step_definitions/user_steps.rb +0 -51
- data/acceptance-features/support/env.rb +0 -23
- data/acceptance-features/support/hooks.rb +0 -178
- data/acceptance-features/support/world.rb +0 -176
- data/acceptance-features/trusted_proxies.feature +0 -82
- data/bin/conjurize +0 -26
- data/bin/jsonfield +0 -70
- data/build-standalone +0 -6
- data/deprecations.sh +0 -38
- data/features/conjurize.feature +0 -134
- data/features/dsl_context.feature +0 -36
- data/features/dsl_host_create.feature +0 -11
- data/features/dsl_ownership.feature +0 -30
- data/features/dsl_permission.feature +0 -45
- data/features/dsl_resource_create.feature +0 -23
- data/features/dsl_role_create.feature +0 -11
- data/features/dsl_user_create.feature +0 -23
- data/features/jsonfield.feature +0 -49
- data/features/role_graph.feature +0 -58
- data/features/step_definitions/conjurize_steps.rb +0 -5
- data/features/step_definitions/dsl_steps.rb +0 -52
- data/features/support/conjur.conf +0 -6
- data/lib/conjur/command/assets.rb +0 -121
- data/lib/conjur/command/audit.rb +0 -155
- data/lib/conjur/command/bootstrap.rb +0 -129
- data/lib/conjur/command/dsl_command.rb +0 -75
- data/lib/conjur/command/elevate.rb +0 -76
- data/lib/conjur/command/field.rb +0 -45
- data/lib/conjur/command/groups.rb +0 -208
- data/lib/conjur/command/ids.rb +0 -34
- data/lib/conjur/command/layers.rb +0 -211
- data/lib/conjur/command/ldapsync.rb +0 -118
- data/lib/conjur/command/rspec/audit_helpers.rb +0 -68
- data/lib/conjur/command/rubydsl.rb +0 -93
- data/lib/conjur/command/script.rb +0 -48
- data/lib/conjur/command/server.rb +0 -67
- data/lib/conjur/conjurize.rb +0 -71
- data/lib/conjur/conjurize/script.rb +0 -150
- data/lib/conjur/dsl/runner.rb +0 -273
- data/publish-deb.sh +0 -6
- data/push-image +0 -29
- data/spec/command/assets_spec.rb +0 -115
- data/spec/command/audit_spec.rb +0 -376
- data/spec/command/elevate_spec.rb +0 -28
- data/spec/command/env_spec.rb +0 -168
- data/spec/command/groups_spec.rb +0 -77
- data/spec/command/host_factories_spec.rb +0 -38
- data/spec/command/layers_spec.rb +0 -35
- data/spec/command/ldapsync_spec.rb +0 -28
- data/spec/command/rubydsl_spec.rb +0 -63
- data/spec/command/variable_expiration_spec.rb +0 -164
- data/spec/command/variables_spec.rb +0 -192
- data/spec/conjurize/script_spec.rb +0 -62
- data/spec/conjurize_spec.rb +0 -70
- data/spec/dsl/runner_spec.rb +0 -93
- data/spec/env_spec.rb +0 -214
data/ci/cli-test.sh
ADDED
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.
|
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-
|
34
|
+
debian-local
|
35
35
|
done
|
data/ci/secrets/publish.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
ART_USERNAME: !var
|
2
|
-
ART_PASSWORD: !var
|
1
|
+
ART_USERNAME: !var artifactory/users/jenkins/username
|
2
|
+
ART_PASSWORD: !var artifactory/users/jenkins/password
|
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(
|
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'
|
19
|
-
gem.add_dependency 'conjur-api', '~>
|
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
data/docker-compose.yml
ADDED
@@ -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"
|
File without changes
|
@@ -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
|
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
|
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
|
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
|
15
|
-
|
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
|
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
|