arver 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,7 +54,11 @@ module Arver
54
54
  end
55
55
 
56
56
  def load_key( partition )
57
- self.key= keystore.luks_key( partition )
57
+ if Arver::RuntimeConfig.instance.global_key_path
58
+ self.key= keystore.luks_key_for_path( Arver::RuntimeConfig.instance.global_key_path )
59
+ else
60
+ self.key= keystore.luks_key( partition )
61
+ end
58
62
 
59
63
  if( key.nil? )
60
64
  Arver::Log.error( "No permission on #{partition.path}. Skipping." )
@@ -32,6 +32,7 @@ class Arver::Bootstrap
32
32
  rtc.violence = options[:violence]
33
33
  rtc.test_mode = options[:test_mode]
34
34
  rtc.trust_all = options[:trust_all]
35
+ rtc.global_key_path = options[:global_key_path]
35
36
  end
36
37
  end
37
38
  end
@@ -34,6 +34,8 @@ module Arver
34
34
  "Show this help message.") { Arver::Log.write opts; return }
35
35
  opts.on("--ask-password",
36
36
  "Ask for an existing LUKS password when adding a new user.") { options[:ask_password] = true }
37
+ opts.on("--set-key KEYNAME", String,
38
+ "Manuall choose a key to use. The KEYNAME is in the format /LOCATION/MACHINE/DISK.") { |arg| options[:global_key_path] = arg }
37
39
  opts.on("-t", "--trust-all",
38
40
  "Use untrusted GPG Keys.") { options[:trust_all] = true }
