conjur-cli 6.2.2 → 6.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,11 @@ class Conjur::Command::Users < Conjur::Command
47
47
  if api.username == options[:user]
48
48
  exit_now! 'To rotate the API key of the currently logged-in user, use this command without any flags or options'
49
49
  end
50
- puts api.resource([ Conjur.configuration.account, "user", options[:user] ].join(":")).rotate_api_key
50
+ user_resource_id = [Conjur.configuration.account, "user", options[:user]].join(":")
51
+ unless api.resource(user_resource_id).exists?
52
+ exit_now! "User '#{options[:user]}' not found"
53
+ end
54
+ puts api.resource(user_resource_id).rotate_api_key
51
55
  else
52
56
  username, password = Conjur::Authn.read_credentials
53
57
  new_api_key = Conjur::API.rotate_api_key username, password
@@ -19,6 +19,6 @@
19
19
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  #
21
21
  module Conjur
22
- VERSION = '6.2.2'
22
+ VERSION = '6.2.3'
23
23
  ::Version=VERSION
24
24
  end
data/push-image CHANGED
@@ -3,6 +3,7 @@
3
3
  set -e
4
4
 
5
5
  readonly REGISTRY="cyberark"
6
+ readonly INTERNAL_REGISTRY="registry2.itci.conjur.net"
6
7
  readonly VERSION="$(cat VERSION)"
7
8
  readonly VERSION_TAG="5-${VERSION}"
8
9
  readonly image_name="conjur-cli"
@@ -22,17 +23,24 @@ git_description=$(git describe)
22
23
  # only when tag matches the VERSION, push VERSION and latest releases
23
24
  # and x and x.y releases
24
25
  #Ex: v5-6.2.1
25
- if [ "$git_description" = "v${VERSION_TAG}" ]; then
26
- echo "Revision $git_description matches version $VERSION exactly. Pushing to Dockerhub..."
26
+ if [ "${git_description}" = "v${VERSION}" ]; then
27
+ echo "Revision ${git_description} matches version ${VERSION} exactly. Pushing to Dockerhub..."
27
28
 
28
29
  for tag in "${TAGS[@]}"; do
29
- echo "Tagging and pushing $REGISTRY/$image_name:$tag"
30
+ echo "Tagging and pushing ${REGISTRY}/${image_name}:${tag}"
31
+
32
+ # push to dockerhub
33
+ docker tag "${full_image_name}" "${REGISTRY}/${image_name}:${tag}"
34
+ docker push "${REGISTRY}/${image_name}:${tag}"
35
+
36
+ # push to internal registry
37
+ # necessary because some cyberark teams/networks can't pull from dockerhub
38
+ docker tag "${full_image_name}" "${INTERNAL_REGISTRY}/${image_name}:${tag}"
39
+ docker push "${INTERNAL_REGISTRY}/${image_name}:${tag}"
30
40
 
31
- docker tag $full_image_name "$REGISTRY/$image_name:$tag"
32
- docker push "$REGISTRY/$image_name:$tag"
33
41
  done
34
42
 
35
43
  # push to legacy `conjurinc/cli5` tag
36
- docker tag $full_image_name conjurinc/cli5:latest
44
+ docker tag "${full_image_name}" conjurinc/cli5:latest
37
45
  docker push conjurinc/cli5:latest
38
46
  fi
@@ -9,13 +9,19 @@ describe Conjur::Command::Hosts, logged_in: true do
9
9
  expect(RestClient::Request).to receive(:execute).with({
10
10
  method: :head,
11
11
  url: "https://core.example.com/api/resources/#{account}/host/redis001",
12
- headers: {}
12
+ headers: {
13
+ authorization: "fakeauth",
14
+ },
15
+ username: "dknuth",
13
16
  }).and_return true
14
17
  expect(RestClient::Request).to receive(:execute).with({
15
18
  method: :put,
16
19
  url: "https://core.example.com/api/authn/#{account}/api_key?role=#{account}:host:redis001",
17
- headers: {},
18
- payload: ''
20
+ headers: {
21
+ authorization: "fakeauth",
22
+ },
23
+ payload: '',
24
+ username: "dknuth",
19
25
  }).and_return double(:response, body: 'new api key')
20
26
  end
21
27
 
@@ -23,5 +29,19 @@ describe Conjur::Command::Hosts, logged_in: true do
23
29
  invoke
24
30
  end
25
31
  end
32
+
33
+ describe_command 'host rotate_api_key --host non-existing' do
34
+ before do
35
+ expect(RestClient::Request).to receive(:execute).with({
36
+ method: :head,
37
+ url: "https://core.example.com/api/resources/#{account}/host/non-existing",
38
+ headers: {authorization: "fakeauth"},
39
+ username: username,
40
+ }).and_raise RestClient::ResourceNotFound
41
+ end
42
+ it 'rotate_api_key with non-existing --host option' do
43
+ expect { invoke }.to raise_error(GLI::CustomExit, /Host 'non-existing' not found/i)
44
+ end
45
+ end
26
46
  end
27
47
  end
@@ -1,49 +1,46 @@
1
1
  require 'spec_helper'
2
2
  require 'highline'
3
3
 
