Commit Graph

433 Commits

Author SHA1 Message Date
Jakob Unterwurzacher
df17f1d702 tests: add verbose output when unmounting 2016-07-11 20:41:53 +02:00
Jakob Unterwurzacher
1c54fcd04b tests: use unmount wrapper in ResetTmpDir
This should make it work on OSX.

Also, split unmount into two functions. Depending on what you
want,

* UnmountErr returns the resulting error
* UnmountPanic panics if the error was not nil
2016-07-11 20:41:16 +02:00
rfjakob
621cbad5e1 README: Fix ticket #15 copy-paste errors
Thanks to @spaghetti2514 for noticing.
2016-07-10 12:16:55 +02:00
Jakob Unterwurzacher
e8a234f658 Add godoc comments to all internal packages 2016-07-06 21:51:25 +02:00
Jakob Unterwurzacher
a36b4c1b43 README: update for 1.0-rc1 2016-07-06 21:26:57 +02:00
Jakob Unterwurzacher
7f3ede473e tests: fix shadow warning
"go tool vet -shadow=true" complained about the md5 package
being shadowed by variables called "md5".
Fix by using the Md5hex helper and dropping the md5 import.
2016-07-06 21:06:42 +02:00
Jakob Unterwurzacher
9d17fdb206 tests: OSX: cast st.Blksize to int64
On Linux, Blksize is already int64. But on OSX
it is int32 and that caused a compile failure.

https://github.com/rfjakob/gocryptfs/issues/15
2016-07-04 08:22:05 +02:00
Jakob Unterwurzacher
603e144f5e prefer_openssl: OSX: get rid of /proc warnings
OSX does not have /proc/cpuinfo, but let's not warn
the user about it.
2016-07-04 08:19:26 +02:00
Jakob Unterwurzacher
52655843ab stupidgcm: use __builtin_trap()
[...]/stupidgcm/locking.go:16:2:
  warning: indirection of non-volatile null pointer will
  be deleted, not trap [-Wnull-dereference]
  [...]/stupidgcm/locking.go:16:2:
  note: consider using __builtin_trap() or qualifying
  pointer with 'volatile'

https://github.com/rfjakob/gocryptfs/issues/15
2016-07-04 08:14:24 +02:00
Jakob Unterwurzacher
77e7abdf8c XFSTESTS.md: add output from latest fuse-xfstests
fuse-xfstests is regularily rebased to xfstests master.
2016-07-03 22:15:59 +02:00
Jakob Unterwurzacher
741bf0726e syscallcompat: OSX: add Mknodat wrapper
Protip: find naked *at syscalls using:

   git grep "syscall." | grep "at(" | grep -v syscallcompat
2016-07-03 20:22:22 +02:00
Jakob Unterwurzacher
d8524c7369 syscallcompat: OSX: add Unlinkat wrapper
Also, replace remaining naked syscall.Openat calls.
2016-07-03 20:17:40 +02:00
Jakob Unterwurzacher
1d7728959c fusefrontend: downgrade Renameat log message to debug 2016-07-03 20:08:09 +02:00
Jakob Unterwurzacher
79851bf6cc syscallcompat: OSX: add Renamat wrapper
Adds a poor man's renameat implementation for OSX.
2016-07-03 20:05:32 +02:00
Jakob Unterwurzacher
9b725c15cf syscallcompat: OSX: add Fallocate and Openat wrappers
...and convert all calls to syscall.{Fallocate,Openat}
to syscallcompat .

