Commit Graph

1107 Commits

Author SHA1 Message Date
Jakob Unterwurzacher
bcc8378a2c Fix the easy golint warnings
Reported by https://goreportcard.com/report/github.com/rfjakob/gocryptfs
2018-04-08 20:26:25 +02:00
Jakob Unterwurzacher
cab0cda449 tests: retry umount
Gnome may still have files open causing spurious test
failures.
2018-04-08 20:09:05 +02:00
Jakob Unterwurzacher
9d7392a5be tests: cli_test: fix fd leak
One fd leak found in TestMountBackground.
2018-04-07 15:46:41 +02:00
Jakob Unterwurzacher
22031d7e53 tests: matrix: check for fd leaks
And fix two in test_helpers.Mount().

Leftover fds can cause an unmount failure like this later:
fusermount: failed to unmount /tmp/gocryptfs-test-parent/873632270/default-plain: Device or resource busy
so try to catch them early.
2018-04-07 15:24:00 +02:00
Jakob Unterwurzacher
4e5783591f fsck: report skipped corrupt files
OpenDir and ListXAttr skip over corrupt entries,
readFileID treats files the are too small as empty.
This improves usability in the face of corruption,
but hides the problem in a log message instead of
putting it in the return code.

Create a channel to report these corruptions to fsck
so it can report them to the user.

Also update the manpage and the changelog with the -fsck option.

Closes https://github.com/rfjakob/gocryptfs/issues/191
2018-04-03 21:24:48 +02:00
Jakob Unterwurzacher
8b443c8484 fsck: add xattr support
With testcases.
2018-04-02 20:25:59 +02:00
Jakob Unterwurzacher
4407ca3a4d fusefrontend: xattr: return ENODATA for security.* and system.*
"ls -l" queries security.selinux, system.posix_acl_access, system.posix_acl_default
and throws error messages if it gets something else than ENODATA.
2018-04-02 18:59:14 +02:00
Jakob Unterwurzacher
a0fd3eca98 fsck: test against example_filesystems 2018-04-02 18:43:50 +02:00
Jakob Unterwurzacher
b6c8960b01 fsck: clean up log output
Make sure we get only 1 warning output per
problem.

Also, add new corruption types to broken_fs_v1.4.
2018-04-02 18:32:30 +02:00
Jakob Unterwurzacher
e6caf56ea4 fsck: sort files alphabetically
This makes fsck runs deterministic.
2018-04-02 16:56:29 +02:00
Jakob Unterwurzacher
f28d85fad5 fsck: add initial implementation
Most corruption cases except xattr should be covered.
With test filesystem.

The output is still pretty ugly. xattr support will
be added in the next commits.
2018-04-02 16:38:18 +02:00
Jakob Unterwurzacher
fb06c65ee9 fusefronted: reject oversized Read and Write requests
This should not happen via FUSE as the kernel caps the size,
but with fsck we have the first user that calls Read directly.
For symmetry, check it for Write as well.
2018-04-01 21:21:55 +02:00
Jakob Unterwurzacher
93849e28d8 main: move getMasterKey into initFuseFrontend
This is where the results are used, so call it
there.

This simplifies doMount a bit because we can get
rid of the block protecting masterkey.
2018-04-01 15:47:35 +02:00
Jakob Unterwurzacher
a4f3a7dca2 main: move masterkey logic into new helper getMasterKey
The new helper will also be used by fsck.
2018-04-01 14:51:53 +02:00
Jakob Unterwurzacher
6e637f38ff tests: add a few explicit file Close() in matrix_test
These can cause EBUSY errors when unmounting.
2018-04-01 14:51:07 +02:00
Jakob Unterwurzacher
8fcd39a3b0 main: add "-fsck" flag
The fsck operation is not yet implemented, this commits
just adds the flag and improves cli flag handling.
2018-04-01 14:25:10 +02:00
Jakob Unterwurzacher
85056def90 main: move and rename checkDir*() helper
To avoid confusion with fsck, rename to isDir*()
and move the functions into init_dir.go.
2018-04-01 12:31:44 +02:00
Jakob Unterwurzacher
5da5e467a6 main: pull regular exits into main function
The replaces the "does not return" comments with
an explicit os.Exit, which is unambigous.
2018-04-01 12:13:32 +02:00
Jakob Unterwurzacher
1a3d04ab87 Switch from private copy to pkg/xattr
Now that https://github.com/pkg/xattr/pull/24
has been merged there is no reason to keep
our private copy.

Switch to the upstream version.
2018-03-28 19:19:58 +02:00
Jakob Unterwurzacher
c3e12b5e68 dep: add xattr dependency
Also, clear out Gopkg.toml. Everything is unconstrained
anyway, so make it an empty file. Seems to work fine.
2018-03-26 21:56:43 +02:00
Jakob Unterwurzacher
b1f362d28a tests: replace xattr.Supported
This function has been deprecated by the pkg/xattr
upstream, so write our own.
2018-03-26 21:54:17 +02:00
Jakob Unterwurzacher
db778aae7d fusefrontend: handle empty xattrs efficiently
We handle empty files by storing an actual empty file
on disk. Handle xattrs similarily and encrypt the
empty value to the empty value.
2018-03-25 21:06:10 +02:00
Jakob Unterwurzacher
1ed3d51df1 fusefrontend: add xattr support
At the moment, only for reverse mode.

