revenc 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.gitattributes +1 -0
- data/.gitignore +30 -0
- data/CLONING.rdoc +108 -0
- data/LICENSE +20 -0
- data/README.rdoc +198 -0
- data/Rakefile +64 -0
- data/VERSION +1 -0
- data/bin/revenc +81 -0
- data/config/cucumber.yml +7 -0
- data/examples/rsync/encrypted_data/key/encfs6.xml +35 -0
- data/examples/rsync/revenc.conf +18 -0
- data/examples/rsync/scripts/passphrase +1 -0
- data/examples/rsync/unencrypted_data/test_file1.txt +1 -0
- data/examples/rsync/unencrypted_data/test_file2.txt +1 -0
- data/examples/simple/encfs6.xml +35 -0
- data/examples/simple/passphrase +1 -0
- data/examples/simple/unencrypted_data/test_file1.txt +1 -0
- data/examples/simple/unencrypted_data/test_file2.txt +1 -0
- data/features/app.feature +59 -0
- data/features/bin.feature +35 -0
- data/features/configuration.feature +98 -0
- data/features/copy.feature +169 -0
- data/features/generator.feature +15 -0
- data/features/mount.feature +133 -0
- data/features/step_definitions/.gitignore +0 -0
- data/features/step_definitions/revenc_steps.rb +64 -0
- data/features/support/aruba.rb +21 -0
- data/features/support/env.rb +4 -0
- data/features/support/hooks.rb +6 -0
- data/features/unmount.feature +58 -0
- data/lib/revenc/app.rb +128 -0
- data/lib/revenc/encfs_wrapper.rb +96 -0
- data/lib/revenc/errors.rb +78 -0
- data/lib/revenc/io.rb +265 -0
- data/lib/revenc/lockfile.rb +66 -0
- data/lib/revenc.rb +22 -0
- data/spec/revenc/error_spec.rb +50 -0
- data/spec/revenc/io_spec.rb +185 -0
- data/spec/revenc/lockfile_spec.rb +44 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/watchr.rb +142 -0
- metadata +179 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
@announce
|
2
|
+
Feature: Application actions, configuration and error handling
|
3
|
+
|
4
|
+
As an interactive user or automated script
|
5
|
+
The application should accept actions and report errors
|
6
|
+
|
7
|
+
Scenario: No command line action
|
8
|
+
When I run "revenc"
|
9
|
+
Then the exit status should be 1
|
10
|
+
And I should see matching:
|
11
|
+
"""
|
12
|
+
^.* action required
|
13
|
+
^.* --help for more information
|
14
|
+
"""
|
15
|
+
|
16
|
+
Scenario: Invalid action
|
17
|
+
When I run "revenc non-existing-action"
|
18
|
+
Then the exit status should be 1
|
19
|
+
And I should see matching:
|
20
|
+
"""
|
21
|
+
^.* invalid action: non-existing-action
|
22
|
+
^.* --help for more information
|
23
|
+
|
24
|
+
"""
|
25
|
+
|
26
|
+
Scenario: --config FILE (exists)
|
27
|
+
Given an empty file named "config.conf"
|
28
|
+
When I run "revenc mount --verbose --config config.conf"
|
29
|
+
Then I should see:
|
30
|
+
"""
|
31
|
+
loading config file: config.conf
|
32
|
+
"""
|
33
|
+
|
34
|
+
Scenario: --config FILE (not found)
|
35
|
+
When I run "revenc mount --verbose --config config.conf"
|
36
|
+
Then I should not see:
|
37
|
+
"""
|
38
|
+
loading config file: config.conf
|
39
|
+
"""
|
40
|
+
And I should see:
|
41
|
+
"""
|
42
|
+
config file not found
|
43
|
+
"""
|
44
|
+
|
45
|
+
Scenario: Backtrace with --verbose option
|
46
|
+
When I run "revenc --verbose mount bad_source bad_dest"
|
47
|
+
Then the exit status should be 1
|
48
|
+
And I should see matching:
|
49
|
+
"""
|
50
|
+
lib/(.*)/app.rb
|
51
|
+
"""
|
52
|
+
|
53
|
+
Scenario: No backtrace without --verbose option
|
54
|
+
When I run "revenc mount bad_source bad_dest --no-verbose"
|
55
|
+
Then the exit status should be 1
|
56
|
+
And I should not see:
|
57
|
+
"""
|
58
|
+
/app.rb:
|
59
|
+
"""
|
@@ -0,0 +1,35 @@
|
|
1
|
+
@announce
|
2
|
+
Feature: Options via a command line interface (CLI)
|
3
|
+
|
4
|
+
As an interactive user or automated script
|
5
|
+
The application should accept options on the command line
|
6
|
+
These options should override hard coded defaults
|
7
|
+
In order to configure options
|
8
|
+
|
9
|
+
Scenario: Version info
|
10
|
+
When I run "revenc --version"
|
11
|
+
Then the exit status should be 0
|
12
|
+
And I should see matching "revenc, version ([\d]+\.[\d]+\.[\d]+$)"
|
13
|
+
|
14
|
+
Scenario: Help
|
15
|
+
When I run "revenc --help"
|
16
|
+
Then the exit status should be 0
|
17
|
+
And I should see matching:
|
18
|
+
"""
|
19
|
+
.*
|
20
|
+
Usage: .*
|
21
|
+
.*
|
22
|
+
Options:
|
23
|
+
.*
|
24
|
+
-v, --\[no-\]verbose Run verbosely
|
25
|
+
"""
|
26
|
+
|
27
|
+
Scenario: Invalid option
|
28
|
+
When I run "revenc --non-existing-option"
|
29
|
+
Then the exit status should be 1
|
30
|
+
And I should see matching:
|
31
|
+
"""
|
32
|
+
^.* invalid option: --non-existing-option
|
33
|
+
^.* --help for more information
|
34
|
+
|
35
|
+
"""
|
@@ -0,0 +1,98 @@
|
|
1
|
+
@announce
|
2
|
+
Feature: Configuration via yaml file
|
3
|
+
|
4
|
+
In order to configure options
|
5
|
+
As an interactive user or automated script
|
6
|
+
The program should process configuration options via yaml
|
7
|
+
These options should override hard coded defaults but not command line options
|
8
|
+
|
9
|
+
Background: A valid config file
|
10
|
+
Given a file named "revenc.conf" with:
|
11
|
+
"""
|
12
|
+
mount:
|
13
|
+
source:
|
14
|
+
name: source_folder_name
|
15
|
+
mountpoint:
|
16
|
+
name: destination_folder_name
|
17
|
+
passphrasefile:
|
18
|
+
name: testme1.conf
|
19
|
+
keyfile:
|
20
|
+
name: encfs6.xml
|
21
|
+
executable: echo
|
22
|
+
cmd: cat <%%= passphrasefile.name %> | ENCFS6_CONFIG=<%%= keyfile.name %> <%%= executable %> --stdinpass --reverse <%%= source.name %> <%%= mountpoint.name %> -- -o ro
|
23
|
+
unmount:
|
24
|
+
mountpoint:
|
25
|
+
name: defaults_to_mount_mountpoint
|
26
|
+
executable: echo
|
27
|
+
cmd: <%%= executable %> -u <%%= name %>
|
28
|
+
copy:
|
29
|
+
source:
|
30
|
+
name: copy_source_defaults_to_mount_mountpoint
|
31
|
+
destination:
|
32
|
+
name: copy_to_destination
|
33
|
+
executable: echo
|
34
|
+
cmd: <%%= executable %> -e ssh --bwlimit=16 --perms --links --times --recursive --verbose --compress --stats --human-readable --inplace <%%= source.name %> <%%= destination.name %>
|
35
|
+
"""
|
36
|
+
|
37
|
+
Scenario: Mount with a config file
|
38
|
+
When I run "revenc --verbose --dry-run mount"
|
39
|
+
Then I should see:
|
40
|
+
"""
|
41
|
+
mount: source=source_folder_name
|
42
|
+
mount: mountpoint=destination_folder_name
|
43
|
+
mount: passphrasefile=testme1.conf
|
44
|
+
mount: keyfile=encfs6.xml
|
45
|
+
mount: cmd=cat testme1.conf | ENCFS6_CONFIG=encfs6.xml /bin/echo --stdinpass --reverse source_folder_name destination_folder_name -- -o ro
|
46
|
+
mount: executable=/bin/echo
|
47
|
+
"""
|
48
|
+
|
49
|
+
Scenario: Unmount with a config file
|
50
|
+
When I run "revenc unmount --verbose --dry-run"
|
51
|
+
Then I should see:
|
52
|
+
"""
|
53
|
+
unmount: mountpoint=defaults_to_mount_mountpoint
|
54
|
+
unmount: cmd=/bin/echo -u defaults_to_mount_mountpoint
|
55
|
+
unmount: executable=/bin/echo
|
56
|
+
"""
|
57
|
+
|
58
|
+
Scenario: Unmount with a config file missing unmount.mountpoint
|
59
|
+
Given a file named "revenc.conf" with:
|
60
|
+
"""
|
61
|
+
mount:
|
62
|
+
mountpoint:
|
63
|
+
name: unmount_mountpoint_defaults_to_me
|
64
|
+
"""
|
65
|
+
When I run "revenc unmount --verbose --dry-run"
|
66
|
+
Then I should see:
|
67
|
+
"""
|
68
|
+
unmount: mountpoint=unmount_mountpoint_defaults_to_me
|
69
|
+
"""
|
70
|
+
|
71
|
+
Scenario: Copy with a config file
|
72
|
+
When I run "revenc copy --verbose --dry-run"
|
73
|
+
Then I should see:
|
74
|
+
"""
|
75
|
+
copy: source=copy_source_defaults_to_mount_mountpoint
|
76
|
+
copy: destination=copy_to_destination
|
77
|
+
copy: cmd=/bin/echo -e ssh --bwlimit=16 --perms --links --times --recursive --verbose --compress --stats --human-readable --inplace copy_source_defaults_to_mount_mountpoint copy_to_destination
|
78
|
+
copy: executable=/bin/echo
|
79
|
+
"""
|
80
|
+
|
81
|
+
Scenario: Copy with a config file missing source
|
82
|
+
Given a file named "revenc.conf" with:
|
83
|
+
"""
|
84
|
+
mount:
|
85
|
+
mountpoint:
|
86
|
+
name: copy_source_defaults_to_me
|
87
|
+
copy:
|
88
|
+
destination:
|
89
|
+
name: copy_to_destination
|
90
|
+
"""
|
91
|
+
When I run "revenc copy --verbose --dry-run"
|
92
|
+
Then I should see:
|
93
|
+
"""
|
94
|
+
copy: source=copy_source_defaults_to_me
|
95
|
+
copy: destination=copy_to_destination
|
96
|
+
"""
|
97
|
+
|
98
|
+
Scenario: Config file specified via the command line
|
@@ -0,0 +1,169 @@
|
|
1
|
+
@announce
|
2
|
+
Feature: Copy encrypted data to another location via rsync
|
3
|
+
|
4
|
+
As an interactive user or automated script
|
5
|
+
The program should copy the encrypted data to another location
|
6
|
+
And lock the process to prevent automated recursion on long running copy commands
|
7
|
+
In order to backup the data and allow recovery of the unencrypted data
|
8
|
+
|
9
|
+
Scenario: Sucessful copy
|
10
|
+
Given a directory named "encrypted_source_folder"
|
11
|
+
Given a directory named "encrypted_destination"
|
12
|
+
Given an empty file named "encrypted_source_folder/test_data1.txt"
|
13
|
+
Given an empty file named "encrypted_source_folder/test_data2.txt"
|
14
|
+
Given a file named "revenc.conf" with:
|
15
|
+
"""
|
16
|
+
mount:
|
17
|
+
mountpoint:
|
18
|
+
name: encrypted_source_folder
|
19
|
+
"""
|
20
|
+
When I run "revenc copy encrypted_source_folder encrypted_destination"
|
21
|
+
Then the exit status should be 0
|
22
|
+
And the following files should exist:
|
23
|
+
| encrypted_destination/encrypted_source_folder/test_data1.txt |
|
24
|
+
| encrypted_destination/encrypted_source_folder/test_data2.txt |
|
25
|
+
|
26
|
+
Scenario: Sucessful copy dry run
|
27
|
+
Given a directory named "encrypted_source_folder"
|
28
|
+
Given a directory named "encrypted_destination"
|
29
|
+
Given an empty file named "encrypted_source_folder/test_data1.txt"
|
30
|
+
Given an empty file named "encrypted_source_folder/test_data2.txt"
|
31
|
+
Given a file named "revenc.conf" with:
|
32
|
+
"""
|
33
|
+
mount:
|
34
|
+
mountpoint:
|
35
|
+
name: encrypted_source_folder
|
36
|
+
"""
|
37
|
+
When I run "revenc copy --dry-run encrypted_source_folder encrypted_destination"
|
38
|
+
Then the exit status should be 0
|
39
|
+
And the following files should not exist:
|
40
|
+
| encrypted_destination/encrypted_source_folder/test_data1.txt |
|
41
|
+
| encrypted_destination/encrypted_source_folder/test_data2.txt |
|
42
|
+
|
43
|
+
Scenario: Copy already running (mutex/lock file check)
|
44
|
+
Given a directory named "encrypted_source_folder"
|
45
|
+
Given a directory named "encrypted_destination"
|
46
|
+
Given an empty file named "encrypted_source_folder/test_data.txt"
|
47
|
+
Given a file named "revenc.conf" with:
|
48
|
+
"""
|
49
|
+
mount:
|
50
|
+
mountpoint:
|
51
|
+
name: encrypted_source_folder
|
52
|
+
"""
|
53
|
+
When I run with a lock file present "revenc copy encrypted_source_folder encrypted_destination"
|
54
|
+
Then the exit status should be 1
|
55
|
+
And I should see:
|
56
|
+
"""
|
57
|
+
action failed, lock file present
|
58
|
+
"""
|
59
|
+
|
60
|
+
Scenario: Source folder not specified
|
61
|
+
When I run "revenc copy"
|
62
|
+
Then the exit status should be 1
|
63
|
+
And I should see:
|
64
|
+
"""
|
65
|
+
source folder not specified
|
66
|
+
"""
|
67
|
+
|
68
|
+
Scenario: Destination not specified
|
69
|
+
When I run "revenc copy encrypted_source_folder"
|
70
|
+
Then the exit status should be 1
|
71
|
+
And I should see:
|
72
|
+
"""
|
73
|
+
destination not specified
|
74
|
+
"""
|
75
|
+
|
76
|
+
Scenario: Source folder doesn't exist
|
77
|
+
When I run "revenc copy encrypted_source_folder encrypted_destination"
|
78
|
+
Then the exit status should be 1
|
79
|
+
And I should see:
|
80
|
+
"""
|
81
|
+
source folder not found
|
82
|
+
"""
|
83
|
+
|
84
|
+
Scenario: Source folder is empty
|
85
|
+
Given a directory named "encrypted_source_folder"
|
86
|
+
When I run "revenc copy encrypted_source_folder encrypted_destination"
|
87
|
+
Then the exit status should be 1
|
88
|
+
And I should see:
|
89
|
+
"""
|
90
|
+
source folder is empty
|
91
|
+
"""
|
92
|
+
|
93
|
+
Scenario: Source folder contains files but mount point empty (not mounted)
|
94
|
+
Given a directory named "copy_to_destination"
|
95
|
+
Given a directory named "parent_folder"
|
96
|
+
Given a directory named "parent_folder/encrypted_data_mountpoint"
|
97
|
+
Given a directory named "parent_folder/plain_text_key_here"
|
98
|
+
Given a file named "revenc.conf" with:
|
99
|
+
"""
|
100
|
+
mount:
|
101
|
+
mountpoint:
|
102
|
+
name: parent_folder/encrypted_data_mountpoint
|
103
|
+
copy:
|
104
|
+
source:
|
105
|
+
name: parent_folder
|
106
|
+
destination:
|
107
|
+
name: copy_to_destination
|
108
|
+
"""
|
109
|
+
When I run "revenc copy --verbose --dry-run"
|
110
|
+
Then I should see:
|
111
|
+
"""
|
112
|
+
mountpoint is empty
|
113
|
+
"""
|
114
|
+
|
115
|
+
Scenario: Source folder contains files, mountpoint does not exist
|
116
|
+
Given a directory named "copy_to_destination"
|
117
|
+
Given a directory named "parent_folder"
|
118
|
+
Given a directory named "parent_folder/plain_text_key_here"
|
119
|
+
Given a file named "revenc.conf" with:
|
120
|
+
"""
|
121
|
+
mount:
|
122
|
+
mountpoint:
|
123
|
+
name: parent_folder/encrypted_data_mountpoint
|
124
|
+
copy:
|
125
|
+
source:
|
126
|
+
name: parent_folder
|
127
|
+
destination:
|
128
|
+
name: copy_to_destination
|
129
|
+
"""
|
130
|
+
When I run "revenc copy --verbose --dry-run"
|
131
|
+
Then I should see:
|
132
|
+
"""
|
133
|
+
mountpoint not found
|
134
|
+
"""
|
135
|
+
|
136
|
+
Scenario: Source folder contains files, mountpoint not specified
|
137
|
+
Given a directory named "copy_to_destination"
|
138
|
+
Given a directory named "parent_folder"
|
139
|
+
Given a directory named "parent_folder/plain_text_key_here"
|
140
|
+
Given a file named "revenc.conf" with:
|
141
|
+
"""
|
142
|
+
copy:
|
143
|
+
source:
|
144
|
+
name: parent_folder
|
145
|
+
destination:
|
146
|
+
name: copy_to_destination
|
147
|
+
"""
|
148
|
+
When I run "revenc copy --verbose --dry-run"
|
149
|
+
Then I should not see:
|
150
|
+
"""
|
151
|
+
mountpoint not found
|
152
|
+
"""
|
153
|
+
And I should not see:
|
154
|
+
"""
|
155
|
+
mountpoint is empty
|
156
|
+
"""
|
157
|
+
|
158
|
+
Scenario: Missing executable
|
159
|
+
Given a file named "revenc.conf" with:
|
160
|
+
"""
|
161
|
+
copy:
|
162
|
+
executable: missing_bin_file
|
163
|
+
"""
|
164
|
+
When I run "revenc copy encrypted_source_folder encrypted_destination"
|
165
|
+
Then the exit status should be 1
|
166
|
+
And I should see:
|
167
|
+
"""
|
168
|
+
executable not found
|
169
|
+
"""
|
@@ -0,0 +1,15 @@
|
|
1
|
+
@announce
|
2
|
+
Feature: Generate config files
|
3
|
+
|
4
|
+
As the user setting up revenc
|
5
|
+
The program should generate a config file
|
6
|
+
To save the hassle of manual config file creation
|
7
|
+
And provide reasonable starting default values
|
8
|
+
|
9
|
+
Scenario: Sucessful generate
|
10
|
+
|
11
|
+
Scenario: Config file already exists
|
12
|
+
|
13
|
+
Scenario: Source not given
|
14
|
+
|
15
|
+
Scenario: Mountpoint not given
|
@@ -0,0 +1,133 @@
|
|
1
|
+
@announce
|
2
|
+
Feature: Reverse mount encrypted folder using encfs
|
3
|
+
|
4
|
+
As a user with unencrypted data
|
5
|
+
I need to mount an encrypted folder from an unencrypted folder
|
6
|
+
In order to backup the encrypted folder to untrusted systems
|
7
|
+
|
8
|
+
@unmount_after
|
9
|
+
Scenario: Successful mount
|
10
|
+
Given a directory named "unencrypted_source_folder"
|
11
|
+
Given an empty file named "unencrypted_source_folder/test_data.txt"
|
12
|
+
Given a directory named "encrypted_destination_folder"
|
13
|
+
Given a valid encfs keyfile named "encfs6.xml"
|
14
|
+
Given a file named "passphrase" with:
|
15
|
+
"""
|
16
|
+
test
|
17
|
+
"""
|
18
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
19
|
+
Then I should not see "For more information, see the man page encfs(1)"
|
20
|
+
And the exit status should be 0
|
21
|
+
|
22
|
+
Scenario: Successful mount dry run
|
23
|
+
Given a directory named "unencrypted_source_folder"
|
24
|
+
Given an empty file named "unencrypted_source_folder/test_data.txt"
|
25
|
+
Given a directory named "encrypted_destination_folder"
|
26
|
+
Given a valid encfs keyfile named "encfs6.xml"
|
27
|
+
Given a file named "passphrase" with:
|
28
|
+
"""
|
29
|
+
test
|
30
|
+
"""
|
31
|
+
When I run "revenc --dry-run mount unencrypted_source_folder encrypted_destination_folder"
|
32
|
+
Then the exit status should be 0
|
33
|
+
And the folder "encrypted_destination_folder" should not be mounted
|
34
|
+
|
35
|
+
Scenario: Source folder not specified
|
36
|
+
When I run "revenc mount"
|
37
|
+
Then the exit status should be 1
|
38
|
+
And I should see:
|
39
|
+
"""
|
40
|
+
source folder not specified
|
41
|
+
"""
|
42
|
+
|
43
|
+
Scenario: Destination mount point not specified
|
44
|
+
When I run "revenc mount unencrypted_source_folder"
|
45
|
+
Then the exit status should be 1
|
46
|
+
And I should see:
|
47
|
+
"""
|
48
|
+
mountpoint not specified
|
49
|
+
"""
|
50
|
+
|
51
|
+
Scenario: Source folder doesn't exist
|
52
|
+
Given a directory named "encrypted_destination_folder"
|
53
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
54
|
+
Then the exit status should be 1
|
55
|
+
And I should see:
|
56
|
+
"""
|
57
|
+
source folder not found
|
58
|
+
"""
|
59
|
+
|
60
|
+
Scenario: Destination mount point doesn't exist
|
61
|
+
Given a directory named "unencrypted_source_folder"
|
62
|
+
Given an empty file named "unencrypted_source_folder/test_data.txt"
|
63
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
64
|
+
Then the exit status should be 1
|
65
|
+
And I should see:
|
66
|
+
"""
|
67
|
+
mount point not found
|
68
|
+
"""
|
69
|
+
|
70
|
+
Scenario: Destination mount point is not empty
|
71
|
+
Given a directory named "unencrypted_source_folder"
|
72
|
+
Given an empty file named "unencrypted_source_folder/test_data.txt"
|
73
|
+
Given a directory named "encrypted_destination_folder"
|
74
|
+
Given an empty file named "encrypted_destination_folder/should_not_be_here.txt"
|
75
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
76
|
+
Then the exit status should be 1
|
77
|
+
And I should see:
|
78
|
+
"""
|
79
|
+
mount point is not empty
|
80
|
+
"""
|
81
|
+
|
82
|
+
Scenario: Passphrase file not found
|
83
|
+
Given a directory named "unencrypted_source_folder"
|
84
|
+
Given an empty file named "unencrypted_source_folder/test_data.txt"
|
85
|
+
Given a directory named "encrypted_destination_folder"
|
86
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
87
|
+
Then the exit status should be 1
|
88
|
+
And I should see:
|
89
|
+
"""
|
90
|
+
mount point passphrase file not found
|
91
|
+
"""
|
92
|
+
|
93
|
+
Scenario: Passphrase file is empty
|
94
|
+
Given a directory named "unencrypted_source_folder"
|
95
|
+
Given an empty file named "unencrypted_source_folder/test_data.txt"
|
96
|
+
Given a directory named "encrypted_destination_folder"
|
97
|
+
Given an empty file named "passphrase"
|
98
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
99
|
+
Then the exit status should be 1
|
100
|
+
And I should see:
|
101
|
+
"""
|
102
|
+
mount point passphrase file is empty
|
103
|
+
"""
|
104
|
+
|
105
|
+
Scenario: Key file not found
|
106
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
107
|
+
Then the exit status should be 1
|
108
|
+
And I should see:
|
109
|
+
"""
|
110
|
+
key file not found
|
111
|
+
"""
|
112
|
+
|
113
|
+
Scenario: Key file is empty
|
114
|
+
Given an empty file named "encfs6.xml"
|
115
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
116
|
+
Then the exit status should be 1
|
117
|
+
And I should see:
|
118
|
+
"""
|
119
|
+
key file is empty
|
120
|
+
"""
|
121
|
+
|
122
|
+
Scenario: Missing executable
|
123
|
+
Given a file named "revenc.conf" with:
|
124
|
+
"""
|
125
|
+
mount:
|
126
|
+
executable: missing_bin_file
|
127
|
+
"""
|
128
|
+
When I run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
129
|
+
Then the exit status should be 1
|
130
|
+
And I should see:
|
131
|
+
"""
|
132
|
+
executable not found
|
133
|
+
"""
|
File without changes
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'revenc/io'
|
2
|
+
|
3
|
+
Given /^a valid encfs keyfile named "([^\"]*)"$/ do |filename|
|
4
|
+
steps %Q{
|
5
|
+
Given a file named "#{filename}" with:
|
6
|
+
"""
|
7
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
8
|
+
<!DOCTYPE boost_serialization>
|
9
|
+
<boost_serialization signature="serialization::archive" version="4">
|
10
|
+
<config class_id="0" tracking_level="1" version="20080816" object_id="_0">
|
11
|
+
<creator>EncFS 1.5</creator>
|
12
|
+
<cipherAlg class_id="1" tracking_level="0" version="0">
|
13
|
+
<name>ssl/aes</name>
|
14
|
+
<major>2</major>
|
15
|
+
<minor>2</minor>
|
16
|
+
</cipherAlg>
|
17
|
+
<nameAlg>
|
18
|
+
<name>nameio/null</name>
|
19
|
+
<major>1</major>
|
20
|
+
<minor>0</minor>
|
21
|
+
</nameAlg>
|
22
|
+
<keySize>128</keySize>
|
23
|
+
<blockSize>1024</blockSize>
|
24
|
+
<uniqueIV>0</uniqueIV>
|
25
|
+
<chainedNameIV>0</chainedNameIV>
|
26
|
+
<externalIVChaining>0</externalIVChaining>
|
27
|
+
<blockMACBytes>0</blockMACBytes>
|
28
|
+
<blockMACRandBytes>0</blockMACRandBytes>
|
29
|
+
<allowHoles>1</allowHoles>
|
30
|
+
<encodedKeySize>36</encodedKeySize>
|
31
|
+
<encodedKeyData>
|
32
|
+
unVmAfPQFd5t4cakBxbE7uosu4tzZbo8B513iGGNynzArOKM=
|
33
|
+
</encodedKeyData>
|
34
|
+
<saltLen>20</saltLen>
|
35
|
+
<saltData>
|
36
|
+
IcFy11sZw/w7juCI+Cro8AZVp6Q
|
37
|
+
</saltData>
|
38
|
+
<kdfIterations>97493</kdfIterations>
|
39
|
+
<desiredKDFDuration>500</desiredKDFDuration>
|
40
|
+
</config>
|
41
|
+
</boost_serialization>
|
42
|
+
"""
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
When /^I run with a lock file present "(.*)"$/ do |cmd|
|
47
|
+
lockfile = File.join(current_dir, 'revenc.lck')
|
48
|
+
Revenc::Mutex.new(lockfile).execute do
|
49
|
+
run(unescape(cmd))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
Then /^the folder "([^\"]*)" should not be mounted$/ do |folder_name|
|
54
|
+
folder = Revenc::FileFolder.new(File.join(current_dir, folder_name))
|
55
|
+
folder.exists?.should be_true
|
56
|
+
folder.should be_empty
|
57
|
+
end
|
58
|
+
|
59
|
+
Then /^the folder "([^\"]*)" should be mounted$/ do |folder_name|
|
60
|
+
folder = Revenc::FileFolder.new(File.join(current_dir, folder_name))
|
61
|
+
folder.exists?.should be_true
|
62
|
+
folder.should_not be_empty
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'aruba'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
APP_BIN_PATH = File.join(ENV['PWD'], 'bin', 'revenc')
|
5
|
+
|
6
|
+
module Aruba
|
7
|
+
module Api
|
8
|
+
|
9
|
+
alias_method :old_run, :run
|
10
|
+
|
11
|
+
# override aruba
|
12
|
+
def run(cmd)
|
13
|
+
|
14
|
+
# run development version in verbose mode
|
15
|
+
cmd = cmd.gsub(/^revenc/, "#{APP_BIN_PATH} --verbose")
|
16
|
+
|
17
|
+
# run original aruba 'run'
|
18
|
+
old_run(cmd)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
@unmount_after @announce
|
2
|
+
Feature: Unmounting a reverse mounted encrypted folder using encfs
|
3
|
+
|
4
|
+
As a user with an encfs encrypted data folder
|
5
|
+
I need to unmount an encrypted folder
|
6
|
+
In order to preserve resources
|
7
|
+
|
8
|
+
Background: Successful mount
|
9
|
+
Given a directory named "unencrypted_source_folder"
|
10
|
+
Given an empty file named "unencrypted_source_folder/test_data.txt"
|
11
|
+
Given a directory named "encrypted_destination_folder"
|
12
|
+
Given a valid encfs keyfile named "encfs6.xml"
|
13
|
+
Given a file named "passphrase" with:
|
14
|
+
"""
|
15
|
+
test
|
16
|
+
"""
|
17
|
+
And I successfully run "revenc mount unencrypted_source_folder encrypted_destination_folder"
|
18
|
+
|
19
|
+
Scenario: Successful unmount
|
20
|
+
When I run "revenc unmount encrypted_destination_folder"
|
21
|
+
Then the exit status should be 0
|
22
|
+
And the folder "encrypted_destination_folder" should not be mounted
|
23
|
+
|
24
|
+
|
25
|
+
Scenario: Successful unmount dry run
|
26
|
+
When I run "revenc --dry-run unmount encrypted_destination_folder"
|
27
|
+
Then the exit status should be 0
|
28
|
+
And the folder "encrypted_destination_folder" should be mounted
|
29
|
+
|
30
|
+
Scenario: Unmount folder not specified
|
31
|
+
When I run "revenc unmount"
|
32
|
+
Then the exit status should be 1
|
33
|
+
And I should see:
|
34
|
+
"""
|
35
|
+
mountpoint not specified
|
36
|
+
"""
|
37
|
+
|
38
|
+
Scenario: Unmount folder doesn't exist
|
39
|
+
Given a directory named "encrypted_destination_folder"
|
40
|
+
When I run "revenc unmount unencrypted_source_folder"
|
41
|
+
Then the exit status should be 1
|
42
|
+
And I should see:
|
43
|
+
"""
|
44
|
+
folder not found
|
45
|
+
"""
|
46
|
+
|
47
|
+
Scenario: Missing executable
|
48
|
+
Given a file named "revenc.conf" with:
|
49
|
+
"""
|
50
|
+
unmount:
|
51
|
+
executable: missing_bin_file
|
52
|
+
"""
|
53
|
+
When I run "revenc unmount unencrypted_source_folder"
|
54
|
+
Then the exit status should be 1
|
55
|
+
And I should see:
|
56
|
+
"""
|
57
|
+
executable not found
|
58
|
+
"""
|