conjur-cli 4.26.0 → 4.27.0

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/acceptance-features/audit/audit_event_send.feature +104 -0
  4. data/acceptance-features/audit/send.feature +70 -0
  5. data/acceptance-features/authentication/authenticate.feature +10 -0
  6. data/acceptance-features/authentication/login.feature +14 -0
  7. data/acceptance-features/authentication/logout.feature +16 -0
  8. data/acceptance-features/authentication/whoami.feature +5 -0
  9. data/acceptance-features/authorization/resource/annotate.feature +35 -0
  10. data/acceptance-features/authorization/resource/check.feature +22 -0
  11. data/acceptance-features/authorization/resource/create.feature +19 -0
  12. data/acceptance-features/authorization/resource/deny.feature +12 -0
  13. data/acceptance-features/authorization/resource/exists.feature +16 -0
  14. data/acceptance-features/authorization/resource/give.feature +22 -0
  15. data/acceptance-features/authorization/resource/permit.feature +20 -0
  16. data/acceptance-features/authorization/resource/permitted_roles.feature +16 -0
  17. data/acceptance-features/authorization/resource/show.feature +26 -0
  18. data/acceptance-features/authorization/role/create.feature +13 -0
  19. data/acceptance-features/authorization/role/exists.feature +19 -0
  20. data/acceptance-features/authorization/role/grant_to.feature +21 -0
  21. data/acceptance-features/authorization/role/graph.feature +58 -0
  22. data/acceptance-features/authorization/role/members.feature +23 -0
  23. data/acceptance-features/authorization/role/memberships.feature +27 -0
  24. data/acceptance-features/conjurenv/check.feature +28 -0
  25. data/acceptance-features/conjurenv/run.feature +10 -0
  26. data/acceptance-features/conjurenv/template.feature +11 -0
  27. data/acceptance-features/directory/group/create.feature +20 -0
  28. data/acceptance-features/directory/group/retire.feature +54 -0
  29. data/acceptance-features/directory/host/create.feature +23 -0
  30. data/acceptance-features/directory/host/retire.feature +6 -0
  31. data/acceptance-features/directory/layer/create.feature +10 -0
  32. data/acceptance-features/directory/layer/hosts-add.feature +9 -0
  33. data/acceptance-features/directory/layer/hosts-remove.feature +10 -0
  34. data/acceptance-features/directory/user/create.feature +23 -0
  35. data/acceptance-features/directory/user/retire.feature +6 -0
  36. data/acceptance-features/directory/user/update_password.feature +16 -0
  37. data/acceptance-features/directory/variable/create.feature +14 -0
  38. data/acceptance-features/directory/variable/retire.feature +17 -0
  39. data/acceptance-features/directory/variable/value.feature +13 -0
  40. data/acceptance-features/directory/variable/values-add.feature +12 -0
  41. data/acceptance-features/global-privilege/elevate.feature +20 -0
  42. data/acceptance-features/global-privilege/reveal.privilege +20 -0
  43. data/acceptance-features/pubkeys/add.feature +20 -0
  44. data/acceptance-features/pubkeys/delete.feature +9 -0
  45. data/acceptance-features/pubkeys/names.feature +23 -0
  46. data/acceptance-features/pubkeys/show.feature +25 -0
  47. data/acceptance-features/step_definitions/cli.rb +21 -0
  48. data/acceptance-features/step_definitions/graph_steps.rb +22 -0
  49. data/acceptance-features/step_definitions/user_steps.rb +54 -0
  50. data/acceptance-features/support/env.rb +5 -0
  51. data/acceptance-features/support/hooks.rb +179 -0
  52. data/acceptance-features/support/world.rb +153 -0
  53. data/conjur.gemspec +4 -1
  54. data/features/step_definitions/graph_steps.rb +2 -2
  55. data/features/support/hooks.rb +1 -5
  56. data/lib/conjur/cli.rb +1 -1
  57. data/lib/conjur/command/bootstrap.rb +3 -2
  58. data/lib/conjur/command/elevate.rb +76 -0
  59. data/lib/conjur/command/rspec/mock_services.rb +3 -3
  60. data/lib/conjur/command.rb +15 -0
  61. data/lib/conjur/version.rb +1 -1
  62. data/spec/command/elevate_spec.rb +28 -0
  63. metadata +85 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54ffbd129d6c3a3fc980ff0d44ad733b1eb384b6
