forj 0.0.42 → 0.0.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/forj-account.rb +37 -12
- data/lib/security.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc168384e8283de3099794ba3fb85759286de890
|
4
|
+
data.tar.gz: 216c1d4e25503388473f88a2cce2db26674dc0d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c5edfe564a87533f683f25137a4cca65ad6fe642c160d729d73efcf66656614ba26e53d76fda270811c5b64a59715eadd795699bfbe1854b1f6b4ac651e7fa5
|
7
|
+
data.tar.gz: e0c005a6db73411311b85cece7979536cd56709d25644d182128a63eca8355f724fea32c39a3052f41fa2559f62b39419d3e10666ccd2cfe42928bc400d15a1b
|
data/lib/forj-account.rb
CHANGED
@@ -81,7 +81,11 @@ class ForjAccount
|
|
81
81
|
key = key.to_sym if key.class == String
|
82
82
|
section = rhGet(@oConfig.getAppDefault(:account_section_mapping, key), :section)
|
83
83
|
yInterm = nil
|
84
|
-
|
84
|
+
if section
|
85
|
+
yInterm = rhGet(@hAccountData, section)
|
86
|
+
else
|
87
|
+
Logging.debug("ForjAccount.get: No section found for key '%s'." % [key])
|
88
|
+
end
|
85
89
|
@oConfig.get(key, yInterm , default )
|
86
90
|
end
|
87
91
|
|
@@ -430,12 +434,15 @@ class ForjAccount
|
|
430
434
|
q.default = forj_user if forj_user
|
431
435
|
end
|
432
436
|
|
433
|
-
|
434
437
|
# Checking key file used to encrypt/decrypt passwords
|
435
438
|
key_file = File.join($FORJ_CREDS_PATH, '.key')
|
436
439
|
if not File.exists?(key_file)
|
437
440
|
# Need to create a random key.
|
438
|
-
entr = {
|
441
|
+
entr = {
|
442
|
+
:key => rand(36**10).to_s(36),
|
443
|
+
:salt => Time.now.to_i.to_s,
|
444
|
+
:iv => Base64::strict_encode64(OpenSSL::Cipher::Cipher.new('aes-256-cbc').random_iv)
|
445
|
+
}
|
439
446
|
|
440
447
|
Logging.debug("Writing '%s' key file" % key_file)
|
441
448
|
File.open(key_file, 'w') do |out|
|
@@ -448,14 +455,20 @@ class ForjAccount
|
|
448
455
|
end
|
449
456
|
|
450
457
|
if enc_hpcloud_os_key
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
458
|
+
begin
|
459
|
+
hpcloud_os_key_hidden = '*' * Encryptor.decrypt(
|
460
|
+
:value => Base64::strict_decode64(enc_hpcloud_os_key),
|
461
|
+
:key => entr[:key],
|
462
|
+
:iv => Base64::strict_decode64(entr[:iv]),
|
463
|
+
:salt => entr[:salt]
|
456
464
|
).length
|
457
|
-
|
458
|
-
|
465
|
+
rescue => e
|
466
|
+
Logging.error("Unable to decrypt your password. You will need to re-enter it.")
|
467
|
+
enc_hpcloud_os_key = ""
|
468
|
+
else
|
469
|
+
hpcloud_os_key_hidden="[%s]" % hpcloud_os_key_hidden
|
470
|
+
Logging.message("A password is already set for '%s'. If you want to keep it, just press Enter" % [hpcloud_os_user])
|
471
|
+
end
|
459
472
|
else
|
460
473
|
hpcloud_os_key_hidden = ""
|
461
474
|
end
|
@@ -467,12 +480,24 @@ class ForjAccount
|
|
467
480
|
q.echo = '*'
|
468
481
|
end
|
469
482
|
if hpcloud_os_key == "" and enc_hpcloud_os_key
|
470
|
-
hpcloud_os_key = Encryptor.decrypt(
|
483
|
+
hpcloud_os_key = Encryptor.decrypt(
|
484
|
+
:value => Base64::strict_decode64(enc_hpcloud_os_key),
|
485
|
+
:key => entr[:key],
|
486
|
+
:iv => Base64::strict_decode64(entr[:iv]),
|
487
|
+
:salt => entr[:salt]
|
488
|
+
)
|
471
489
|
else
|
472
490
|
Logging.message("The password cannot be empty.") if hpcloud_os_key == ""
|
473
491
|
end
|
474
492
|
end
|
475
|
-
enc_hpcloud_os_key = Base64::strict_encode64(
|
493
|
+
enc_hpcloud_os_key = Base64::strict_encode64(
|
494
|
+
Encryptor.encrypt(
|
495
|
+
:value => hpcloud_os_key,
|
496
|
+
:key => entr[:key],
|
497
|
+
:iv => Base64::strict_decode64(entr[:iv]),
|
498
|
+
:salt => entr[:salt]
|
499
|
+
)
|
500
|
+
)
|
476
501
|
|
477
502
|
cloud_fog = File.join($FORJ_CREDS_PATH, @sAccountName+'.g64')
|
478
503
|
|
data/lib/security.rb
CHANGED
@@ -173,7 +173,7 @@ module SecurityGroup
|
|
173
173
|
def hpc_import_key(oForjAccount)
|
174
174
|
|
175
175
|
keys = keypair_detect(oForjAccount.get('keypair_name'), oForjAccount.get('keypair_path'))
|
176
|
-
account = oForjAccount.
|
176
|
+
account = oForjAccount.getAccountData(:account, :name)
|
177
177
|
|
178
178
|
Logging.fatal(1, "'keypair_path' undefined. check your config.yaml file.") if not keys[:keypair_path]
|
179
179
|
Logging.fatal(1, "'keypair_name' undefined. check your config.yaml file.") if not keys[:keypair_name]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- forj team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|