Fails right now as reported in https://github.com/rfjakob/gocryptfs/pull/655
--- FAIL: TestLongnamemax100Reverse (0.09s)
longnamemax_test.go:104: l=64: should see a longname now
longnamemax_test.go:104: l=65: should see a longname now
longnamemax_test.go:104: l=66: should see a longname now
longnamemax_test.go:104: l=67: should see a longname now
longnamemax_test.go:104: l=68: should see a longname now
longnamemax_test.go:104: l=69: should see a longname now
longnamemax_test.go:104: l=70: should see a longname now
longnamemax_test.go:104: l=71: should see a longname now
longnamemax_test.go:104: l=72: should see a longname now
longnamemax_test.go:104: l=73: should see a longname now
longnamemax_test.go:104: l=74: should see a longname now
longnamemax_test.go:104: l=75: should see a longname now
longnamemax_test.go:104: l=76: should see a longname now
longnamemax_test.go:104: l=77: should see a longname now
longnamemax_test.go:104: l=78: should see a longname now
longnamemax_test.go:104: l=79: should see a longname now
longnamemax_test.go:104: l=80: should see a longname now
longnamemax_test.go:104: l=81: should see a longname now
longnamemax_test.go:104: l=82: should see a longname now
longnamemax_test.go:104: l=83: should see a longname now
longnamemax_test.go:104: l=84: should see a longname now
longnamemax_test.go:104: l=85: should see a longname now
longnamemax_test.go:104: l=86: should see a longname now
longnamemax_test.go:104: l=87: should see a longname now
longnamemax_test.go:104: l=88: should see a longname now
longnamemax_test.go:104: l=89: should see a longname now
longnamemax_test.go:104: l=90: should see a longname now
longnamemax_test.go:104: l=91: should see a longname now
longnamemax_test.go:104: l=92: should see a longname now
longnamemax_test.go:104: l=93: should see a longname now
longnamemax_test.go:104: l=94: should see a longname now
longnamemax_test.go:104: l=95: should see a longname now
longnamemax_test.go:104: l=96: should see a longname now
longnamemax_test.go:104: l=97: should see a longname now
longnamemax_test.go:104: l=98: should see a longname now
longnamemax_test.go:104: l=99: should see a longname now
longnamemax_test.go:104: l=100: should see a longname now
longnamemax_test.go:104: l=101: should see a longname now
longnamemax_test.go:104: l=102: should see a longname now
longnamemax_test.go:104: l=103: should see a longname now
longnamemax_test.go:104: l=104: should see a longname now
longnamemax_test.go:104: l=105: should see a longname now
longnamemax_test.go:104: l=106: should see a longname now
longnamemax_test.go:104: l=107: should see a longname now
longnamemax_test.go:104: l=108: should see a longname now
longnamemax_test.go:104: l=109: should see a longname now
longnamemax_test.go:104: l=110: should see a longname now
longnamemax_test.go:104: l=111: should see a longname now
longnamemax_test.go:104: l=112: should see a longname now
longnamemax_test.go:104: l=113: should see a longname now
longnamemax_test.go:104: l=114: should see a longname now
longnamemax_test.go:104: l=115: should see a longname now
longnamemax_test.go:104: l=116: should see a longname now
longnamemax_test.go:104: l=117: should see a longname now
longnamemax_test.go:104: l=118: should see a longname now
longnamemax_test.go:104: l=119: should see a longname now
longnamemax_test.go:104: l=120: should see a longname now
longnamemax_test.go:104: l=121: should see a longname now
longnamemax_test.go:104: l=122: should see a longname now
longnamemax_test.go:104: l=123: should see a longname now
longnamemax_test.go:104: l=124: should see a longname now
longnamemax_test.go:104: l=125: should see a longname now
longnamemax_test.go:104: l=126: should see a longname now
longnamemax_test.go:104: l=127: should see a longname now
longnamemax_test.go:104: l=128: should see a longname now
longnamemax_test.go:104: l=129: should see a longname now
longnamemax_test.go:104: l=130: should see a longname now
longnamemax_test.go:104: l=131: should see a longname now
longnamemax_test.go:104: l=132: should see a longname now
longnamemax_test.go:104: l=133: should see a longname now
longnamemax_test.go:104: l=134: should see a longname now
longnamemax_test.go:104: l=135: should see a longname now
longnamemax_test.go:104: l=136: should see a longname now
longnamemax_test.go:104: l=137: should see a longname now
longnamemax_test.go:104: l=138: should see a longname now
longnamemax_test.go:104: l=139: should see a longname now
longnamemax_test.go:104: l=140: should see a longname now
longnamemax_test.go:104: l=141: should see a longname now
longnamemax_test.go:104: l=142: should see a longname now
longnamemax_test.go:104: l=143: should see a longname now
longnamemax_test.go:104: l=144: should see a longname now
longnamemax_test.go:104: l=145: should see a longname now
longnamemax_test.go:104: l=146: should see a longname now
longnamemax_test.go:104: l=147: should see a longname now
longnamemax_test.go:104: l=148: should see a longname now
longnamemax_test.go:104: l=149: should see a longname now
longnamemax_test.go:104: l=150: should see a longname now
longnamemax_test.go:104: l=151: should see a longname now
longnamemax_test.go:104: l=152: should see a longname now
longnamemax_test.go:104: l=153: should see a longname now
longnamemax_test.go:104: l=154: should see a longname now
longnamemax_test.go:104: l=155: should see a longname now
longnamemax_test.go:104: l=156: should see a longname now
longnamemax_test.go:104: l=157: should see a longname now
longnamemax_test.go:104: l=158: should see a longname now
longnamemax_test.go:104: l=159: should see a longname now
longnamemax_test.go:104: l=160: should see a longname now
longnamemax_test.go:104: l=161: should see a longname now
longnamemax_test.go:104: l=162: should see a longname now
longnamemax_test.go:104: l=163: should see a longname now
longnamemax_test.go:104: l=164: should see a longname now
longnamemax_test.go:104: l=165: should see a longname now
longnamemax_test.go:104: l=166: should see a longname now
longnamemax_test.go:104: l=167: should see a longname now
longnamemax_test.go:104: l=168: should see a longname now
longnamemax_test.go:104: l=169: should see a longname now
longnamemax_test.go:104: l=170: should see a longname now
longnamemax_test.go:104: l=171: should see a longname now
longnamemax_test.go:104: l=172: should see a longname now
longnamemax_test.go:104: l=173: should see a longname now
longnamemax_test.go:104: l=174: should see a longname now
longnamemax_test.go:104: l=175: should see a longname now
FAIL
https://github.com/rfjakob/gocryptfs/pull/655
This fails at the moment:
$ go test ./tests/cli/
--- FAIL: TestMountPasswordEmpty (0.01s)
cli_test.go:430: socket file "/tmp/gocryptfs-test-parent-1026/3413782690/TestMountPasswordEmpty.753166857.sock" left behind
https://github.com/rfjakob/gocryptfs/issues/634
Our git version is v2+ for some time now, but go.mod
still declared v1. Hopefully making both match makes
https://pkg.go.dev/github.com/rfjakob/gocryptfs/v2 work.
All the import paths have been fixed like this:
find . -name \*.go | xargs sed -i s%github.com/rfjakob/gocryptfs/%github.com/rfjakob/gocryptfs/v2/%
I just got this message (not reproducible) with unescaped
binary garbage.
UnmountErr: "/var/tmp/gocryptfs-test-parent-1026/114471933/TestMountBackground.899727687.mnt" was not found in MountInfo, cannot check for FD leaks
UnmountErr: "/var/tmp/gocryptfs-test-parent-1026/114471933/TestConfigPipe.212912444.mnt" was not found in MountInfo, cannot check for FD leaks
DecryptName "mzaZRF9_0IU-_5vv2wPC_i": unPad16 error: Padding too long, padLen=49 > 16
OpenDir ".": invalid entry "KqQ346cuOAFHv_qSta5PhAwrongPattern": bad message
DecryptName "mzaZRF9_0IU-_5vv2wP_in": unPad16 error: Padding byte at i=10 is invalid
--- FAIL: TestBadname (0.11s)
cli_test.go:885: Case 5 failed: 'KqQ346cuOAFHv_qSta5P_invalid_file GOCRYPTFS_BAD_NAME' in [file_invalid_file GOCRYPTFS_BAD_NAME,file,mzaZRF9_0IU-_5vv2wPC_invalid_file GOCRYPTFS_BAD_NAME,file GOCRYPTFS_BAD_NAME,�*A���y���Gfnvalid_file GOCRYPTFS_BAD_NAME,mzaZRF9_0IU-_5vv2wP_invalid_file GOCRYPTFS_BAD_NAME]
Invalid cipherdir: directory /var/tmp/gocryptfs-test-parent-1026/114471933/TestInitNotEmpty not empty
FAIL
FAIL github.com/rfjakob/gocryptfs/tests/cli 4.817s
This proposal is the counterpart of the modifications from the `-badname`
parameter. It modifies the plain -> cipher mapping for filenames when using
`-badname` parameter. The new function `EncryptAndHashBadName` tries to find a
cipher filename for the given plain name with the following steps:
1. If `badname` is disabled or direct mapping is successful: Map directly
(default and current behaviour)
2. If a file with badname flag has a valid cipher file, this is returned
(=File just ends with the badname flag)
3. If a file with a badname flag exists where only the badname flag was added,
this is returned (=File cipher name could not be decrypted by function
`DecryptName` and just the badname flag was added)
4. Search for all files which cipher file name extists when cropping more and
more characters from the end. If only 1 file is found, return this
5. Return an error otherwise
This allows file access in the file browsers but most important it allows that
you rename files with undecryptable cipher names in the plain directories.
Renaming those files will then generate a proper cipher filename One
backdraft: When mounting the cipher dir with -badname parameter, you can never
create (or rename to) files whose file name ends with the badname file flag
(at the moment this is " GOCRYPTFS_BAD_NAME"). This will cause an error.
I modified the CLI test function to cover additional test cases. Test [Case
7](https://github.com/DerDonut/gocryptfs/blob/badnamecontent/tests/cli/cli_test.go#L712)
cannot be performed since the cli tests are executed in panic mode. The
testing is stopped on error. Since the function`DecryptName` produces internal
errors when hitting non-decryptable file names, this test was omitted.
This implementation is a proposal where I tried to change the minimum amount
of existing code. Another possibility would be instead of creating the new
function `EncryptAndHashBadName` to modify the signature of the existing
function `EncryptAndHashName(name string, iv []byte)` to
`EncryptAndHashName(name string, iv []byte, dirfd int)` and integrate the
functionality into this function directly. You may allow calling with dirfd=-1
or other invalid values an then performing the current functionality.
Also fix incomplete uid restoration in TestSupplementaryGroups
and replace syscall.Setregid and friends with unix.Setregid and
friends.
This test is added to check if have problems handling a full disk.
The ticket https://github.com/rfjakob/gocryptfs/issues/550 states
that the full disk was not where the backing gocryptfs filesystem
was, but this has no effect on gocryptfs, so we test the harder
case.
Make `gocryptfs.diriv` and `gocryptfs.xxx.name` files world-readable to make encrypted backups easier
when mounting via fstab.
Having the files follow chmod/chown of their parent does not seem
to be worth the hassle. The content of the diriv files is not
secret, and both diriv and name files are protected by the
perms of the parent dir.
Fixes https://github.com/rfjakob/gocryptfs/issues/539
Simplify the tests by using empty files. Empty
files are valid, and we don't check the content
anyway.
Also adjust comment style a little and add
a missing break statement.
Changed invalid file decoding and decryption. Function
DecryptName now shortens the filename until the filename is
decodable and decryptable. Will work with valid **and**
invalid Base64URL delimiter (valid delimiter [0-9a-zA-z_\\-].
If the filename is not decryptable at all, it returns the
original cipher name with flag suffix Changed cli tests to
generate decryptable and undecryptable file names with correct
encrypted content. Replacing #474, extends #393
When running
$ go test ./tests/matrix/
in isolation, it failed like this:
fd leak? before, after:
[0r=/dev/null 3w=/dev/null 5r=/proc/8078/fd (hidden:4)]
[0r=/dev/null 3w=/dev/null 5w=/tmp/go-build366655199/b001/testlog.txt 7r=/proc/8078/fd (hidden:4)]
Filter by prefix to get rid of this spurious test failure.
CheckTrailingGarbage was called even when "-passfile" was
used, which is stupid, and causes false positives:
https://github.com/rfjakob/gocryptfs/issues/391
(false error "Received trailing garbage after the password"
when using -passfile in .bash_profile)
Instead of trying to improve the logic to handle that case
and make everything even more complicated, delete the function.
It is unclear if actually helps in some cases, and it definitely
harms as shown by the above bug report.
The cipherdir path is used as the fsname, as displayed
in "df -T". Now, having a comma in fsname triggers a sanity check
in go-fuse, aborting the mount with:
/bin/fusermount: mount failed: Invalid argument
fuse.NewServer failed: fusermount exited with code 256
Sanitize fsname by replacing any commas with underscores.
https://github.com/rfjakob/gocryptfs/issues/262
When mounted via /etc/fstab like this,
/a /b fuse.gocryptfs default 0 0
we always get extra options passed. As reported by @mahkoh
at https://github.com/rfjakob/gocryptfs/pull/233 :
mount passes `-o noexec` if `-o user` is set and `-o exec` is not set.
If both `-o user` and `-o exec` are set, it passes `-o exec`.
Make these options work, and in addtion, also make -suid and -rw
work the same way.
Reported-by: @mahkoh
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.