4
- data.tar.gz: 44d584a5a9a9e8aecff993113a31462fb7903392
3
+ metadata.gz: 269e8ed2d2f6b69c7562c3c40fb4f34ff96e0788
4
+ data.tar.gz: db804ffbb9219ece6834a554aa142a76a731fab5
5
5
  SHA512:
6
- metadata.gz: 65c39293a9f24b0dc0ae51c13bf7921c30c99e74ed4f45a158f5f08c45dcc78eae530379bbcf264014150ab4a9e5d23bfa494f26f2e6a2b29bcb81732ddc10e9
7
- data.tar.gz: c4f362e466e4fd8b3b0bd75e79a8e888849b8e51f3df8c29a92389d1f37c2ca14559877a95693a1c9a983d334ee6b0dcfd879167bc9cb83e84429e18ef3b16c6
6
+ metadata.gz: 0b77f202ea2b76ec7593d1bd98c2799b4771ce6a9e05564cde88c6dc09150097dfd23fb9a72902c53886aa1f85d0472f32185a42d6ae230209066245fa80c91d
7
+ data.tar.gz: 39a144652fc0ae5dbfc59af883bbfaab2deb6c87a8a59da62403500eecf1497f77f5797e81ccee68f21892efe185d0a1a53726133f48b990436472e6165a673b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 4.27.0
2
+
3
+ * New commands `elevate` and `reveal` for execution of privileged commands on Conjur 4.5+.
4
+
5
+ # 4.26.0
6
+
7
+ * New implementation of bash completions.
8
+
1
9
  # 4.25.2
