conjur-api 4.31.0 → 5.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +1 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +22 -3
  5. data/Dockerfile +12 -3
  6. data/Gemfile +3 -3
  7. data/Jenkinsfile +69 -0
  8. data/LICENSE.md +195 -0
  9. data/README.md +16 -0
  10. data/Rakefile +34 -18
  11. data/ci/wait_for_server.sh +10 -0
  12. data/conjur-api.gemspec +6 -14
  13. data/dev/docker-compose.yml +23 -0
  14. data/dev/empty.yml +2 -0
  15. data/dev/start.sh +15 -0
  16. data/dev/stop.sh +6 -0
  17. data/docker-compose.yml +27 -0
  18. data/features/exists.feature +37 -0
  19. data/features/group.feature +11 -0
  20. data/features/host.feature +20 -0
  21. data/features/host_factory_create_host.feature +28 -0
  22. data/features/host_factory_token.feature +63 -0
  23. data/features/load_policy.feature +61 -0
  24. data/features/members.feature +51 -0
  25. data/features/new_api.feature +36 -0
  26. data/features/permitted.feature +43 -0
  27. data/features/permitted_roles.feature +30 -0
  28. data/features/public_keys.feature +11 -0
  29. data/features/resource_fields.feature +53 -0
  30. data/features/role_fields.feature +15 -0
  31. data/features/rotate_api_key.feature +13 -0
  32. data/features/step_definitions/api_steps.rb +4 -54
  33. data/features/step_definitions/policy_steps.rb +35 -0
  34. data/features/step_definitions/result_steps.rb +7 -0
  35. data/features/support/env.rb +14 -5
  36. data/features/support/hooks.rb +3 -0
  37. data/features/support/world.rb +5 -6
  38. data/features/update_password.feature +14 -0
  39. data/features/user.feature +17 -0
  40. data/features/variable_fields.feature +20 -0
  41. data/features/variable_value.feature +67 -0
  42. data/lib/conjur/acts_as_resource.rb +95 -65
  43. data/lib/conjur/acts_as_role.rb +102 -51
  44. data/lib/conjur/{audit-api.rb → acts_as_rolsource.rb} +10 -14
  45. data/lib/conjur/acts_as_user.rb +13 -22
  46. data/lib/conjur/api/authn.rb +37 -72
  47. data/lib/conjur/api/host_factories.rb +35 -55
  48. data/lib/conjur/api/policies.rb +56 -0
  49. data/lib/conjur/api/pubkeys.rb +36 -160
  50. data/lib/conjur/api/resources.rb +32 -116
  51. data/lib/conjur/api/roles.rb +28 -105
  52. data/lib/conjur/api/variables.rb +22 -91
  53. data/lib/conjur/api.rb +19 -46
  54. data/lib/conjur/base.rb +21 -132
  55. data/lib/conjur/base_object.rb +57 -0
  56. data/lib/conjur/{authn-api.rb → build_object.rb} +23 -11
  57. data/lib/conjur/cast.rb +12 -17
  58. data/lib/conjur/cert_utils.rb +1 -1
  59. data/lib/conjur/cidr.rb +1 -1
  60. data/lib/conjur/configuration.rb +13 -91
  61. data/lib/conjur/escape.rb +1 -2
  62. data/lib/conjur/group.rb +9 -65
  63. data/lib/conjur/has_attributes.rb +22 -59
  64. data/lib/conjur/host.rb +5 -35
  65. data/lib/conjur/host_factory.rb +40 -40
  66. data/lib/conjur/host_factory_token.rb +38 -23
  67. data/lib/conjur/id.rb +63 -0
  68. data/lib/conjur/layer.rb +5 -80
  69. data/lib/conjur/log.rb +1 -1
  70. data/lib/conjur/log_source.rb +1 -1
  71. data/lib/conjur/{secret.rb → policy.rb} +11 -14
  72. data/lib/conjur/{api/secrets.rb → policy_load_result.rb} +35 -22
  73. data/lib/conjur/query_string.rb +2 -1
  74. data/lib/conjur/resource.rb +5 -299
  75. data/lib/conjur/role.rb +5 -317
  76. data/lib/conjur/role_grant.rb +20 -28
  77. data/lib/conjur/user.rb +5 -63
  78. data/lib/conjur/variable.rb +31 -76
  79. data/lib/conjur/{authz-api.rb → webservice.rb} +8 -16
  80. data/lib/conjur-api/version.rb +2 -2
  81. data/publish.sh +7 -0
  82. data/spec/api_spec.rb +208 -0
  83. data/spec/cast_spec.rb +21 -0
  84. data/spec/{lib/cert_utils_spec.rb → cert_utils_spec.rb} +0 -0
  85. data/spec/{lib/cidr_spec.rb → cidr_spec.rb} +0 -0
  86. data/spec/{lib/configuration_spec.rb → configuration_spec.rb} +40 -140
  87. data/spec/{lib/has_attributes_spec.rb → has_attributes_spec.rb} +6 -2
  88. data/spec/{lib/log_source_spec.rb → log_source_spec.rb} +0 -0
  89. data/spec/{lib/log_spec.rb → log_spec.rb} +0 -0
  90. data/spec/roles_spec.rb +24 -0
  91. data/spec/spec_helper.rb +63 -78
  92. data/spec/ssl_spec.rb +3 -5
  93. data/spec/vendor/rest_client_spec.rb +0 -54
  94. data/test.sh +40 -0
  95. metadata +122 -281
  96. data/.kateproject +0 -5
  97. data/LICENSE +0 -22
  98. data/ci/test.sh +0 -9
  99. data/features/audit_resources.feature +0 -15
  100. data/features/audit_roles.feature +0 -15
  101. data/features/bootstrap.feature +0 -31
  102. data/features/step_definitions/cli_steps.rb +0 -5
  103. data/jenkins.sh +0 -27
  104. data/lib/conjur/acts_as_asset.rb +0 -88
  105. data/lib/conjur/annotations.rb +0 -186
  106. data/lib/conjur/api/audit.rb +0 -138
  107. data/lib/conjur/api/deputies.rb +0 -57
  108. data/lib/conjur/api/groups.rb +0 -111
  109. data/lib/conjur/api/hosts.rb +0 -109
  110. data/lib/conjur/api/info.rb +0 -126
  111. data/lib/conjur/api/layers.rb +0 -62
  112. data/lib/conjur/api/ldapsync.rb +0 -115
  113. data/lib/conjur/api/users.rb +0 -106
  114. data/lib/conjur/bootstrap.rb +0 -161
  115. data/lib/conjur/build_from_response.rb +0 -49
  116. data/lib/conjur/core-api.rb +0 -74
  117. data/lib/conjur/deputy.rb +0 -55
  118. data/lib/conjur/env.rb +0 -54
  119. data/lib/conjur/event_source.rb +0 -101
  120. data/lib/conjur/exists.rb +0 -60
  121. data/lib/conjur/graph.rb +0 -295
  122. data/lib/conjur/has_id.rb +0 -43
  123. data/lib/conjur/has_identifier.rb +0 -36
  124. data/lib/conjur/has_owner.rb +0 -51
  125. data/lib/conjur/host-factory-api.rb +0 -38
  126. data/lib/conjur/layer-api.rb +0 -13
  127. data/lib/conjur/ldap_sync_job.rb +0 -89
  128. data/lib/conjur/path_based.rb +0 -86
  129. data/lib/conjur/pubkeys-api.rb +0 -50
  130. data/lib/conjur/standard_methods.rb +0 -91
  131. data/reqspeed.rb +0 -20
  132. data/spec/api/authn_spec.rb +0 -81
  133. data/spec/api/graph_spec.rb +0 -117
  134. data/spec/api/groups_spec.rb +0 -40
  135. data/spec/api/hosts_spec.rb +0 -36
  136. data/spec/api/info_spec.rb +0 -89
  137. data/spec/api/layer_spec.rb +0 -18
  138. data/spec/api/ldapsync_spec.rb +0 -44
  139. data/spec/api/pubkeys_spec.rb +0 -66
  140. data/spec/api/resources_spec.rb +0 -92
  141. data/spec/api/roles_spec.rb +0 -100
  142. data/spec/api/secrets_spec.rb +0 -16
  143. data/spec/api/users_spec.rb +0 -71
  144. data/spec/api/variables_spec.rb +0 -112
  145. data/spec/cas_rest_client.rb +0 -17
  146. data/spec/cidr_helper.rb +0 -24
  147. data/spec/lib/acts_as_user_spec.rb +0 -27
  148. data/spec/lib/annotations_spec.rb +0 -109
  149. data/spec/lib/api_spec.rb +0 -480
  150. data/spec/lib/asset_spec.rb +0 -80
  151. data/spec/lib/audit_spec.rb +0 -155
  152. data/spec/lib/build_from_response_spec.rb +0 -49
  153. data/spec/lib/deputy_spec.rb +0 -25
  154. data/spec/lib/exists_spec.rb +0 -24
  155. data/spec/lib/group_spec.rb +0 -18
  156. data/spec/lib/host_spec.rb +0 -31
  157. data/spec/lib/resource_spec.rb +0 -240
  158. data/spec/lib/role_grant_spec.rb +0 -13
  159. data/spec/lib/role_spec.rb +0 -231
  160. data/spec/lib/standard_methods_spec.rb +0 -66
  161. data/spec/lib/user_spec.rb +0 -77
  162. data/spec/standard_methods_helper.rb +0 -41
  163. data/spec/variable_spec.rb +0 -101
  164. data/spec/vcr_cassettes/Conjur_Resource/_create/with_path-like_identifier.yml +0 -87
  165. data/spec/vcr_cassettes/Conjur_Resource/_create/with_un-encoded_path-like_identifier.yml +0 -87
  166. data/spec/vcr_cassettes/Conjur_Resource/_create/with_uuid_identifier.yml +0 -87
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b84596e733b93800963e2ac84ea2fac5155a8b97
4
- data.tar.gz: e16ebc289ad64de1e0b7725d1fb2707257bc17ea
3
+ metadata.gz: 1a5609c6a2c127ddc1329b71e59095309a270385
4
+ data.tar.gz: 9713764c3253c5a6a05a99633625a3d04c3068ee
5
5
  SHA512:
