arver 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- %w{ singleton yaml fileutils active_support highline/import gpgme escape openssl}.each {|f| require f }
1
+ %w{singleton yaml fileutils active_support highline/import gpgme escape openssl}.each {|f| require f }
2
2
  $:.unshift(File.dirname(__FILE__)) unless
3
3
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
4
4
 
@@ -18,15 +18,10 @@ module Arver
18
18
  end
19
19
 
20
20
  def verify?( partition )
21
- if not Arver::RuntimeConfig.instance.ask_password then
22
- return false unless load_key( partition )
23
- else
24
- self.key= ask("Enter the password for the volume: #{partition.device}") {|q| q.echo = false}
25
- end
26
- unless( Arver::LuksWrapper.open?(partition).execute )
27
- Arver::Log.error( "WARNING: "+partition.name+" is not open. skipping." )
28
- return false
21
+ unless Arver::RuntimeConfig.instance.ask_password
22
+ return load_key( partition )
29
23
  end
24
+ self.key= ask("Enter the password for the volume: #{partition.device}") {|q| q.echo = false}
30
25
  true
31
26
  end
32
27
 
@@ -40,7 +35,7 @@ module Arver
40
35
 
41
36
  caller = Arver::LuksWrapper.addKey( slot_of_target_user.to_s, partition )
42
37
  caller.execute( key + "\n" + newkey )
43
-
38
+
44
39
  unless( caller.success? )
45
40
  Arver::Log.error( "Could not add user to #{partition.path} \n #{caller.output}" )
46
41
  generator.remove_key( target_user, partition )
@@ -21,7 +21,7 @@ module Arver
21
21
 
22
22
  def dump
23
23
  @keys.each do | user, user_keys |
24
- KeySaver.save( user, user_keys.to_yaml ) unless user_keys.empty?
24
+ KeySaver.add( user, user_keys.to_yaml ) unless user_keys.empty?
25
25
  end
26
26
  @keys = {}
27
27
  end
@@ -2,6 +2,20 @@ module Arver
2
2
  class KeySaver
3
3
 
4
4
  def self.save( user, key )
5
+ filename = save_tmp( user, key )
6
+ purge_keys(user)
7
+ FileUtils.mv("#{tmp_key_path(user)}", "#{key_path(user)}")
8
+ "#{key_path(user)}/#{filename}"
9
+ end
10
+
11
+ def self.add( user, key )
12
+ filename = save_tmp( user, key )
13
+ FileUtils.mkdir_p key_path(user) unless File.exists?( key_path(user) )
14
+ FileUtils.mv( Dir.glob("#{tmp_key_path(user)}/*"), "#{key_path(user)}")
15
+ "#{key_path(user)}/#{filename}"
16
+ end
17
+
18
+ def self.save_tmp( user, key )
5
19
  unless GPGKeyManager.check_key_of( user )
6
20
  return
7
21
  end
@@ -20,9 +34,9 @@ module Arver
20
34
  end
21
35
  key_encrypted = encrypted.read
22
36
  unless( Arver::RuntimeConfig.instance.dry_run )
23
- FileUtils.mkdir_p key_path(user) unless File.exists?( key_path(user) )
24
- filename = key_path(user)+"/"+OpenSSL::Digest::SHA1.new(key_encrypted).to_s
25
- File.open( filename, 'w' ) do |f|
37
+ FileUtils.mkdir_p tmp_key_path(user) unless File.exists?( tmp_key_path(user) )
38
+ filename = "#{OpenSSL::Digest::SHA1.new(key_encrypted)}"
39
+ File.open( "#{tmp_key_path(user)}/#{filename}", 'w' ) do |f|
26
40
  f.write key_encrypted
27
41
  end
28
42
  end
@@ -30,7 +44,11 @@ module Arver
30
44
  end
31
45
 
32
46
  def self.key_path( user )
33
- config_path+"/keys/"+user
47
+ "#{config_path}/keys/#{user}"
48
+ end
49
+
50
+ def self.tmp_key_path( user )
51
+ "#{config_path}/tmp/#{user}"
34
52
  end
35
53
 
36
54
  def self.config_path
@@ -21,7 +21,6 @@ module Arver
21
21
  end
22
22
 
23
23
  def save
24
- purge_keys
25
24
  KeySaver.save(username, @keys.to_yaml)
26
25
  end
27
26
 
@@ -1,3 +1,3 @@
1
1
  module Arver
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,103 +1,145 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: arver
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 3
10
+ version: 0.1.3
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - o
9
14
  - andreas
10
15
  - mh
11
16
  autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
- date: 2012-04-30 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
19
+
20
+ date: 2012-06-13 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
17
23
  name: gpgme
18
- requirement: &7240120 !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
19
25
  none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 0
23
34
  version: 2.0.0
24
35
  type: :runtime
25
36
  prerelease: false
26
- version_requirements: *7240120
27
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
28
39
  name: escape