4
- GITHUB_FP = "SHA1 Fingerprint=CA:06:F5:6B:25:8B:7A:0D:4F:2B:05:47:09:39:47:86:51:15:19:84"
4
+ GITHUB_FP = "SHA1 Fingerprint=5F:3F:7A:C2:56:9F:50:A4:66:76:47:C6:A1:8C:A0:07:AA:ED:BB:8E"
5
5
  GITHUB_CERT = <<EOF
6
6
  -----BEGIN CERTIFICATE-----
7
- MIIHQjCCBiqgAwIBAgIQCgYwQn9bvO1pVzllk7ZFHzANBgkqhkiG9w0BAQsFADB1
7
+ MIIG1TCCBb2gAwIBAgIQBVfICygmg6F7ChFEkylreTANBgkqhkiG9w0BAQsFADBw
8
8
  MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
9
- d3cuZGlnaWNlcnQuY29tMTQwMgYDVQQDEytEaWdpQ2VydCBTSEEyIEV4dGVuZGVk
10
- IFZhbGlkYXRpb24gU2VydmVyIENBMB4XDTE4MDUwODAwMDAwMFoXDTIwMDYwMzEy
11
- MDAwMFowgccxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5pemF0aW9uMRMwEQYLKwYB
12
- BAGCNzwCAQMTAlVTMRkwFwYLKwYBBAGCNzwCAQITCERlbGF3YXJlMRAwDgYDVQQF
13
- Ewc1MTU3NTUwMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQG
14
- A1UEBxMNU2FuIEZyYW5jaXNjbzEVMBMGA1UEChMMR2l0SHViLCBJbmMuMRMwEQYD
15
- VQQDEwpnaXRodWIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
16
- xjyq8jyXDDrBTyitcnB90865tWBzpHSbindG/XqYQkzFMBlXmqkzC+FdTRBYyneZ
17
- w5Pz+X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OTK
42
+ 5EiJG6vsIh/uEtRsdenMCxV06W2f20Af4iSFo0uk6c1ryHefh08FcwA4pSNUaPyi
43
+ Pb8YGQ6o/blejFzo/OSiUnDueafSJ0p6SQ==
47
44
  EOF
48
45
 
49
46
  describe Conjur::Command::Init do
@@ -52,5 +52,18 @@ describe Conjur::Command::Users, logged_in: true do
52
52
  invoke
53
53
  end
54
54
  end
55
+ describe_command 'user rotate_api_key --user non-existing' do
56
+ before do
57
+ expect(RestClient::Request).to receive(:execute).with({
58
+ method: :head,
59
+ url: "https://core.example.com/api/resources/#{account}/user/non-existing",
60
+ headers: {authorization: "fakeauth"},
61
+ username: username,
62
+ }).and_raise RestClient::ResourceNotFound
63
+ end
64
+ it 'rotate_api_key with non-existing --user option' do
65
+ expect { invoke }.to raise_error(GLI::CustomExit, /User 'non-existing' not found/i)
66
+ end
67
+ end
55
68
  end
56
69
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.2
4
+ version: 6.2.3
5
5
  platform: ruby
6
6
  authors:
7
- - Rafal Rzepecki
8
- - Kevin Gilpin
7
+ - Conjur Maintainers
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2020-04-02 00:00:00.000000000 Z
11
+ date: 2020-12-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
@@ -277,8 +276,7 @@ dependencies:
277
276
  version: '0.18'
278
277
  description:
279
278
  email:
280
- - rafal@conjur.net
281
- - kgilpin@conjur.net
279
+ - conj_maintainers@cyberark.com
282
280
  executables:
283
281
  - _conjur
284
282
  - conjur
@@ -286,8 +284,10 @@ extensions: []
286
284
  extra_rdoc_files: []
287
285
  files:
288
286
  - ".dockerignore"
287
+ - ".github/CODEOWNERS"
289
288
  - ".github/ISSUE_TEMPLATE/bug.md"
290
289
  - ".github/ISSUE_TEMPLATE/feature_request.md"
290
+ - ".github/PULL_REQUEST_TEMPLATE.md"
291
291
  - ".gitignore"
292
292
  - ".gitleaks.toml"
293
293
  - ".kateproject"
@@ -301,9 +301,11 @@ files:
301
301
  - Humanfile.md
302
302
  - Jenkinsfile
303
303
  - LICENSE
304
+ - NOTICES.txt
304
305
  - PUBLISH.md
305
306
  - README.md
306
307
  - Rakefile
308
+ - SECURITY.md
307
309
  - VERSION
308
310
  - bin/_conjur
309
311
  - bin/conjur
@@ -410,9 +412,9 @@ files:
410
412
  - spec/spec_helper.rb
411
413
  - standalone.entrypoint
412
414
  - test.sh
413
- homepage: https://github.com/conjurinc/cli-ruby
415
+ homepage: https://github.com/cyberark/conjur-cli
414
416
  licenses:
415
- - MIT
417
+ - Apache 2.0
416
418
  metadata: {}
417
419
  post_install_message:
418
420
  rdoc_options: []
@@ -429,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
431
  - !ruby/object:Gem::Version
430
432
  version: '0'
431
433
  requirements: []
432
- rubygems_version: 3.0.3
434
+ rubygems_version: 3.1.2
433
435
  signing_key:
434
436
  specification_version: 4
435
437
  summary: Conjur command line interface