39
41
  opts.on("--force",
@@ -31,15 +31,21 @@ module Arver
31
31
  end
32
32
 
33
33
  def username
34
- return @username unless @username.nil?
35
- 'root'
34
+ case @username
35
+ when nil
36
+ 'root'
37
+ when '#arveruser'
38
+ Arver::LocalConfig.instance.username
39
+ else
40
+ @username
41
+ end
36
42
  end
37
43
 
38
44
  def to_yaml
39
45
  yaml = ""
40
- yaml += "'address': '"+address+"'\n" unless @address.nil?
41
- yaml += "'port': '"+port+"'\n" unless @port.nil?
42
- yaml += "'username': '"+username+"'\n" unless @username.nil?
46
+ yaml += "'address': '"+@address+"'\n" unless @address.nil?
47
+ yaml += "'port': '"+@port+"'\n" unless @port.nil?
48
+ yaml += "'username': '"+@username+"'\n" unless @username.nil?
43
49
  yaml += script_hooks_to_yaml
44
50
  yaml += super
45
51
  end
@@ -51,9 +51,13 @@ module Arver
51
51
  end
52
52
 
53
53
  def luks_key(partition)
54
- @keys[partition.path][:key] unless ! @keys[partition.path]
54
+ luks_key_for_path(partition.path)
55
55
  end
56
56
 
57
+ def luks_key_for_path(path)
58
+ @keys[path][:key] unless ! @keys[path]
59
+ end
60
+
57
61
  def load_luks_key(partition, new_key)
58
62
  if( new_key.kind_of? Hash )
59
63
  if( ! @keys[partition] || @keys[partition][:time] <= new_key[:time] )
@@ -5,7 +5,7 @@ module Arver
5
5
 
6
6
  include Singleton
7
7
 
8
- attr_accessor :test_mode, :dry_run, :force, :violence, :ask_password, :trust_all
8
+ attr_accessor :test_mode, :dry_run, :force, :violence, :ask_password, :trust_all, :global_key_path
9
9
 
10
10
  instance.test_mode= false
11
11
  instance.dry_run= false
@@ -1,3 +1,3 @@
1
1
  module Arver
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "ARVER" "5" "July 2012" "" ""
4
+ .TH "ARVER" "5" "August 2012" "" ""
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBarver\fR \- LUKS on the loose
@@ -193,15 +193,16 @@ The \fBdisks\fR file contains the following hash tree in yaml notation:
193
193
  \'disk2\' :
194
194
  \'device\' : \'sdb1\'
195
195
  \'host2\':
196
- \'address\': \'host2\.example\.com\'
197
- \'port\' : \'2222\'
198
- \'mails\' :
196
+ \'address\' : \'host2\.example\.com\'
197
+ \'port\' : \'2222\'
198
+ \'username\': \'hans\'
199
+ \'mails\' :
199
200
  \'device\' : \'nonraid/mails\'
200
201
  \'pre_open\': \'pre_open_disk_script\.sh\'
201
202
  \'hostgroup2\':
202
203
  \'host3\':
203
204
  \'address\' : \'host3\.example\.com\'
204
- \'username\': \'foo\'
205
+ \'username\': \'#arveruser\'
205
206
  \'secure\' :
206
207
  \'device\' : \'storage/secure\'
207
208
  .
@@ -235,6 +236,19 @@ will present you the tree of the various targets in your \fBdisks\fR configurati
235
236
  \fBhost1\fR, \fBhost2\fR and \fBhost3\fR are identifiers for different hosts\. These host\- objects can contain multiple disks and can have further information such as the \fBaddress\fR of the host or the ssh\-\fBport\fR number if the ssh daemon is not running on the standart port\.
236
237
  .
237
238
  .P
239
+ \fBusername\fR defines the ssh login\-user\. By default it is \fBroot\fR\. To always use the same username as arver (as defined by \fB\-u\fR or in \fB\.arver\fR) set the username to \fB#arveruser\fR\. If the user is not \fBroot\fR, the actual LUKS commands will be executed via \fBsudo\fR and you need the following entry in your sudoers file on this machine (assuming the user is in the admin group):
240
+ .
241
+ .IP "" 4
242
+ .
243
+ .nf
244
+
245
+ %admin ALL=NOPASSWD: /usr/bin/test, /sbin/cryptsetup
246
+ .
247
+ .fi
248
+ .
249
+ .IP "" 0
250
+ .
251
+ .P
238
252
  You can also add script hooks to any host or disk\. Those will be run during the \fBopen\fR and \fBclose\fR actions at the appropriate time\. The possible options are: \fBpre_open\fR, \fBpre_close\fR, \fBpost_open\fR and \fBpost_close\fR\.
239
253
  .
240
254
  .P
@@ -436,6 +450,32 @@ $ arver \-g
436
450
  .P
437
451
  If you use a version controll system to store your \fBarverdata\fR you should do this always before commiting the \fBarverdata\fR\.
438
452
  .
453
+ .SH "Migrating keys"
454
+ If you want to move a disk to a different server or a server to a different location, there is currently no nice way of doing this\. You can however apply the following workaround, after you moved/renamed a disk in the config file:
455
+ .
456
+ .IP "" 4
457
+ .
458
+ .nf
459
+
460
+ $ arver \-\-set\-key /OLD_LOCATION/OLD_MACHINE/OLD_NAME \-\-refresh NEW_NAME
461
+ .
462
+ .fi
463
+ .
464
+ .IP "" 0
465
+ .
466
+ .P
467
+ For example after moving \fBa_disk\fR from \fBa_server\fR at \fBa_location\fR to \fBsome_server\fR at \fBsome_location\fR in the config, you can restore your access with:
468
+ .
469
+ .IP "" 4
470
+ .
471
+ .nf
472
+
473
+ $ arver \-\-set\-key /a_location/a_server/a_disk \-\-refresh /some_location/some_server/a_disk
474
+ .
475
+ .fi
476
+ .
477
+ .IP "" 0
478
+ .
439
479
  .SH "SEE ALSO"
440
480
  \fBcryptsetup\fR(8)\. \fBgnupg\fR(7)\.
441
481
  .
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-07-25 00:00:00.000000000 Z
14
+ date: 2012-08-03 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gpgme
18
- requirement: !ruby/object:Gem::Requirement
18
+ requirement: &27298220 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,15 +23,10 @@ dependencies:
23
23
  version: 2.0.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ! '>='
30
- - !ruby/object:Gem::Version
31
- version: 2.0.0
26
+ version_requirements: *27298220
32
27
  - !ruby/object:Gem::Dependency
33
28
  name: activesupport
34
- requirement: !ruby/object:Gem::Requirement
29
+ requirement: &27297040 !ruby/object:Gem::Requirement
35
30
  none: false
36
31
  requirements:
37
32
  - - <
@@ -39,15 +34,10 @@ dependencies:
39
34
  version: 3.0.0
40
35
  type: :runtime
41
36
  prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - <
46
- - !ruby/object:Gem::Version
47
- version: 3.0.0
37
+ version_requirements: *27297040
48
38
  - !ruby/object:Gem::Dependency
49
39
  name: highline
50
- requirement: !ruby/object:Gem::Requirement
40
+ requirement: &27295900 !ruby/object:Gem::Requirement
51
41
  none: false
52
42
  requirements:
53
43
  - - ! '>='
@@ -55,15 +45,10 @@ dependencies:
55
45
  version: 1.6.2
56
46
  type: :runtime
57
47
  prerelease: false
58
- version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
- requirements:
61
- - - ! '>='
62
- - !ruby/object:Gem::Version
63
- version: 1.6.2
48
+ version_requirements: *27295900
64
49
  - !ruby/object:Gem::Dependency
65
50
  name: cucumber
66
- requirement: !ruby/object:Gem::Requirement
51
+ requirement: &27295000 !ruby/object:Gem::Requirement
67
52
  none: false
68
53
  requirements:
69
54
  - - ! '>='
@@ -71,15 +56,10 @@ dependencies:
71
56
  version: 0.10.2
72
57
  type: :development
73
58
  prerelease: false
74
- version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
- requirements:
77
- - - ! '>='
78
- - !ruby/object:Gem::Version
79
- version: 0.10.2
59
+ version_requirements: *27295000
80
60
  - !ruby/object:Gem::Dependency
81
61
  name: rspec
82
- requirement: !ruby/object:Gem::Requirement
62
+ requirement: &27290220 !ruby/object:Gem::Requirement
83
63
  none: false
84
64
  requirements:
85
65
  - - ! '>='
@@ -87,15 +67,10 @@ dependencies:
87
67
  version: 2.5.0
88
68
  type: :development
89
69
  prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
- requirements:
93
- - - ! '>='
94
- - !ruby/object:Gem::Version
95
- version: 2.5.0
70
+ version_requirements: *27290220
96
71
  - !ruby/object:Gem::Dependency
97
72
  name: rake
98
- requirement: !ruby/object:Gem::Requirement
73
+ requirement: &27288840 !ruby/object:Gem::Requirement
99
74
  none: false
100
75
  requirements:
101
76
  - - ! '>='
@@ -103,12 +78,7 @@ dependencies:
103
78
  version: 0.9.2
104
79
  type: :development
105
80
  prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- none: false
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
111
- version: 0.9.2
81
+ version_requirements: *27288840
112
82
  description: Arver helps you to manage a large amount of crypted devices easily and
113
83
  safe amongst a certain amount of members
114
84
  email: arver@lists.immerda.ch
@@ -174,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
144
  version: '0'
175
145
  segments:
176
146
  - 0
177
- hash: 947642704890013429
147
+ hash: 1467718207299558599
178
148
  required_rubygems_version: !ruby/object:Gem::Requirement
179
149
  none: false
180
150
  requirements:
@@ -183,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
153
  version: 1.3.6
184
154
  requirements: []
185
155
  rubyforge_project: ! '[none]'
186
- rubygems_version: 1.8.24
156
+ rubygems_version: 1.8.6
187
157
  signing_key:
188
158
  specification_version: 3
189
159
  summary: Open crypted devices automatically