brightbox-cli 2.9.3 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d75fbc305e6454af25ea8229ab5e3daa172daa356238cca3f754bfbde9dd622e
4
- data.tar.gz: a18c6c52ee8f05c8726013c466db8919c93861f354ad25f3b6d90081b99547e4
3
+ metadata.gz: 91e149ba9690fe26c97b144bb44335ad61bb1d4b618dc40cf25d67db0ce2125f
4
+ data.tar.gz: 671a10236bb00873715e7efbb833517bdada9fa473b53ae59ada833c5f213e0c
5
5
  SHA512:
6
- metadata.gz: 9e5702306a5c79fd252a00c5019201f848737f8df0b46939fa690ab990ac098f8df7d1a921dbbeb61e30e675816adfd524ad4091f808d2b5a1f99f17e408bee0
7
- data.tar.gz: e312c55cd455a3e0100edad6826d725f97f5d084a54909c9dbb9268593528c2bdd1e30c30f8af836e9332879f6497ccd0ab3113b93435b6d8d8819a040cf0705
6
+ metadata.gz: 32983783ff888dbd51d1b3e2354e39d2958e9c88e44058e1a9e0f6e3eb660379fcb1b40d7b1a6b98a0911fbb95005fdd06d846b253efde60cf2da94abe42989e
7
+ data.tar.gz: 9f8b40a4566056cb001c6370e6f0b9b801e1955124610f0a993d6d3b6725c86643ee7452765c532e297b6be3886b081c22165ba7b2bca90a1ea664c1f636e4c9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### v2.10.0 / 2019-03-20
2
+
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.9.3...v2.10.0)
4
+
5
+ Enhancements:
6
+
7
+ * Support for using an external password manager by setting in configuration
8
+
1
9
  ### v2.9.3 /2019-03-06
2
10
 
3
11
  [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.9.2...v2.9.3)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (2.9.3)
4
+ brightbox-cli (2.10.0)
5
5
  fog-brightbox (>= 0.16.0, < 1.0)
6
6
  fog-core (< 2.0)
7
7
  gli (~> 2.12.0)
data/README CHANGED
@@ -51,6 +51,19 @@ To browse available resources use the resource name as the command:
51
51
 
52
52
  Command structure may be subject to change.
53
53
 
54
+ === Integrating with a password manager
55
+
56
+ You can retrieve your passwords from an external password manager by specifying
57
+ a password helper command. This command will be executed any time your password
58
+ is required and its output used as your password.
59
+
60
+ Configure the command in your config file (usually ~/.brightbox/config) in the
61
+ appropriate section:
62
+
63
+ [john@example.com]
64
+ username = john@example.com
65
+ password_helper_command = pass john-example-com-brightbox
66
+
54
67
  === Using GPG to secure passwords
55
68
 
56
69
  If you use an OAuth application to access your accounts
@@ -22,7 +22,8 @@ module Brightbox
22
22
  raise "You must specify your email address" if email.nil?
23
23
 
24
24
  password = options[:p]
25
- password = Brightbox.config.gpg_password unless password
25
+ password ||= Brightbox.config.gpg_password
26
+ password ||= Brightbox.config.password_helper_password
26
27
 
27
28
  if !password || password.empty?
28
29
  require "highline"
@@ -13,6 +13,7 @@ module Brightbox
13
13
  include Brightbox::Logging
14
14
  include Brightbox::Config::Cache
15
15
  include Brightbox::Config::GpgEncryptedPasswords
16
+ include Brightbox::Config::PasswordHelper
16
17
  include Brightbox::Config::AuthenticationTokens
17
18
  include Brightbox::Config::Accounts
18
19
  include Brightbox::Config::Clients
@@ -189,8 +189,9 @@ module Brightbox
189
189
  def update_tokens_with_user_credentials(password = nil)
190
190
  user_application = Brightbox::Config::UserApplication.new(selected_config, client_name)
191
191
 
192
- password = gpg_password unless password
193
- password = prompt_for_password unless password
192
+ password ||= gpg_password
193
+ password ||= password_helper_password
194
+ password ||= prompt_for_password
194
195
 
195
196
  # FIXME: options are required to work
196
197
  options = {
@@ -0,0 +1,38 @@
1
+ module Brightbox
2
+ module Config
3
+ module PasswordHelper
4
+ attr_accessor :password_helper_password
5
+
6
+ def password_helper_command
7
+ return config[client_name]["password_helper_command"] unless client_name.nil?
8
+ end
9
+
10
+ # Return the password from the helper if it's possible
11
+ def password_helper_password
12
+ if defined?(@password_helper_password) && !@password_helper_password.nil?
13
+ return @password_helper_password
14
+ end
15
+
16
+ if password_helper_command
17
+ @password_helper_password = password_helper_call
18
+ else
19
+ @password_helper_password = nil
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def password_helper_call
26
+ info "INFO: Calling password helper to obtain password"
27
+ begin
28
+ cmd = password_helper_command.split(/\s+/)
29
+ IO.popen(cmd, "r") do |io|
30
+ io.readline.chomp
31
+ end
32
+ rescue Errno::ENOENT
33
+ nil
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "2.9.3" unless defined?(Brightbox::VERSION)
2
+ VERSION = "2.10.0" unless defined?(Brightbox::VERSION)
3
3
  end
data/lib/brightbox_cli.rb CHANGED
@@ -71,6 +71,7 @@ require_relative "brightbox-cli/logging"
71
71
  require_relative "brightbox-cli/api"
72
72
  require_relative "brightbox-cli/config/cache"
73
73
  require_relative "brightbox-cli/config/gpg_encrypted_passwords"
74
+ require_relative "brightbox-cli/config/password_helper"
74
75
  require_relative "brightbox-cli/config/authentication_tokens"
75
76
  require_relative "brightbox-cli/config/accounts"
76
77
  require_relative "brightbox-cli/config/clients"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.3
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-06 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-brightbox
@@ -359,6 +359,7 @@ files:
359
359
  - lib/brightbox-cli/config/clients.rb
360
360
  - lib/brightbox-cli/config/dirty.rb
361
361
  - lib/brightbox-cli/config/gpg_encrypted_passwords.rb
362
+ - lib/brightbox-cli/config/password_helper.rb
362
363
  - lib/brightbox-cli/config/section_name_deduplicator.rb
363
364
  - lib/brightbox-cli/config/sections.rb
364
365
  - lib/brightbox-cli/config/to_fog.rb