passw3rd 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 0.1.3 / 2011-11-4
2
+
3
+ From key rotation, arose cipher changing
4
+
5
+ [passw3rd (gh-17-change_cipher *$)]$ rake change_cipher[~/passwords,~/passwords,aes-128-cbc,aes-256-cbc]
6
+ [passw3rd (gh-17-change_cipher *$)]$ rake change_cipher[~/passwords,~/passwords,aes-256-cbc,aes-256-cfb]
7
+
1
8
  === 0.1.2 / 2011-11-4
2
9
 
3
10
  Added key rotation script
@@ -60,6 +60,36 @@ module Passw3rd
60
60
  raise err
61
61
  end
62
62
  end
63
+
64
+ def self.rotate_keys(args = {})
65
+ unless args.empty?
66
+ ::Passw3rd::PasswordService.configure do |c|
67
+ c.password_file_dir = args[:password_file_dir]
68
+ c.key_file_dir = args[:key_file_dir]
69
+ c.cipher_name = args[:cipher]
70
+ end
71
+ end
72
+
73
+ passwords = []
74
+
75
+ Dir.foreach(::Passw3rd::PasswordService.password_file_dir) do |passw3rd_file|
76
+ next if %w{. ..}.include?(passw3rd_file) || passw3rd_file =~ /\A\.passw3rd/
77
+ puts "Rotating #{passw3rd_file}"
78
+ passwords << {:clear_password => ::Passw3rd::PasswordService.get_password(passw3rd_file), :file => passw3rd_file}
79
+ end
80
+
81
+ ::Passw3rd::PasswordService.cipher_name = args[:new_cipher] if args[:new_cipher]
82
+
83
+ path = ::Passw3rd::KeyLoader.create_key_iv_file
84
+ puts "Wrote new keys to #{path}"
85
+
86
+ passwords.each do |password|
87
+ full_path = File.join(::Passw3rd::PasswordService.password_file_dir, password[:file])
88
+ FileUtils::rm(full_path)
89
+ ::Passw3rd::PasswordService.write_password_file(password[:clear_password], password[:file])
90
+ puts "Wrote new password to #{full_path}"
91
+ end
92
+ end
63
93
 
64
94
  protected
65
95
 
@@ -1,3 +1,3 @@
1
1
  module Passw3rd
2
- Version = VERSION = '0.1.2'
2
+ Version = VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passw3rd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-04 00:00:00.000000000Z
12
+ date: 2011-11-05 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Generate a key/iv file, generate passwords, and store encrypted files
15
15
  in source control, keep the key/iv safe!