Both syscalls are not available on OSX. We emulate Openat and just
return EOPNOTSUPP for Fallocate.
2016-07-03 19:18:34 +02:00
Jakob Unterwurzacher
c9a472c12f syscallcompat: move syscall wrapper to their own package
We will get more of them as OSX also lacks support for openat.
2016-07-03 17:51:40 +02:00
Jakob Unterwurzacher
0d5d6fc99b main: bake build date into version string
$ gocryptfs -version
gocryptfs v0.12-36-ge021b9d-dirty; go-fuse a4c968c; 2016-07-03 go1.6.2
2016-07-03 16:50:52 +02:00
Jakob Unterwurzacher
e021b9d00c main: yellow text for masterkey and zerokey warnings
Also, mention that the shell may save the command line into the
history and reduce "ps -auxwww" to "ps ax" (that's all you need).
2016-07-03 15:37:47 +02:00
Jakob Unterwurzacher
e574a6cc1f nametransform: hide detailed padding error behind the debug flag
unPad16 returns detailed errors including the position of the
incorrect bytes. Kill a possible padding oracle by lumping
everything into a generic error.

The detailed error is only logged if debug is active.
2016-07-03 15:35:58 +02:00
Jakob Unterwurzacher
d5b7eb33da tests: call umount instead of fusermount on OSX
Reported at https://github.com/rfjakob/gocryptfs/issues/15
2016-07-02 20:06:20 +02:00
Jakob Unterwurzacher
54470baa23 fusefrontend: add fallocate support
Mode=0 (default) and mode=1 (keep size) are supported.
The patch includes test cases and the whole thing passed xfstests.

Fixes https://github.com/rfjakob/gocryptfs/issues/1 .
2016-07-02 19:52:09 +02:00
Jakob Unterwurzacher
04ad063515 fusefronted: move Truncate() and Allocate() to their own file
These are large complicated implementations that will share some
code.
2016-07-02 15:35:06 +02:00
Jakob Unterwurzacher
7b22b426b9 contentenc: rename PlaintextRange and CiphertextRange
The name could be misunderstood and actually caused a bug:
doWrite used to always preallocate 4128 instead of the actual
data length.
2016-07-02 00:12:36 +02:00
Jakob Unterwurzacher
f2b4d57068 fusefrontend: coalesce grows in Truncate()
We were growing the file block-by-block which was pretty
inefficient. We now coalesce all the grows into a single
Ftruncate. Also simplifies the code!

Simplistic benchmark: Before:

  $ time truncate -s 1000M foo
  real	0m0.568s

After:

  $ time truncate -s 1000M foo
  real	0m0.205s
2016-07-01 23:32:27 +02:00
Jakob Unterwurzacher
ae77d18527 fusefrontend: better comments for Truncate 2016-07-01 09:23:04 +02:00
Jakob Unterwurzacher
e994ffa27d fusefrontend: handle dir-overwrites-dir on XFS
XFS returns a different error code if you try to overwrite
a non-empty directory with a directory:

XFS:  mv: cannot move ‘foo’ to ‘bar/foo’: File exists
ext4: mv: cannot move 'foo' to 'bar/foo': Directory not empty

So have EEXIST trigger the Rmdir logic as well.

Fixes issue #20
Link: https://github.com/rfjakob/gocryptfs/issues/20
2016-06-30 23:17:54 +02:00
Jakob Unterwurzacher
02b6d3067d test: split up integration_tests
...into "matrix" and "normal".

Also:
* Make running multiple packages in parallel safe, see
  http://stackoverflow.com/questions/23715302/go-how-to-run-tests-for-multiple-packages
* Don't depent on test_helper.TmpDir and friends to have a terminating slash
2016-06-30 00:57:14 +02:00
Jakob Unterwurzacher
ffc000943b build.bash: support colon-separated GOPATH variable
Fixes issue #31
https://github.com/rfjakob/gocryptfs/issues/31
2016-06-29 22:27:32 +02:00
Jakob Unterwurzacher
f873d5f0a1 tests: run example_filesystems with "-openssl=false" AND "=true"
Run the tests twice, once with openssl and once with Go crypto.
2016-06-27 23:43:43 +02:00
Jakob Unterwurzacher
2720cd7b0d tests: give "-plaintextnames" its own test package
...and add tests for checking that gocryptfs.diriv
does not get created.

The main "integration_tests" package has become quite
big and convoluted over time.

This small separate package should make writing tests
for "-plaintextnames" easier.

As seen in "fusefrontend: fix PlaintextNames versions of Mkdir, Rmdir",
we need more of them.
2016-06-27 21:40:39 +02:00
Jakob Unterwurzacher
c400aca5cf tlog: clean up messages from the go-fuse library
Drop the date and add the "go-fuse: " prefix so you can see
where the message is coming from.

Before:
  Jun 27 09:03:15 brikett gocryptfs[4150]: 2016/06/27 09:03:15 Unimplemented opcode INTERRUPT
After:
  Jun 27 09:10:58 brikett gocryptfs[4961]: go-fuse: Unimplemented opcode INTERRUPT
2016-06-27 09:12:03 +02:00
Jakob Unterwurzacher
3288d98703 fusefrontend: fix PlaintextNames versions of Mkdir, Rmdir
The "!fs.args.DirIV" special case was removed by b17f0465c7
but that, by accident, also removed the handling for
PlaintextNames.

Re-add it as an explicit PlaintextNames special case.

Also adds support for removing directories that miss their
gocryptfs.diriv file for some reason.
2016-06-27 00:27:36 +02:00
Jakob Unterwurzacher
547ddf4264 tlog: switch default logger to syslog
...unless "-nosyslog" is passed.

All gocryptfs messages already go to syslog, but the messages
that the go-fuse lib emits were still printed to stdout.

Fixes issue #13 ( https://github.com/rfjakob/gocryptfs/issues/13 )
2016-06-26 23:30:22 +02:00
Jakob Unterwurzacher
a8a0d2d92c MANPAGE: note that "-plaintextnames" disables symlink encryption
This is no change in behavoir, just a clarification in the man page.
2016-06-26 23:08:25 +02:00
Jakob Unterwurzacher
15b88756ad main: add "-o" option to enable "suid" and "dev"
Device files and suid binaries are often not needed when running
gocryptfs as root. As they are potentially dangerous, let the
user enable them explicitely via the new "-o" option instead of
always enabling them when running as root.
2016-06-26 23:03:18 +02:00
Jakob Unterwurzacher
0115588680 main, fusefrontend: enable suid functionality
FUSE filesystems are mounted with "nosuid" by default. If we run as root,
we can use device files by passing the opposite mount option, "suid".

Also we have to use syscall.Chmod instead of os.Chmod because the
portability translation layer "syscallMode" messes up the sgid
and suid bits.

Fixes 70% of the failures in xfstests generic/193. The remaining are
related to truncate, but we err on the safe side:

    $ diff -u tests/generic/193.out /home/jakob/src/fuse-xfstests/results//generic/193.out.bad
    [...]
     check that suid/sgid bits are cleared after successful truncate...
     with no exec perm
     before: -rwSr-Sr--
    -after:  -rw-r-Sr--
    +after:  -rw-r--r--
2016-06-26 20:13:21 +02:00
Jakob Unterwurzacher
fb5e7023ee main: enable device files when running as root
FUSE filesystems are mounted with "nodev" by default. If we run as root,
we can use device files by passing the opposite mount option, "dev".

Fixes xfstests generic/184.
2016-06-26 19:23:33 +02:00
Jakob Unterwurzacher
23cc0657f4 fusefronted: preserve owner if running as root
If allow_other is set and we run as root, try to give newly created files to
the right user.
2016-06-26 19:18:13 +02:00
Jakob Unterwurzacher
38767ab527 fuserfrontend: support truncate(2) by wrapping ftruncate(2)
Support truncate(2) by opening the file and calling ftruncate(2)
While the glibc "truncate" wrapper seems to always use ftruncate, fsstress from
xfstests uses this a lot by calling "truncate64" directly.
2016-06-26 18:41:04 +02:00
Jakob Unterwurzacher
1de5ceed58 tests: add missing file "example_test_helpers.go"
This file was forgotten in commit
"tests: make tests for unsupported FSs more compact".
2016-06-26 18:34:30 +02:00
Jakob Unterwurzacher
885ed24ac6 README: fix copy-paste error 2016-06-23 22:17:59 +02:00
Jakob Unterwurzacher
35c0c285cb README: Note that v0.6 filesystems can no longer be mounted 2016-06-23 22:16:23 +02:00
Jakob Unterwurzacher
b558901e66 Drop deprecated "-gcmiv128" option
The GCMIV128 feature flag is already mandatory, dropping the command
line option is the final step.

Completes https://github.com/rfjakob/gocryptfs/issues/29 .
2016-06-23 22:10:19 +02:00
Jakob Unterwurzacher
80fc3532f6 tests: make tests for unsupported FSs more compact
There is no need to test that deprecated command-line options
produce an error. I trust the flags package.

Also split the example_filesystem helper functions into a
separate file.
2016-06-23 22:03:45 +02:00
Jakob Unterwurzacher
3d59a72ba9 Drop deprecated "-emenames" option
The EMENames feature flag is already mandatory, dropping the command
line option is the final step.
2016-06-23 21:56:50 +02:00
Jakob Unterwurzacher
e970b1fdb5 nametransform: drop unused noiv functions
As DirIV is now mandatory there is no user for the noiv functions.
2016-06-23 21:39:04 +02:00
Jakob Unterwurzacher
b17f0465c7 Drop deprecated "-diriv" option
The DirIV feature flag is already mandatory, dropping the command
line option is the final step.
2016-06-23 21:38:59 +02:00
Jakob Unterwurzacher
8a2e1a543a tests: add v0.7-plaintextnames example filesystem
The v0.6-plaintextnames example FS lacks the GCMIV128 feature
flag, is no longer mountable and can no longer be used for testing.

Add a new "-plaintextnames" filesystem created by gocryptfs v0.7.
There have been no format changes to "-plaintextnames" since then.
2016-06-23 20:53:14 +02:00
Jakob Unterwurzacher
af07866e08 build.bash: check if the go-fuse tree is dirty
If it is, append "-dirty" to the hash.
2016-06-19 20:35:28 +02:00
Jakob Unterwurzacher
930e597f5a tests: expect mount failure for v0.6 and older example filesystems 2016-06-19 20:04:09 +02:00