6
- metadata.gz: bc34db065767e08c6287fb4c420e9e86c21a57201d9398e250d6dfe1bea6006c3271d6751d90ad362d9ce3d6ba2e35ceb29199a6f5b5fcaa27f4d0c6a41b490c
7
- data.tar.gz: 0a33fc0d59135d23dfa9bc1d79371a403f82c5619fab374da83bc1ab00ce8ec7e0799d8bc888aba01b6d347333bd10e5a6f59f8d18ff569cf87d0f3453c81709
6
+ metadata.gz: 54b5a236b0182ed7ebfbbe7ef8f8fc180ad7218bea1f87c6b936cb7f34f60c7963802d4a998968dcbcb721684a78b098977afb9fcc071e83bc8a45524c2dca5a
7
+ data.tar.gz: c317b6dae1449391385a9167633107f40192fe53a4233c57985e2fb2226143d1bbd800147d6a8107e5e68b4e09c1667e947565f1677ff5f76af434bfe9dda5eb
data/.dockerignore ADDED
@@ -0,0 +1 @@
1
+ Gemfile.lock
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  features/reports
2
+ dev/data_key
2
3
  .DS_Store
3
4
  build_number
4
5
  *.gem
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # Latest
2
+
3
+ # v5.0.0-rc.1
4
+
5
+ * Provides compatibility with [cyberark/conjur](https://github.com/cyberark/conjur), Conjur 5 CE.
6
+ * Changed license to Apache 2.0
7
+
8
+ # v5.0.0-beta.4
9
+
10
+ * Support for batch secret retrieval.
11
+
12
+ # v5.0.0-beta.3
13
+
14
+ * Removed hard dependency on older version of `rest-client` gem.
15
+
16
+ # v5.0.0-beta.1
17
+
18
+ * Migrated to be compatible with Conjur 5 API.
19
+
1
20
  # v4.31.0
2
21
 
3
22
  * Internal refactor to improve performance and facilitate caching.
@@ -37,7 +56,7 @@ On older server versions, the new options will be ignored by the server.
37
56
 
38
57
  * Add `Conjur::API#ldap_sync_policy` to fetch the policy to use to
39
58
  bring Conjur and the LDAP server into sync.
40
-
59
+
41
60
  * Remove `Conjur::API#ldap_sync_now` and `Conjur::API#ldap_sync_jobs`
42
61
 
43
62
  # v4.27.0
@@ -137,7 +156,7 @@ occurs before the Conjur 4.5 server that implements `elevate` is released.
137
156
 
138
157
  # v4.16.0
139
158
  * Add ssl_certificate option to allow certs to be provided as strings (helpful in heroku)
140
- * Add `Conjur::Configuration#apply_cert_config!` method to add certs from `#cert_file` and `#ssl_certificate`
159
+ * Add `Conjur::Configuration#apply_cert_config!` method to add certs from `#cert_file` and `#ssl_certificate`
141
160
  to the default cert store.
142
161
  # v4.15.0
143
162
  * Extensive documentation improvements
@@ -178,6 +197,6 @@ occurs before the Conjur 4.5 server that implements `elevate` is released.
178
197
  * Tests use Rspec v3 and reset configuration between test cases
179
198
 
180
199
 
181
- # v.4.10.1
200
+ # v.4.10.1
182
201
  * Resource#exists? returns true if access to resource is forbidden
183
202
  * Thread-local configuration for working with different endpoints
data/Dockerfile CHANGED
@@ -1,4 +1,13 @@
1
- FROM ruby:1.9.3
1
+ FROM ruby:2.3
2
2
 
3
- RUN mkdir /src
4
- WORKDIR /src
3
+ WORKDIR /src/conjur-api
4
+
5
+ COPY Gemfile conjur-api.gemspec ./
6
+ COPY lib/conjur-api/version.rb ./lib/conjur-api/
7
+
8
+ RUN bundle
9
+
10
+ COPY . ./
11
+
12
+ ENTRYPOINT ["/usr/local/bin/bundle", "exec"]
13
+ CMD ["rake", "jenkins"]
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- #ruby=ruby-2.2.5
3
+ #ruby=ruby-2.3
4
4
  #ruby-gemset=conjur-api
5
5
 
6
6
  # Specify your gem's dependencies in conjur-api.gemspec
7
7
  gemspec
8
8
 
9
- group :development do
10
- gem 'pry-byebug'
9
+ group :test do
10
+ gem 'simplecov', require: false
11
11
  end
data/Jenkinsfile ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env groovy
2
+
3
+ pipeline {
4
+ agent { label 'executor-v2' }
5
+
6
+ options {
7
+ timestamps()
8
+ buildDiscarder(logRotator(numToKeepStr: '30'))
9
+ }
10
+
11
+ stages {
12
+ stage('Test') {
13
+ steps {
14
+ milestone(1)
15
+ sh './test.sh'
16
+
17
+ junit 'spec/reports/*.xml'
18
+ junit 'features/reports/*.xml'
19
+ }
20
+ }
21
+
22
+ // Only publish to RubyGems if branch is 'master'
23
+ // AND someone confirms this stage within 5 minutes
24
+ stage('Publish to RubyGems?') {
25
+ agent { label 'releaser-v2' }
26
+
27
+ when {
28
+ allOf {
29
+ branch 'master'
30
+ expression {
31
+ boolean publish = false
32
+
33
+ if (env.PUBLISH_GEM == "true") {
34
+ return true
35
+ }
36
+
37
+ try {
38
+ timeout(time: 5, unit: 'MINUTES') {
39
+ input(message: 'Publish to RubyGems?')
40
+ publish = true
41
+ }
42
+ } catch (final ignore) {
43
+ publish = false
44
+ }
45
+
46
+ return publish
47
+ }
48
+ }
49
+ }
50
+ steps {
51
+ sh './publish.sh'
52
+ // Clean up
53
+ sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd'
54
+ }
55
+ }
56
+ }
57
+
58
+ post {
59
+ always {
60
+ sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd'
61
+ }
62
+ failure {
63
+ slackSend(color: 'danger', message: "${env.JOB_NAME} #${env.BUILD_NUMBER} FAILURE (<${env.BUILD_URL}|Open>)")
64
+ }
65
+ unstable {
66
+ slackSend(color: 'warning', message: "${env.JOB_NAME} #${env.BUILD_NUMBER} UNSTABLE (<${env.BUILD_URL}|Open>)")
67
+ }
68
+ }
69
+ }
data/LICENSE.md ADDED
@@ -0,0 +1,195 @@
1
+ Apache License
2
+ ==============
3
+
4
+ _Version 2.0, January 2004_
5
+ _&lt;<http://www.apache.org/licenses/>&gt;_
6
+
7
+ ### Terms and Conditions for use, reproduction, and distribution
8
+
9
+ #### 1. Definitions
10
+
11
+ “License” shall mean the terms and conditions for use, reproduction, and
12
+ distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ “Licensor” shall mean the copyright owner or entity authorized by the copyright
15
+ owner that is granting the License.
16
+
17
+ “Legal Entity” shall mean the union of the acting entity and all other entities
18
+ that control, are controlled by, or are under common control with that entity.
19
+ For the purposes of this definition, “control” means **(i)** the power, direct or
20
+ indirect, to cause the direction or management of such entity, whether by
21
+ contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or **(iii)** beneficial ownership of such entity.
23
+
24
+ “You” (or “Your”) shall mean an individual or Legal Entity exercising
25
+ permissions granted by this License.
26
+
27
+ “Source” form shall mean the preferred form for making modifications, including
28
+ but not limited to software source code, documentation source, and configuration
29
+ files.
30
+
31
+ “Object” form shall mean any form resulting from mechanical transformation or
32
+ translation of a Source form, including but not limited to compiled object code,
33
+ generated documentation, and conversions to other media types.
34
+
35
+ “Work” shall mean the work of authorship, whether in Source or Object form, made
36
+ available under the License, as indicated by a copyright notice that is included
37
+ in or attached to the work (an example is provided in the Appendix below).
38
+
39
+ “Derivative Works” shall mean any work, whether in Source or Object form, that
40
+ is based on (or derived from) the Work and for which the editorial revisions,
41
+ annotations, elaborations, or other modifications represent, as a whole, an
42
+ original work of authorship. For the purposes of this License, Derivative Works
43
+ shall not include works that remain separable from, or merely link (or bind by
44
+ name) to the interfaces of, the Work and Derivative Works thereof.
45
+
46
+ “Contribution” shall mean any work of authorship, including the original version
47
+ of the Work and any modifications or additions to that Work or Derivative Works
48
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
49
+ by the copyright owner or by an individual or Legal Entity authorized to submit
50
+ on behalf of the copyright owner. For the purposes of this definition,
51
+ “submitted” means any form of electronic, verbal, or written communication sent
52
+ to the Licensor or its representatives, including but not limited to
53
+ communication on electronic mailing lists, source code control systems, and
54
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
55
+ the purpose of discussing and improving the Work, but excluding communication
56
+ that is conspicuously marked or otherwise designated in writing by the copyright
57
+ owner as “Not a Contribution.”
58
+
59
+ “Contributor” shall mean Licensor and any individual or Legal Entity on behalf
60
+ of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ #### 2. Grant of Copyright License
64
+
65
+ Subject to the terms and conditions of this License, each Contributor hereby
66
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
67
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
68
+ publicly display, publicly perform, sublicense, and distribute the Work and such
69
+ Derivative Works in Source or Object form.
70
+
71
+ #### 3. Grant of Patent License
72
+
73
+ Subject to the terms and conditions of this License, each Contributor hereby
74
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
75
+ irrevocable (except as stated in this section) patent license to make, have
76
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
77
+ such license applies only to those patent claims licensable by such Contributor
78
+ that are necessarily infringed by their Contribution(s) alone or by combination
79
+ of their Contribution(s) with the Work to which such Contribution(s) was
80
+ submitted. If You institute patent litigation against any entity (including a
81
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
82
+ Contribution incorporated within the Work constitutes direct or contributory
83
+ patent infringement, then any patent licenses granted to You under this License
84
+ for that Work shall terminate as of the date such litigation is filed.
85
+
86
+ #### 4. Redistribution
87
+
88
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
89
+ in any medium, with or without modifications, and in Source or Object form,
90
+ provided that You meet the following conditions:
91
+
92
+ * **(a)** You must give any other recipients of the Work or Derivative Works a copy of
93
+ this License; and
94
+ * **(b)** You must cause any modified files to carry prominent notices stating that You
95
+ changed the files; and
96
+ * **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
97
+ all copyright, patent, trademark, and attribution notices from the Source form
98
+ of the Work, excluding those notices that do not pertain to any part of the
99
+ Derivative Works; and
100
+ * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
101
+ Derivative Works that You distribute must include a readable copy of the
102
+ attribution notices contained within such NOTICE file, excluding those notices
103
+ that do not pertain to any part of the Derivative Works, in at least one of the
104
+ following places: within a NOTICE text file distributed as part of the
105
+ Derivative Works; within the Source form or documentation, if provided along
106
+ with the Derivative Works; or, within a display generated by the Derivative
107
+ Works, if and wherever such third-party notices normally appear. The contents of
108
+ the NOTICE file are for informational purposes only and do not modify the
109
+ License. You may add Your own attribution notices within Derivative Works that
110
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
111
+ provided that such additional attribution notices cannot be construed as
112
+ modifying the License.
113
+
114
+ You may add Your own copyright statement to Your modifications and may provide
115
+ additional or different license terms and conditions for use, reproduction, or
116
+ distribution of Your modifications, or for any such Derivative Works as a whole,
117
+ provided Your use, reproduction, and distribution of the Work otherwise complies
118
+ with the conditions stated in this License.
119
+
120
+ #### 5. Submission of Contributions
121
+
122
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
123
+ for inclusion in the Work by You to the Licensor shall be under the terms and
124
+ conditions of this License, without any additional terms or conditions.
125
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
126
+ any separate license agreement you may have executed with Licensor regarding
127
+ such Contributions.
128
+
129
+ #### 6. Trademarks
130
+
131
+ This License does not grant permission to use the trade names, trademarks,
132
+ service marks, or product names of the Licensor, except as required for
133
+ reasonable and customary use in describing the origin of the Work and
134
+ reproducing the content of the NOTICE file.
135
+
136
+ #### 7. Disclaimer of Warranty
137
+
138
+ Unless required by applicable law or agreed to in writing, Licensor provides the
139
+ Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
141
+ including, without limitation, any warranties or conditions of TITLE,
142
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
143
+ solely responsible for determining the appropriateness of using or
144
+ redistributing the Work and assume any risks associated with Your exercise of
145
+ permissions under this License.
146
+
147
+ #### 8. Limitation of Liability
148
+
149
+ In no event and under no legal theory, whether in tort (including negligence),
150
+ contract, or otherwise, unless required by applicable law (such as deliberate
151
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
152
+ liable to You for damages, including any direct, indirect, special, incidental,
153
+ or consequential damages of any character arising as a result of this License or
154
+ out of the use or inability to use the Work (including but not limited to
155
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
156
+ any and all other commercial damages or losses), even if such Contributor has
157
+ been advised of the possibility of such damages.
158
+
159
+ #### 9. Accepting Warranty or Additional Liability
160
+
161
+ While redistributing the Work or Derivative Works thereof, You may choose to
162
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
163
+ other liability obligations and/or rights consistent with this License. However,
164
+ in accepting such obligations, You may act only on Your own behalf and on Your
165
+ sole responsibility, not on behalf of any other Contributor, and only if You
166
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
167
+ incurred by, or claims asserted against, such Contributor by reason of your
168
+ accepting any such warranty or additional liability.
169
+
170
+ _END OF TERMS AND CONDITIONS_
171
+
172
+ ### APPENDIX: How to apply the Apache License to your work
173
+
174
+ To apply the Apache License to your work, attach the following boilerplate
175
+ notice, with the fields enclosed by brackets `[]` replaced with your own
176
+ identifying information. (Don't include the brackets!) The text should be
177
+ enclosed in the appropriate comment syntax for the file format. We also
178
+ recommend that a file or class name and description of purpose be included on
179
+ the same “printed page” as the copyright notice for easier identification within
180
+ third-party archives.
181
+
182
+ Copyright [yyyy] [name of copyright owner]
183
+
184
+ Licensed under the Apache License, Version 2.0 (the "License");
185
+ you may not use this file except in compliance with the License.
186
+ You may obtain a copy of the License at
187
+
188
+ http://www.apache.org/licenses/LICENSE-2.0
189
+
190
+ Unless required by applicable law or agreed to in writing, software
191
+ distributed under the License is distributed on an "AS IS" BASIS,
192
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193
+ See the License for the specific language governing permissions and
194
+ limitations under the License.
195
+
data/README.md CHANGED
@@ -102,3 +102,19 @@ prefixed with `host/`. For example: `host/myhost.example.com`, not just `myhost.
102
102
  3. Commit your changes (`git commit -am 'Added some feature'`)
103
103
  4. Push to the branch (`git push origin my-new-feature`)
104
104
  5. Create new Pull Request
105
+
106
+ ## License
107
+
108
+ Copyright 2016-2017 CyberArk
109
+
110
+ Licensed under the Apache License, Version 2.0 (the "License");
111
+ you may not use this software except in compliance with the License.
112
+ You may obtain a copy of the License at
113
+
114
+ http://www.apache.org/licenses/LICENSE-2.0
115
+
116
+ Unless required by applicable law or agreed to in writing, software
117
+ distributed under the License is distributed on an "AS IS" BASIS,
118
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
+ See the License for the specific language governing permissions and
120
+ limitations under the License.
data/Rakefile CHANGED
@@ -1,25 +1,41 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
- require "yard"
4
- require 'ci/reporter/rake/rspec'
5
- require 'cucumber'
6
- require 'cucumber/rake/task'
7
- require 'rspec/core/rake_task'
8
3
 
9
- RSpec::Core::RakeTask.new :spec
10
- Cucumber::Rake::Task.new :features
11
- YARD::Rake::YardocTask.new(:yard)
4
+ begin
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new :spec
7
+ rescue LoadError
8
+ warn "rspec-core not found, rspec task will be unavailable"
9
+ end
10
+
11
+ begin
12
+ require "yard"
13
+ YARD::Rake::YardocTask.new(:yard)
14
+ rescue LoadError
15
+ warn "yard not found, yard task will be unavailable"
16
+ end
17
+
18
+ require 'fileutils'
19
+ task(:init_coverage) { FileUtils.rm_rf 'coverage' }
20
+ task(:cuke_report_cleanup) { FileUtils.rm_rf 'features/reports' }
21
+
22
+ begin
23
+ require 'cucumber'
24
+ require 'cucumber/rake/task'
25
+
26
+ Cucumber::Rake::Task.new(:cucumber) do |t|
27
+ t.cucumber_opts = "--tags ~@wip --format pretty --format junit --out features/reports"
28
+ end
12
29
 
13
- task :jenkins => ['ci:setup:rspec', :spec] do
14
- if ENV['BUILD_NUMBER']
15
- File.write('build_number', ENV['BUILD_NUMBER'])
30
+ begin
31
+ require 'ci/reporter/rake/rspec'
32
+ desc "Run the spec and cucumber suites, compute the test results and coverage statistics, build Yard docs"
33
+ task :jenkins => [:init_coverage, :"ci:setup:rspec", :spec, :cuke_report_cleanup, :cucumber, :yard]
34
+ task default: [ :jenkins ]
35
+ rescue LoadError
36
+ warn "ci_reporter_rspec not found, jenkins task will be unavailable"
16
37
  end
17
- require 'fileutils'
18
- FileUtils.rm_rf 'features/reports'
19
- Cucumber::Rake::Task.new do |t|
20
- t.cucumber_opts = "--tags ~@real-api --format pretty --format junit --out features/reports"
21
- end.runner.run
22
- Rake::Task["yard"].invoke
38
+ rescue LoadError
39
+ warn "cucumber not found, cucumber task will be unavailable"
23
40
  end
24
41
 
25
- task default: [:spec, :features]
@@ -0,0 +1,10 @@
1
+ #!/bin/bash -e
2
+
3
+ for _ in $(seq 20); 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-api.gemspec CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["rafal@conjur.net","kgilpin@conjur.net"]
7
7
  gem.description = %q{Conjur API}
8
8
  gem.summary = %q{Conjur API}
9
- gem.homepage = "https://github.com/conjurinc/api-ruby/"
10
- gem.license = "MIT"
9
+ gem.homepage = "https://github.com/cyberark/conjur-api-ruby/"
10
+ gem.license = "Apache-2.0"
11
11
 
12
12
  gem.files = `git ls-files`.split($\) + Dir['build_number']
13
13
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -18,27 +18,19 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.required_ruby_version = '>= 1.9'
20
20
 
21
-
22
- gem.add_dependency 'rest-client', '~> 1.7', '>= 1.7.3'
21
+ gem.add_dependency 'rest-client'
23
22
  gem.add_dependency 'activesupport'
24
- gem.add_dependency 'semantic'
25
-
23
+
26
24
  gem.add_development_dependency 'rake', '~> 10.0'
27
- gem.add_development_dependency 'spork'
28
25
  gem.add_development_dependency 'rspec', '~> 3'
29
26
  gem.add_development_dependency 'rspec-expectations', '~> 3.4'
30
- gem.add_development_dependency 'webmock'
31
- gem.add_development_dependency 'aruba', '~> 0.12.0'
27
+ gem.add_development_dependency 'json_spec'
32
28
  gem.add_development_dependency 'cucumber'
33
- gem.add_development_dependency 'conjur-cli'
34
- gem.add_development_dependency 'conjur-debify'
35
29
  gem.add_development_dependency 'ci_reporter_rspec'
36
30
  gem.add_development_dependency 'simplecov'
37
31
  gem.add_development_dependency 'io-grab'
38
32
  gem.add_development_dependency 'rdoc'
39
33
  gem.add_development_dependency 'yard'
40
- gem.add_development_dependency 'redcarpet'
41
- gem.add_development_dependency 'tins', '~> 1.6', '< 1.7.0'
42
- gem.add_development_dependency 'inch'
43
34
  gem.add_development_dependency 'fakefs'
35
+ gem.add_development_dependency 'pry-byebug'
44
36
  end
@@ -0,0 +1,23 @@
1
+ version: '2'
2
+ services:
3
+ postgres:
4
+ image: postgres:9.3
5
+
6
+ conjur:
7
+ command: server -a cucumber -f /run/empty.yml
8
+ environment:
9
+ DATABASE_URL: postgres://postgres@pg/postgres
10
+ CONJUR_ADMIN_PASSWORD: admin
11
+ CONJUR_DATA_KEY:
12
+ volumes:
13
+ - ./empty.yml:/run/empty.yml:ro
14
+
15
+ conjur-cli:
16
+ build: ..
17
+ entrypoint: sleep
18
+ command: infinity
19
+ environment:
20
+ CONJUR_APPLIANCE_URL: http://conjur
21
+ CONJUR_ACCOUNT: cucumber
22
+ volumes:
23
+ - ..:/src/conjur-api-ruby
data/dev/empty.yml ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ []
data/dev/start.sh ADDED
@@ -0,0 +1,15 @@
1
+ #!/bin/bash -ex
2
+
3
+ export COMPOSE_PROJECT_NAME=apirubydev
4
+
5
+ docker-compose build
6
+
7
+ if [ ! -f data_key ]; then
8
+ echo "Generating data key"
9
+ docker-compose run --no-deps --rm --entrypoint conjur conjurctl data-key generate > data_key
10
+ fi
11
+
12
+ export CONJUR_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,6 @@
1
+ #!/bin/bash -ex
2
+
3
+ export COMPOSE_PROJECT_NAME=apirubydev
4
+
5
+ docker-compose stop
6
+ docker-compose rm -f
@@ -0,0 +1,27 @@
1
+ version: '2.1'
2
+ services:
3
+ postgres:
4
+ image: postgres:9.3
5
+
6
+ conjur:
7
+ image: registry.tld/cyberark/conjur:0.1.0-stable
8
+ command: server -a cucumber
9
+ environment:
10
+ DATABASE_URL: postgres://postgres@postgres/postgres
11
+ CONJUR_DATA_KEY: 'WMfApcDBtocRWV+ZSUP3Tjr5XNU+Z2FdBb6BEezejIs='
12
+ depends_on:
13
+ - postgres
14
+ # healthcheck:
15
+ # test: ['CMD', 'curl', '-f', '-X OPTIONS', 'http://localhost']
16
+ # interval: 2s
17
+ # timeout: 1s
18
+ # retries: 5
19
+
20
+ tester:
21
+ build: .
22
+ volumes:
23
+ - ./spec/reports:/src/conjur-api/spec/reports
24
+ - ./features/reports:/src/conjur-api/features/reports
25
+ environment:
26
+ CONJUR_APPLIANCE_URL: http://conjur
27
+ CONJUR_ACCOUNT: cucumber
@@ -0,0 +1,37 @@
1
+ Feature: Check if an object exists.
2
+
3
+ Background:
4
+ Given I run the code:
5
+ """
6
+ $conjur.load_policy 'root', <<-POLICY
7
+ - !group developers
8
+ POLICY
9
+ """
10
+
11
+ Scenario: A created group resource exists
12
+ When I run the code:
13
+ """
14
+ $conjur.resource('cucumber:group:developers').exists?
15
+ """
16
+ Then the result should be "true"
17
+
18
+ Scenario: An un-created resource doesn't exist
19
+ When I run the code:
20
+ """
21
+ $conjur.resource('cucumber:food:bacon').exists?
22
+ """
23
+ Then the result should be "false"
24
+
25
+ Scenario: A created group role exists
26
+ When I run the code:
27
+ """
28
+ $conjur.role('cucumber:group:developers').exists?
29
+ """
30
+ Then the result should be "true"
31
+
32
+ Scenario: An un-created role doesn't exist
33
+ When I run the code:
34
+ """
35
+ $conjur.role('cucumber:food:bacon').exists?
36
+ """
37
+ Then the result should be "false"
@@ -0,0 +1,11 @@
1
+ Feature: Display Group object fields.
2
+
3
+ Background:
4
+ Given a new group
5
+
6
+ Scenario: Group has a gidnumber.
7
+ Then I run the code:
8
+ """
9
+ @group.gidnumber
10
+ """
11
+ Then the result should be "1000"
@@ -0,0 +1,20 @@
1
+ Feature: Display Host object fields.
2
+
3
+ Background:
4
+ Given a new host
5
+
6
+ Scenario: API key of a newly created host is available and valid.
7
+ Then I run the code:
8
+ """
9
+ expect(@host.exists?).to be(true)
10
+ expect(@host.api_key).to be
11
+ Conjur::API.new_from_key(@host.login, @host.api_key).token
12
+ """
13
+
14
+ Scenario: API key of a a host can be rotated.
15
+ Then I run the code:
16
+ """
17
+ host = Conjur::API.new_from_key(@host.login, @host.api_key).resource(@host.id)
18
+ api_key = host.rotate_api_key
19
+ Conjur::API.new_from_key(@host.login, api_key).token
20
+ """