2
10
  * Fixes a conflict with RVM: Sets `GEM_HOME` and `GEM_PATH to nil.
3
11
 
@@ -0,0 +1,104 @@
1
+ Feature: Write and read custom audit events (full-stack test, not for publication)
2
+
3
+ Background:
4
+ Given I create a new user named "eve@$ns"
5
+ And I create a new host with id "monitoring/server"
6
+ And I create a new user named "observer@$ns"
7
+ And I run `conjur resource permit host:$ns/monitoring/server user:observer@$ns read`
8
+ And I run `conjur role grant_to user:eve@$ns user:observer@$ns`
9
+ And I run `conjur role grant_to host:$ns/monitoring/server user:observer@$ns`
10
+ And a file named "audit_event.json" with namespace substitution:
11
+ """
12
+ {
13
+ "facility": "custom",
14
+ "action": "sudo",
15
+ "system_user": "eve",
16
+ "allowed": false,
17
+ "role": "user:eve@$ns",
18
+ "resource_id": "host:$ns/monitoring/server",
19
+ "error": "user NOT in sudoers",
20
+ "audit_message": "eve tried to run '/bin/cat /etc/shadow' as root",
21
+ "command": "/bin/cat /etc/shadow",
22
+ "target_user": "root",
23
+ "sudo": {
24
+ "TTY": "pts/0",
25
+ "PWD": "/home/eve",
26
+ "USER": "root",
27
+ "COMMAND": "/bin/cat /etc/shadow"
28
+ },
29
+ "timestamp": "2014-06-30T03:25:00.542768+00:00"
30
+ }
31
+ """
32
+ And I login as a new host
33
+ And I run `conjur audit send` interactively
34
+ And I pipe in the file "audit_event.json"
35
+ And the exit status should be 0
36
+ And I login as "observer@$ns"
37
+
38
+ Scenario: Default fields are included in audit event
39
+ When I run `conjur audit role -l 1 -o 3 host:$ns/monitoring/server`
40
+ Then the JSON response should have the following:
41
+ | id |
42
+ | event_id |
43
+ | timestamp |
44
+ | submission_timestamp |
45
+ | kind |
46
+ | action |
47
+ | user |
48
+ | acting_as |
49
+ | roles |
50
+ | resources |
51
+ | resource |
52
+ | request |
53
+ | conjur |
54
+
55
+ Scenario: Default fields are filled properly
56
+ When I run `conjur audit role -l 1 -o 3 host:$ns/monitoring/server`
57
+ Then the JSON response at "timestamp" should include "2014-06-30T03:25:00"
58
+ And the JSON response at "kind" should be "audit"
59
+ And the JSON response at "action" should be "sudo"
60
+ And the JSON response at "user" should include "/monitoring/server"
61
+ And the JSON response at "roles/0" should include "/monitoring/server"
62
+ And the JSON response at "roles/1" should include "user:eve@"
63
+ And the JSON response at "resource" should include "/monitoring/server"
64
+ And the JSON response at "resources/0" should include "/monitoring/server"
65
+ And the JSON response at "conjur/user" should include "/monitoring/server"
66
+
67
+ Scenario: All custom fields are exposed
68
+ When I run `conjur audit role -l 1 -o 3 host:$ns/monitoring/server`
69
+ Then the JSON response should have the following:
70
+ | facility |
71
+ | system_user |
72
+ | allowed |
73
+ | role |
74
+ | resource_id |
75
+ | error |
76
+ | audit_message |
77
+ | command |
78
+ | target_user |
79
+ | sudo |
80
+
81
+ Scenario: Custom fields are filled properly
82
+ When I run `conjur audit role -l 1 -o 3 host:$ns/monitoring/server`
83
+ And the JSON response at "facility" should be "custom"
84
+ And the JSON response at "system_user" should include "eve"
85
+ And the JSON response at "allowed" should be false
86
+ And the JSON response at "role" should include "user:eve@"
87
+ And the JSON response at "resource_id" should include "/monitoring/server"
88
+ And the JSON response at "error" should be "user NOT in sudoers"
89
+ And the JSON response at "command" should be "/bin/cat /etc/shadow"
90
+ And the JSON response at "target_user" should be "root"
91
+ And the JSON response at "sudo/PWD" should be "/home/eve"
92
+
93
+ Scenario: Custom event is indexed per resource
94
+ When I run `conjur audit resource -s host:$ns/monitoring/server`
95
+ Then the output should match /monitoring.server reported custom:sudo by .*:user:eve@(.*) on .*:host:(.*).monitoring.server \(allowed: false\); message: eve tried to run .* as root \(failed with user NOT in sudoers\)/
96
+
97
+
98
+ Scenario: Custom event is indexed per submitter role
99
+ When I run `conjur audit role -s host:$ns/monitoring/server`
100
+ Then the output should match /monitoring.server reported custom:sudo by .*:user:eve@(.*) on .*:host:(.*).monitoring.server \(allowed: false\); message: eve tried to run .* as root \(failed with user NOT in sudoers\)/
101
+
102
+ Scenario: Custom event is indexed per other roles
103
+ When I run `conjur audit role -s user:eve@$ns`
104
+ Then the output should match /monitoring.server reported custom:sudo by .*:user:eve@(.*) on .*:host:(.*).monitoring.server \(allowed: false\); message: eve tried to run .* as root \(failed with user NOT in sudoers\)/
@@ -0,0 +1,70 @@
1
+ Feature: Create custom audit events
2
+
3
+ Background:
4
+ Given I login as new user "joe@$ns"
5
+
6
+ Scenario: Simplest audit event
7
+ When I successfully run `conjur audit send '{"action":"login"}'`
8
+ And I run `conjur audit all -s`
9
+ Then the output should match /user:joe@.* reported login/
10
+
11
+ Scenario: Expose facility
12
+ When I successfully run `conjur audit send '{"action":"login", "facility":"ssh"}'`
13
+ And I run `conjur audit all -s`
14
+ Then the output should match /user:joe@.* reported ssh:login/
15
+
16
+ Scenario: Link to role
17
+ When I successfully run `conjur audit send '{"action":"login", "role":"user:bob"}'`
18
+ And I run `conjur audit all -s`
19
+ Then the output should match /user:joe@.* reported login by .*:user:bob/
20
+
21
+ Scenario: Link to resource
22
+ When I successfully run `conjur audit send '{"action":"login", "resource_id":"host:server"}'`
23
+ And I run `conjur audit all -s`
24
+ Then the output should match /user:joe@.* reported login on .*:host:server/
25
+
26
+
27
+ Scenario: 'Allowed' flag
28
+ When I successfully run `conjur audit send '{"action":"login", "allowed": false}'`
29
+ And I run `conjur audit all -s`
30
+ Then the output should match /user:joe@.* reported login \(allowed: false\)/
31
+
32
+ Scenario: Custom message
33
+ When I successfully run `conjur audit send '{"action":"login", "audit_message": "Client IP is 1.2.3.4"}'`
34
+ And I run `conjur audit all -s`
35
+ Then the output should match /user:joe@.* reported login; message: Client IP is 1.2.3.4/
36
+
37
+ Scenario: Error details
38
+ When I successfully run `conjur audit send '{"action":"login", "error": "password mismatch"}'`
39
+ And I run `conjur audit all -s`
40
+ Then the output should match /user:joe@.* reported login \(failed with password mismatch\)/
41
+
42
+ Scenario: Fully described audit event (sent from file)
43
+ When a file named "audit_event.json" with:
44
+ """
45
+ {
46
+ "action": "login",
47
+ "facility": "ssh",
48
+ "role": "user:bob",
49
+ "resource_id": "host:server",
50
+ "allowed": false,
51
+ "audit_message": "Client IP is 1.2.3.4",
52
+ "error": "password mismatch"
53
+ }
54
+ """
55
+ And I run `conjur audit send` interactively
56
+ And I pipe in the file "audit_event.json"
57
+ And the exit status should be 0
58
+ And I run `conjur audit all -s`
59
+ Then the output should match /user:joe@.* reported ssh:login by .*:user:bob on .*:host:server \(allowed: false\); message: Client IP is 1.2.3.4 \(failed with password mismatch\)/
60
+
61
+ Scenario: Specify timestamp as IS08601 with timezone
62
+ When I successfully run `conjur audit send '{"action":"login", "timestamp": "2014-07-01T01:02:03Z"}'`
63
+ And I run `conjur audit all -s`
64
+ Then the output should match /\[2014-07-01 01:02:03 UTC\] .*:user:joe@.* reported login/
65
+
66
+ Scenario: Arbitrary field (exposed in full audit output)
67
+ When I successfully run `conjur audit send '{"action":"login", "syslog": { "message" : "Accepted publickey for alice from 192.168.1.11 port 38977 ssh2" }}'`
68
+ And I run `conjur audit all -o 3`
69
+ Then the JSON response at "syslog/message" should be "Accepted publickey for alice from 192.168.1.11 port 38977 ssh2"
70
+
@@ -0,0 +1,10 @@
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=".*"/
@@ -0,0 +1,14 @@
1
+ Feature: Login a new user
2
+
3
+ Scenario: Login a new user with a password
4
+ Given I run `conjur user create -p alice@$ns` interactively
5
+ And I type "foobar"
6
+ And I type "foobar"
7
+ And the exit status should be 0
8
+ And I keep the JSON response at "login" as "LOGIN"
9
+ And I run `conjur authn login alice@$ns` interactively
10
+ And I type "foobar"
11
+ And the exit status should be 0
12
+ And I successfully run `conjur authn whoami`
13
+ Then the JSON at "username" should be %{LOGIN}
14
+
@@ -0,0 +1,16 @@
1
+ Feature: Logout the user
2
+
3
+ Scenario: Login a new user with a password
4
+ Given I run `conjur user create -p alice@$ns` interactively
5
+ And I type "foobar"
6
+ And I type "foobar"
7
+ And the exit status should be 0
8
+ And I keep the JSON response at "login" as "LOGIN"
9
+ And I run `conjur authn login alice@$ns` interactively
10
+ And I type "foobar"
11
+ And the exit status should be 0
12
+ And I successfully run `conjur authn logout`
13
+ Then the stdout from "conjur authn logout" should contain exactly "Logged out\n"
14
+ And I run `conjur authn whoami`
15
+ And the exit status should be 255
16
+ And the stderr from "conjur authn whoami" should contain "error: Not logged in"
@@ -0,0 +1,5 @@
1
+ Feature: Show the current user
2
+
3
+ Scenario: Show the current user
4
+ When I successfully run `conjur authn whoami`
5
+ Then the JSON should have "username"
@@ -0,0 +1,35 @@
1
+ Feature: Annotate a resource
2
+
3
+ Background:
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+
6
+ Scenario: Annotations are stored and returned when the resource is displayed
7
+ Given I successfully run `conjur resource annotate food:$ns/bacon preparation-style crispy`
8
+ When I successfully run `conjur resource show food:$ns/bacon`
9
+ And the JSON at "annotations" should have 1 entry
10
+ And the JSON at "annotations/0/name" should be "preparation-style"
11
+ And the JSON at "annotations/0/value" should be "crispy"
12
+
13
+ Scenario: Privilege is required to manage annotations
14
+ Given I login as a new user
15
+ And I run `conjur resource annotate food:$ns/bacon preparation-style crispy`
16
+ Then the exit status should be 1
17
+
18
+ Scenario: Read privilege is insufficient to manage annotations
19
+ Given I create a new user named "alice@$ns"
20
+ And I successfully run `conjur resource permit food:$ns/bacon user:alice@$ns read`
21
+ And I login as "alice@$ns"
22
+ Then I run `conjur resource annotate food:$ns/bacon preparation-style crispy`
23
+ Then the exit status should be 1
24
+
25
+ Scenario: Update privilege is sufficient to manage annotations
26
+ Given I create a new user named "alice@$ns"
27
+ And I successfully run `conjur resource permit food:$ns/bacon user:alice@$ns update`
28
+ And I login as "alice@$ns"
29
+ Then I successfully run `conjur resource annotate food:$ns/bacon preparation-style crispy`
30
+
31
+ Scenario: Annotations are searchable
32
+ Given I successfully run `conjur resource annotate food:$ns/bacon preparation-style crispy`
33
+ When I successfully run `conjur resource list -k food -s "$ns crispy"`
34
+ Then the JSON should have 1 entry
35
+ And the JSON at "0/annotations/preparation-style" should be "crispy"
@@ -0,0 +1,22 @@
1
+ Feature: Checking permissions on a resource
2
+
3
+ Background:
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+
6
+ Scenario: By default I check my own privilege
7
+ In this case, I have the privilege because I own the resource
8
+
9
+ When I successfully run `conjur resource check food:$ns/bacon fry`
10
+ Then the stdout from "conjur resource check food:$ns/bacon fry" should contain "true"
11
+
12
+ Scenario: I can check the privileges of roles that I own
13
+ When I successfully run `conjur role create job:$ns/cook`
14
+ And I successfully run `conjur resource check -r job:$ns/cook food:$ns/bacon fry`
15
+ Then the stdout from "conjur resource check -r job:$ns/cook food:$ns/bacon fry" should contain "false"
16
+
17
+ Scenario: I can check the privileges of roles that I own
18
+ When I successfully run `conjur role create job:$ns/cook`
19
+ And I successfully run `conjur resource permit food:$ns/bacon job:$ns/cook fry`
20
+ And I successfully run `conjur resource check -r job:$ns/cook food:$ns/bacon fry`
21
+ Then the stdout from "conjur resource check -r job:$ns/cook food:$ns/bacon fry" should contain "true"
22
+
@@ -0,0 +1,19 @@
1
+ Feature: Create a Resource
2
+
3
+ Scenario: Create an abstract resource
4
+ When I successfully run `conjur resource create food:$ns/bacon`
5
+ Then the JSON should have "id"
6
+ And the JSON should have "owner"
7
+ And the JSON should have "permissions"
8
+ And the JSON should have "annotations"
9
+
10
+ Scenario: The resource owner has all privileges on it
11
+ When I successfully run `conjur resource create food:$ns/bacon`
12
+ And I successfully run `conjur resource check food:$ns/bacon fry`
13
+ Then the stdout from "conjur resource check food:$ns/bacon fry" should contain "true"
14
+
15
+ Scenario: A different role can be assigned as the owner of the resource
16
+ When I successfully run `conjur role create job:$ns/chefs`
17
+ And I successfully run `conjur resource create --as-role job:$ns/chefs food:$ns/bacon`
18
+ And I successfully run `conjur resource check -r job:$ns/chefs food:$ns/bacon fry`
19
+ Then the stdout from "conjur resource check -r job:$ns/chefs food:$ns/bacon fry" should contain "true"
@@ -0,0 +1,12 @@
1
+ Feature: Deny a privilege on a Resource
2
+
3
+ Background:
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+
6
+ Scenario: Once granted, privileges can be revoked
7
+
8
+ Given I create a new user named "alice@$ns"
9
+ And I successfully run `conjur resource permit food:$ns/bacon user:alice@$ns fry`
10
+ When I successfully run `conjur resource deny food:$ns/bacon user:alice@$ns fry`
11
+ And I successfully run `conjur resource show food:$ns/bacon`
12
+ Then the JSON at "permissions" should have 0 items
@@ -0,0 +1,16 @@
1
+ Feature: Test the existance of a resource
2
+
3
+ Scenario: Existing resources can be detected
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+ When I successfully run `conjur resource exists food:$ns/bacon`
6
+ Then the stdout from "conjur resource exists food:$ns/bacon" should contain "true"
7
+
8
+ Scenario: Non-existant resources are reported as such
9
+ When I successfully run `conjur resource exists food:$ns/bacon`
10
+ Then the stdout from "conjur resource exists food:$ns/bacon" should contain "false"
11
+
12
+ Scenario: Even foreign user can check existance of a resource
13
+ Given I successfully run `conjur resource create food:$ns/bacon`
14
+ And I login as a new user
15
+ And I run `conjur resource exists food:$ns/bacon`
16
+ Then the stdout from "conjur resource exists food:$ns/bacon" should contain "true"
@@ -0,0 +1,22 @@
1
+ Feature: Give a resource to another role
2
+
3
+ Scenario: I can give a resource which I own to another role
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+ And I create a new user named "alice@$ns"
6
+ Then I successfully run `conjur resource give food:$ns/bacon user:alice@$ns`
7
+
8
+ Scenario: Resource owner is in the 'owner' field
9
+ Given I successfully run `conjur resource create food:$ns/bacon`
10
+ And I create a new user named "alice@$ns"
11
+ And I keep the JSON at "roleid" as "USERID"
12
+ Then I successfully run `conjur resource give food:$ns/bacon user:alice@$ns`
13
+ And I successfully run `conjur resource show food:$ns/bacon`
14
+ Then the JSON at "owner" should be %{USERID}
15
+
16
+ Scenario: When I give a resource away, I give all permissions
17
+ Given I successfully run `conjur resource create food:$ns/bacon`
18
+ And I create a new user named "alice@$ns"
19
+ And I successfully run `conjur resource give food:$ns/bacon user:alice@$ns`
20
+ And I login as "alice@$ns"
21
+ When I successfully run `conjur resource check food:$ns/bacon fry`
22
+ Then the stdout from "conjur resource check food:$ns/bacon fry" should contain "true"
@@ -0,0 +1,20 @@
1
+ Feature: Permit a privilege on a Resource
2
+
3
+ Background:
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+
6
+ Scenario: Permission can be granted to a new user
7
+
8
+ Given I create a new user named "alice@$ns"
9
+ And I successfully run `conjur resource permit food:$ns/bacon user:alice@$ns fry`
10
+ And I successfully run `conjur resource show food:$ns/bacon`
11
+ Then the JSON at "permissions" should have 1 item
12
+ And the JSON at "permissions/0/privilege" should be "fry"
13
+ And the JSON at "permissions/0/grant_option" should be false
14
+
15
+ Scenario: When granted with "grantable" option, the grantee can grant the privilege to other roles (supported since CLI 4.10.2)
16
+ Given I create a new user named "alice@$ns"
17
+ And I create a new user named "bob@$ns"
18
+ And I successfully run `conjur resource permit --grantable food:$ns/bacon user:alice@$ns fry`
19
+ And I login as "alice@$ns"
20
+ Then I successfully run `conjur resource permit food:$ns/bacon user:bob@$ns fry`
@@ -0,0 +1,16 @@
1
+ Feature: List roles which have a permission on a resource
2
+
3
+ Background:
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+
6
+ Scenario: The owner of a resource is always listed in permitted_roles
7
+ When I successfully run `conjur resource permitted_roles food:$ns/bacon fry`
8
+ Then the JSON should include %{MY_ROLEID}
9
+
10
+ Scenario: When a permission is granted to a new user, the user is listed in permitted_roles
11
+ Given I create a new user named "alice@$ns"
12
+ And I keep the JSON at "roleid" as "USERID"
13
+ And I successfully run `conjur resource permit food:$ns/bacon user:alice@$ns fry`
14
+ When I successfully run `conjur resource permitted_roles food:$ns/bacon fry`
15
+ Then the JSON should include %{USERID}
16
+
@@ -0,0 +1,26 @@
1
+ Feature: Show a resource
2
+
3
+ Background:
4
+ Given I successfully run `conjur resource create food:$ns/bacon`
5
+
6
+ Scenario: Showing a resource displays all its fields
7
+ When I successfully run `conjur resource show food:$ns/bacon`
8
+ Then the JSON should have "id"
9
+ And the JSON should have "owner"
10
+ And the JSON should have "permissions"
11
+ And the JSON should have "annotations"
12
+
13
+ Scenario: You can't show a resource on which you have no privileges
14
+ Given I login as a new user
15
+ When I run `conjur resource show food:$ns/bacon`
16
+ Then the exit status should be 1
17
+ And the output from "conjur resource show food:$ns/bacon" should contain "Forbidden"
18
+
19
+ Scenario: You can show any resource if you have a privilege on it
20
+ Once alice has a permission to fry bacon, she can show everything
21
+ about bacon.
22
+
23
+ Given I create a new user named "alice@$ns"
24
+ And I successfully run `conjur resource permit food:$ns/bacon user:alice@$ns fry`
25
+ And I login as "alice@$ns"
26
+ Then I successfully run `conjur resource show food:$ns/bacon`
@@ -0,0 +1,13 @@
1
+ Feature: Create a Role
2
+
3
+ Scenario: Create an abstract role
4
+ When I run `conjur role create job:$ns/chef`
5
+ Then the exit status should be 0
6
+ And the output should contain "Created role"
7
+
8
+ Scenario: Role owner has the new role listed in its memberships
9
+ When I run `conjur role create --json --as-group $ns/security_admin job:$ns/chef`
10
+ Then the exit status should be 0
11
+ And I keep the JSON response at "roleid" as "ROLEID"
12
+ And I run `conjur role memberships group:$ns/security_admin`
13
+ And the JSON should include %{ROLEID}
@@ -0,0 +1,19 @@
1
+ Feature: Test existance of a role
2
+
3
+ Scenario: A never-created role does not exist
4
+ When I successfully run `conjur role exists --json food:$ns/nonesuch`
5
+ Then the JSON at "exists" should be false
6
+
7
+ Scenario: A created role does exist
8
+ When I successfully run `conjur role create --json food:$ns/bacon`
9
+ And I keep the JSON response at "roleid" as "ROLEID"
10
+ And I successfully run `conjur role exists --json %{ROLEID}`
11
+ Then the JSON at "exists" should be true
12
+
13
+ Scenario: Even foreign user can check existance of a role
14
+ When I successfully run `conjur role create --json food:$ns/bacon`
15
+ And I keep the JSON response at "roleid" as "ROLEID"
16
+ And I login as a new user
17
+ And I run `conjur role exists --json %{ROLEID}`
18
+ Then the JSON at "exists" should be true
19
+
@@ -0,0 +1,21 @@
1
+ Feature: Grant membership in a role to another role
2
+
3
+ Scenario: Granting a role confers membership
4
+ When I successfully run `conjur role create job:$ns/cooks`
5
+ And I successfully run `conjur role create people:$ns/alice`
6
+ And I successfully run `conjur role grant_to job:$ns/cooks people:$ns/alice`
7
+ And I successfully run `conjur role members job:$ns/cooks`
8
+ Then the JSON should have 2 entries
9
+
10
+ Scenario: Granting a role gives the grantee permissions of the granted role
11
+ When I successfully run `conjur role create job:$ns/cooks`
12
+ And I successfully run `conjur role create people:$ns/alice`
13
+ And I successfully run `conjur resource create food:$ns/bacon`
14
+ And I successfully run `conjur resource permit food:$ns/bacon job:$ns/cooks fry`
15
+ And I successfully run `conjur resource check -r job:$ns/cooks food:$ns/bacon fry`
16
+ Then the output should contain "true"
17
+ When I successfully run `conjur resource check -r people:$ns/alice food:$ns/bacon fry`
18
+ Then the output should contain "false"
19
+ When I successfully run `conjur role grant_to job:$ns/cooks people:$ns/alice`
20
+ And I successfully run `conjur resource check -r people:$ns/alice food:$ns/bacon fry`
21
+ Then the output should contain "true"
@@ -0,0 +1,58 @@
1
+ @real-api
2
+ Feature: Retrieving role graphs
3
+ As a Conjur user
4
+ In order to understand the role hierarchy
5
+ I want to retrieve role graphs and present them in a useful format
6
+
7
+ Background:
8
+ Given a graph with edges
9
+ | Tywin | Jamie |
10
+ | Tywin | Cersei |
11
+ | Cersei | Joffrey |
12
+ | Jamie | Joffrey |
13
+ | Aerys | Tyrion |
14
+ | Joanna | Tyrion |
15
+
16
+ Scenario: Showing the graph as JSON
17
+ When I successfully run with role expansion "conjur role graph --as-role Joffrey Joffrey"
18
+ Then the graph JSON should be:
19
+ """
20
+ {
21
+ "graph": [
22
+ { "parent": "Tywin", "child": "Jamie" },
23
+ { "parent": "Tywin", "child": "Cersei"},
24
+ { "parent": "Cersei", "child": "Joffrey"},
25
+ { "parent": "Jamie", "child": "Joffrey" }
26
+ ]
27
+ }
28
+ """
29
+
30
+ Scenario: Short JSON output
31
+ When I successfully run with role expansion "conjur role graph --short --as-role Joffrey Joffrey"
32
+ Then the graph JSON should be:
33
+ """
34
+ [
35
+ [ "Tywin", "Jamie" ],
36
+ [ "Tywin", "Cersei" ],
37
+ [ "Jamie", "Joffrey" ],
38
+ [ "Cersei", "Joffrey"]
39
+ ]
40
+ """
41
+
42
+ Scenario: I can restrict the output to show only ancestors or descendants
43
+ When I successfully run with role expansion "conjur role graph --short --no-ancestors --as-role Cersei Cersei"
44
+ Then the graph JSON should be:
45
+ """
46
+ [
47
+ [ "Cersei", "Joffrey" ]
48
+ ]
49
+ """
50
+ When I successfully run with role expansion "conjur role graph --short --no-descendants --as-role Cersei Cersei Jamie"
51
+ Then the graph JSON should be:
52
+ """
53
+ [
54
+ [ "Tywin", "Cersei" ],
55
+ [ "Tywin", "Jamie" ]
56
+ ]
57
+ """
58
+
@@ -0,0 +1,23 @@
1
+ Feature: List members of a role
2
+
3
+ Scenario: Role members list is initally just the creator of the role
4
+ When I successfully run `conjur role create job:$ns/chef`
5
+ And I successfully run `conjur role members job:$ns/chef`
6
+ Then the JSON should have 1 entries
7
+
8
+ Scenario: Members can be added to the role by granting them the role
9
+ When I successfully run `conjur role create job:$ns/chef`
10
+ And I successfully run `conjur user create alice@$ns`
11
+ And I successfully run `conjur role grant_to job:$ns/chef user:alice@$ns`
12
+ And I successfully run `conjur role members job:$ns/chef`
13
+ Then the JSON should have 2 entries
14
+
15
+ Scenario: Members list is not expanded transitively
16
+ When I successfully run `conjur role create job:$ns/chef`
17
+ And I successfully run `conjur group create $ns/cooks`
18
+ And I successfully run `conjur user create alice@$ns`
19
+ And I successfully run `conjur group members add $ns/cooks user:alice@$ns`
20
+ When I successfully run `conjur role grant_to job:$ns/chef group:$ns/cooks`
21
+ And I successfully run `conjur role members job:$ns/chef`
22
+ Then the JSON should have 2 entries
23
+
@@ -0,0 +1,27 @@
1
+ Feature: List memberships of a role
2
+
3
+ Scenario: The role memberships list includes the role itself
4
+ Given I successfully run `conjur role create job:$ns/chef`
5
+ When I successfully run `conjur role memberships job:$ns/chef`
6
+ Then the JSON should have 1 entries
7
+
8
+ Scenario: Memberships can be added to a role by granting it a new role
9
+ Given I successfully run `conjur role create job:$ns/cook`
10
+ And I successfully run `conjur role create job:$ns/chef`
11
+ # Cooks are chefs
12
+ And I successfully run `conjur role grant_to job:$ns/cook job:$ns/chef`
13
+ When I successfully run `conjur role memberships job:$ns/chef`
14
+ # Therefore chefs are cooks and chefs
15
+ Then the JSON should have 2 entries
16
+
17
+ Scenario: Members list is expanded transitively
18
+ Given I successfully run `conjur role create person:$ns/myself`
19
+ And I successfully run `conjur role create job:$ns/cook`
20
+ And I successfully run `conjur role create job:$ns/chef`
21
+ # I am a chef
22
+ And I successfully run `conjur role grant_to job:$ns/chef person:$ns/myself`
23
+ # Chefs are cooks
24
+ And I successfully run `conjur role grant_to job:$ns/cook job:$ns/chef`
25
+ When I successfully run `conjur role memberships person:$ns/myself`
26
+ # Therefore I am me, a cook, and a chef
27
+ Then the JSON should have 3 entries