brightbox-cli 2.10.0 → 2.11.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: 91e149ba9690fe26c97b144bb44335ad61bb1d4b618dc40cf25d67db0ce2125f
4
- data.tar.gz: 671a10236bb00873715e7efbb833517bdada9fa473b53ae59ada833c5f213e0c
3
+ metadata.gz: 1f74c6d5e07fe744f3217182b736dd66ad18c849032f6be610d65af2bc8362f3
4
+ data.tar.gz: 9b5764ee9444858f285efb15720a640d32bb4d3519f495725ec6445c315ee538
5
5
  SHA512:
6
- metadata.gz: 32983783ff888dbd51d1b3e2354e39d2958e9c88e44058e1a9e0f6e3eb660379fcb1b40d7b1a6b98a0911fbb95005fdd06d846b253efde60cf2da94abe42989e
7
- data.tar.gz: 9f8b40a4566056cb001c6370e6f0b9b801e1955124610f0a993d6d3b6725c86643ee7452765c532e297b6be3886b081c22165ba7b2bca90a1ea664c1f636e4c9
6
+ metadata.gz: 254847110a72093c3f32200b01a2f565f8a97cb3ae591e6a97a78966bdc959826944da0ef4e8a7127d52c07cbe90dbe1631a99e6c641a9b3be5a504edf7de3bb
7
+ data.tar.gz: e43d2bc0e2b47f369186d441688fec4f9021b6aa1df6c2735edc1826518630bb9a611b072c8eb3f2f7f1c8524d203adf8df1f08bb97fdc5c272e7d4048f5f8fa
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  sudo: false
3
+
3
4
  rvm:
4
5
  - 1.9
5
6
  - 2.0
@@ -7,4 +8,4 @@ rvm:
7
8
  - 2.2
8
9
  - 2.3
9
10
  - 2.4
10
- - 2.5
11
+ - 2.6
@@ -1,3 +1,11 @@
1
+ ### v2.11.0 / 2019-06-06
2
+
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.10.0...v2.11.0)
4
+
5
+ Enhancements:
6
+
7
+ * Prompts for 2FA token if set up on a user account being used to authenticate.
8
+
1
9
  ### v2.10.0 / 2019-03-20
2
10
 
3
11
  [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.9.3...v2.10.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (2.10.0)
4
+ brightbox-cli (2.11.0)
5
5
  fog-brightbox (>= 0.16.0, < 1.0)
6
6
  fog-core (< 2.0)
7
7
  gli (~> 2.12.0)
@@ -81,4 +81,4 @@ DEPENDENCIES
81
81
  webmock
82
82
 
83
83
  BUNDLED WITH
84
- 1.16.2
84
+ 1.16.6
@@ -32,6 +32,8 @@ module Brightbox
32
32
  end
33
33
  raise "You must specify your Brightbox password." if password.empty?
34
34
 
35
+ password = Brightbox.config.extend_with_two_factor_pin(password)
36
+
35
37
  section_options = {
36
38
  :client_name => config_name,
37
39
  :alias => config_name,
@@ -14,6 +14,7 @@ module Brightbox
14
14
  include Brightbox::Config::Cache
15
15
  include Brightbox::Config::GpgEncryptedPasswords
16
16
  include Brightbox::Config::PasswordHelper
17
+ include Brightbox::Config::TwoFactorAuth
17
18
  include Brightbox::Config::AuthenticationTokens
18
19
  include Brightbox::Config::Accounts
19
20
  include Brightbox::Config::Clients
@@ -193,6 +193,8 @@ module Brightbox
193
193
  password ||= password_helper_password
194
194
  password ||= prompt_for_password
195
195
 
196
+ password = extend_with_two_factor_pin(password)
197
+
196
198
  # FIXME: options are required to work
197
199
  options = {
198
200
  :client_id => client_name,
@@ -0,0 +1,31 @@
1
+ module Brightbox
2
+ module Config
3
+ module TwoFactorAuth
4
+
5
+ def extend_with_two_factor_pin(password)
6
+ if two_factor_enabled
7
+ suffix = "+" + two_factor_pin
8
+ password += suffix unless password.end_with?(suffix)
9
+ end
10
+ password
11
+ end
12
+
13
+ private
14
+
15
+ def two_factor_enabled
16
+ return config[client_name]["two_factor"] == "true" unless client_name.nil?
17
+ end
18
+
19
+ def two_factor_pin
20
+ @two_factor_pin ||= prompt_for_two_factor_pin if two_factor_enabled
21
+ end
22
+
23
+ def prompt_for_two_factor_pin
24
+ require "highline"
25
+ highline = HighLine.new
26
+ # FIXME: Capture interupts if user aborts
27
+ highline.ask("Enter your two factor pin : ")
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "2.10.0" unless defined?(Brightbox::VERSION)
2
+ VERSION = "2.11.0" unless defined?(Brightbox::VERSION)
3
3
  end
@@ -72,6 +72,7 @@ require_relative "brightbox-cli/api"
72
72
  require_relative "brightbox-cli/config/cache"
73
73
  require_relative "brightbox-cli/config/gpg_encrypted_passwords"
74
74
  require_relative "brightbox-cli/config/password_helper"
75
+ require_relative "brightbox-cli/config/two_factor_auth"
75
76
  require_relative "brightbox-cli/config/authentication_tokens"
76
77
  require_relative "brightbox-cli/config/accounts"
77
78
  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.10.0
4
+ version: 2.11.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-20 00:00:00.000000000 Z
11
+ date: 2019-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-brightbox
@@ -363,6 +363,7 @@ files:
363
363
  - lib/brightbox-cli/config/section_name_deduplicator.rb
364
364
  - lib/brightbox-cli/config/sections.rb
365
365
  - lib/brightbox-cli/config/to_fog.rb
366
+ - lib/brightbox-cli/config/two_factor_auth.rb
366
367
  - lib/brightbox-cli/config/user_application.rb
367
368
  - lib/brightbox-cli/connection_manager.rb
368
369
  - lib/brightbox-cli/database_server.rb