https://github.com/rfjakob/gocryptfs/issues/217
2018-03-25 21:06:10 +02:00
Jakob Unterwurzacher
f20974c4da test_helpers: add SwitchTestParentDir
SwitchTestParentDir changes testParentDir. This is used when you want
to perform tests on a special filesystem. For example, the xattr tests
cannot run on tmpfs and use /var/tmp instead of /tmp.
2018-03-24 21:40:11 +01:00
Jakob Unterwurzacher
3d54fc3a3a fusefrontend: create helpers for symlink encryption
These will be reused by the upcoming xattr support.
2018-03-24 21:40:11 +01:00
Jakob Unterwurzacher
9bc039a4ba Add -masterkey=stdin functionality
https://github.com/rfjakob/gocryptfs/issues/218
2018-03-22 00:02:10 +01:00
Jakob Unterwurzacher
9c86daf499 Update deps
We need the bugfix in go-fuse
2018-03-18 23:28:01 +01:00
Jakob Unterwurzacher
cdd91eaf72 Update Changelog for v1.4.4 2018-03-18 23:23:09 +01:00
Jakob Unterwurzacher
4b75b578a2 tests: extractloop.sh: better cleanup logic, handle missing /proc
macos does not have /proc, so don't try to read it.
2018-03-13 22:41:26 +01:00
Jakob Unterwurzacher
e46f6b940f tests: extractloop.sh: don't abort if md5sum is missing
MacOS does not have it installed by default.
2018-03-13 22:16:15 +01:00
Jakob Unterwurzacher
8373410678 macos: extractloop.sh: exclude symlink & mute ln error message
Extracting the symlink fails with

	linux-3.0/arch/microblaze/boot/dts/system.dts: Can't set permissions to 0755

so just exclude it.

The ln error Looks scary but is harmless, so get rid of it.
The symlink is only created to make it more convenient to view the
csv log.
2018-03-07 21:36:52 +01:00
Jakob Unterwurzacher
51de6cd940 macos: tests: make extractloop.bash work on macos
macos' bash and ln lack a few features we used.
2018-03-07 20:37:10 +01:00
Jakob Unterwurzacher
02693912e5 tests: convert remaining wget calls to dl-linux-tarball.bash helper
Makes the scripts work when wget is not available (macos)
2018-03-07 09:45:20 +01:00
Jakob Unterwurzacher
d09a51b80a macos: tests: use curl of wget is not available 2018-03-07 09:40:48 +01:00
Jakob Unterwurzacher
c458d99aa9 tests: exit with error if we have leftover filesystems 2018-03-06 21:45:49 +01:00
Jakob Unterwurzacher
50bf282d2a tests: macos: try to unmount before rm -Rf
macos does not have "rm --one-file-system", so try to unmount
all remaining test filesystems to protect the backing
stores.

https://github.com/rfjakob/gocryptfs/issues/213
2018-03-06 21:35:10 +01:00
Jakob Unterwurzacher
98f735ff6e tests: drop "-z" from fusermount to catch forgotten fds
macos does not have lazy unmount, so let's not use it
on linux either.
If the unmount fails, run "lsof" to find the open file.

Also fix the first bug we found this way.
2018-03-06 21:28:09 +01:00
Jakob Unterwurzacher
4732e33a9a macos: tests: fix deleting of scratch dir
macos rm does not understand --one-file-system,
and it cannot handle unreadable directories.
2018-03-05 23:40:08 +01:00
Jakob Unterwurzacher
18d4159d18 macos: fix fd leak in reverse tests
Causes "Resource busy" unmount failures on macos
2018-03-05 23:21:08 +01:00
Jakob Unterwurzacher
1789a5ea5b tests: matrix_test: skip cases when without_openssl is set
Fixes test-without-openssl.bash.
2018-03-05 23:11:27 +01:00
Jakob Unterwurzacher
35192abb57 test_helpers: add missing newline 2018-03-05 23:06:27 +01:00
Jakob Unterwurzacher
86e60f1be2 test.bash: Don't build with openssl if we were passed "-tags without_openssl"
test-without-openssl.bash now fails, as it should:

	gocryptfs has been compiled without openssl support but you are still trying to use openssl
	mount failed: exit status 18
	FAIL	github.com/rfjakob/gocryptfs/tests/matrix	1.943s
2018-03-05 23:01:29 +01:00
Jakob Unterwurzacher
870779ab1d macos: doTestUtimesNano: skip UTIME_OMIT and nanoseconds testcases
Not supported on macos.

Beef up the first test case a little by using different second
values.
2018-03-05 22:52:05 +01:00
Jakob Unterwurzacher
426b9536df tests: TestUtimesNano: replace ugly compareUtimes wrapper 2018-03-05 22:22:35 +01:00
Jakob Unterwurzacher
3064d72b97 tests: fix a few fd leaks
We relied on the finalizer to close a few fds.
For some reason, this did not cause problems on Linux,
but on MacOS, it causes unmount failures:

umount(/private/tmp/gocryptfs-test-parent/194654785/default-plain): Resource busy -- try 'diskutil unmount'
2018-03-05 22:00:59 +01:00
Jakob Unterwurzacher
6c172dcb02 test-without-openssl: accept extra args
Accept extra args, like test.bash does.
2018-03-05 21:46:33 +01:00
Jakob Unterwurzacher
aa65091bb9 macos: skip TestUtimesNanoSymlink early
Gets rid of the touch error message upon running the tests.
2018-03-05 21:36:16 +01:00
Jakob Unterwurzacher
b820fa691d macos: adjust TestTooLongSymlink length for darwin
Limit is much lower than on linux
2018-03-05 21:23:57 +01:00
Jakob Unterwurzacher
7db5395c53 macos: fix second TestEmulateSymlinkat test failure 2018-03-05 21:20:07 +01:00
Jakob Unterwurzacher
3860a82c21 test.bash: skip flock if not available
MacOS does not have it installed by default.
2018-03-05 21:11:46 +01:00