29
- requirement: &7239180 !ruby/object:Gem::Requirement
40
+ requirement: &id002 !ruby/object:Gem::Requirement
30
41
  none: false
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: 0.0.2
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 23
46
+ segments:
47
+ - 0
48
+ - 0
49
+ - 4
50
+ version: 0.0.4
35
51
  type: :runtime
36
52
  prerelease: false
37
- version_requirements: *7239180
38
- - !ruby/object:Gem::Dependency
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
39
55
  name: activesupport
40
- requirement: &7238020 !ruby/object:Gem::Requirement
56
+ requirement: &id003 !ruby/object:Gem::Requirement
41
57
  none: false
42
- requirements:
58
+ requirements:
43
59
  - - <
44
- - !ruby/object:Gem::Version
60
+ - !ruby/object:Gem::Version
61
+ hash: 7
62
+ segments:
63
+ - 3
64
+ - 0
65
+ - 0
45
66
  version: 3.0.0
46
67
  type: :runtime
47
68
  prerelease: false
48
- version_requirements: *7238020
49
- - !ruby/object:Gem::Dependency
69
+ version_requirements: *id003
70
+ - !ruby/object:Gem::Dependency
50
71
  name: highline
51
- requirement: &7236760 !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
52
73
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 11
78
+ segments:
79
+ - 1
80
+ - 6
81
+ - 2
56
82
  version: 1.6.2
57
83
  type: :runtime
58
84
  prerelease: false
59
- version_requirements: *7236760
60
- - !ruby/object:Gem::Dependency
85
+ version_requirements: *id004
86
+ - !ruby/object:Gem::Dependency
61
87
  name: cucumber
62
- requirement: &7235620 !ruby/object:Gem::Requirement
88
+ requirement: &id005 !ruby/object:Gem::Requirement
63
89
  none: false
64
- requirements:
65
- - - ! '>='
66
- - !ruby/object:Gem::Version
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 51
94
+ segments:
95
+ - 0
96
+ - 10
97
+ - 2
67
98
  version: 0.10.2
68
99
  type: :development
69
100
  prerelease: false
70
- version_requirements: *7235620
71
- - !ruby/object:Gem::Dependency
101
+ version_requirements: *id005
102
+ - !ruby/object:Gem::Dependency
72
103
  name: rspec
73
- requirement: &7234840 !ruby/object:Gem::Requirement
104
+ requirement: &id006 !ruby/object:Gem::Requirement
74
105
  none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ hash: 27
110
+ segments:
111
+ - 2
112
+ - 5
113
+ - 0
78
114
  version: 2.5.0
79
115
  type: :development
80
116
  prerelease: false
81
- version_requirements: *7234840
82
- - !ruby/object:Gem::Dependency
117
+ version_requirements: *id006
118
+ - !ruby/object:Gem::Dependency
83
119
  name: rake
84
- requirement: &7233720 !ruby/object:Gem::Requirement
120
+ requirement: &id007 !ruby/object:Gem::Requirement
85
121
  none: false
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 63
126
+ segments:
127
+ - 0
128
+ - 9
129
+ - 2
89
130
  version: 0.9.2
90
131
  type: :development
91
132
  prerelease: false
92
- version_requirements: *7233720
93
- description: Arver helps you to manage a large amount of crypted devices easily and
94
- safe amongst a certain amount of members
133
+ version_requirements: *id007
134
+ description: Arver helps you to manage a large amount of crypted devices easily and safe amongst a certain amount of members
95
135
  email: arver@lists.immerda.ch
96
- executables:
136
+ executables:
97
137
  - arver
98
138
  extensions: []
139
+
99
140
  extra_rdoc_files: []
100
- files:
141
+
142
+ files:
101
143
  - lib/arver.rb
102
144
  - lib/arver/action.rb
103
145
  - lib/arver/adduser_action.rb
@@ -142,26 +184,38 @@ files:
142
184
  - bin/arver
143
185
  homepage: https://github.com/arver/arver
144
186
  licenses: []
187
+
145
188
  post_install_message:
146
189
  rdoc_options: []
147
- require_paths:
190
+
191
+ require_paths:
148
192
  - lib
149
- required_ruby_version: !ruby/object:Gem::Requirement
193
+ required_ruby_version: !ruby/object:Gem::Requirement
150
194
  none: false
151
- requirements:
152
- - - ! '>='
153
- - !ruby/object:Gem::Version
154
- version: '0'
155
- required_rubygems_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ hash: 3
199
+ segments:
200
+ - 0
201
+ version: "0"
202
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
203
  none: false
157
- requirements:
158
- - - ! '>='
159
- - !ruby/object:Gem::Version
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ hash: 23
208
+ segments:
209
+ - 1
210
+ - 3
211
+ - 6
160
212
  version: 1.3.6
161
213
  requirements: []
162
- rubyforge_project: ! '[none]'
163
- rubygems_version: 1.8.10
214
+
215
+ rubyforge_project: "[none]"
216
+ rubygems_version: 1.8.24
164
217
  signing_key:
165
218
  specification_version: 3
166
219
  summary: Open crypted devices automatically
167
220
  test_files: []
221
+