Genesis patch

libgocryptfs
Hardcore Sushi 2 years ago
parent 9046d6d922
commit 847d4fa781
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E

20
.gitignore vendored

@ -1,22 +1,10 @@
# the gocryptfs executable
/gocryptfs
/build
/include
/lib
/openssl*
# temporary files created by the tests
/tmp
# binary releases and signatiures
/*.tar.gz
/*.asc
# Binaries created for cpu profiling
*.test
# Rendered manpage
gocryptfs.1
# Dependencies copied by "dep"
/vendor
/_vendor-*
# Source tarball version. Should never be committed to git.
/VERSION

@ -1,43 +0,0 @@
language: go
os: linux
# fuse on travis
sudo: required
dist: bionic # Ubuntu 18.04 "Bionic", https://docs.travis-ci.com/user/reference/bionic/
env:
- GO111MODULE=on
git:
depth: 300
# Build with the lastest relevant Go versions
# Relevance is determined from:
# * https://golang.org/dl/
# * https://packages.debian.org/search?keywords=golang&searchon=names&exact=1&suite=all&section=all
# * https://packages.ubuntu.com/search?keywords=golang&searchon=names&exact=1&suite=all&section=all
go:
- 1.11.x # Debian 10 "Buster"
- 1.12.x # Ubuntu 19.10
- 1.13.x # Debian 11 "Bullseye"
- stable
before_install:
- sudo apt-get install -qq fuse
- sudo modprobe fuse
- sudo chmod 666 /dev/fuse
- sudo chown root:$USER /etc/fuse.conf
script:
- openssl version
- df -Th / /tmp
- env GO111MODULE=on go build
- ./build-without-openssl.bash
- ./build.bash
- ./gocryptfs -speed
- ./test.bash
- make root_test
- ./crossbuild.bash
- echo "rebuild with locked dependencies"
- go mod vendor
- ./build.bash -mod=vendor

@ -1,2 +0,0 @@
# Generated man pages
*.1

@ -1,102 +0,0 @@
Stable CLI ABI
==============
If you want to call gocryptfs from your script or app, this is the
stable ABI.
General
-------
1. A password is piped into gocryptfs with an optional terminating
newline. Any unexpected data after the final newline will
cause gocryptfs to abort.
2. Always pass "--" after the options. This prevents a CIPERDIR that
starts with a dash ("-") to wreak havoc.
3. Use "-q" to get rid of all informational messages. Only error
messages (if any) will be printed to stderr (capture it!).
4. Check the exit code of gocryptfs. 0 is success, anything else is an
error and details about that error will have been printed to stderr.
Initialize Filesystem
---------------------
#### Bash example
$ cat mypassword.txt | gocryptfs -init -q -- CIPHERDIR
Content of "mypassword.txt":
mypassword1234
#### What you have to pipe to gocryptfs
1. Password
2. Optional newline
#### Notes
1. The CIPHERDIR directory must exist and be empty
#### Exit Codes
* 0 = success
* 6 = CIPHERDIR is invalid: not an empty directory
* 22 = password is empty
* 24 = could not create gocryptfs.conf
* other = please inspect the message
Mount
-----
#### Bash example
$ cat mypassword.txt | gocryptfs -q -- CIPHERDIR MOUNTPOINT
#### What you have to pipe to gocryptfs
Same as for "Initialize Filesystem".
#### Notes
1. The MOUNTPOINT directory must exist and be empty.
#### Exit Codes
* 0 = success
* 10 = MOUNTPOINT is not an empty directory or contains CIPHERDIR
* 12 = password incorrect
* 23 = gocryptfs.conf could not be opened (does not exist, is unreadable, ...)
* other = please inspect the message
Change Password
---------------
#### Bash example
$ cat change.txt | gocryptfs -passwd -q -- CIPHERDIR
Content of "change.txt":
mypassword1234
newpassword9876
#### What you have to pipe to gocryptfs
1. Old password
2. Newline
3. New password
4. Optional newline
#### Exit Codes
* 0 = success
* 12 = password incorrect
* 23 = gocryptfs.conf could not be opened for reading
* 24 = could not write the updated gocryptfs.conf
* other = please inspect the message
Further Reading
---------------
Additional exit codes that are unlikely to occur are defined in
[exitcodes.go](../internal/exitcodes/exitcodes.go).

@ -1,82 +0,0 @@
% STATFS(1)
% github.com/rfjakob
% Sep 2019
NAME
====
statfs - dump the statfs(2) information for PATH to console in JSON format.
SYNOPSIS
========
statfs PATH
DESCRIPTION
===========
The statfs(2) system call returns information about a mounted filesystem
in a `statfs_t` structure. This tool dumps this information in JSON format.
It is developed as part of gocryptfs and written in Go.
The `statfs_t` structure is architecture-dependent. On amd64 it looks like this:
```
type Statfs_t struct {
Type int64
Bsize int64
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid struct {
Val [2]int32
}
Namelen int64
Frsize int64
Flags int64
Spare [4]int64
}
```
See the statfs(2) man page for the meaning of these fields, and note
that the field names here are acc. to the Go `golang.org/x/sys/unix`
naming convention, and slightly different than in C.
EXAMPLES
========
Get the statfs(2) information for /tmp:
```
$ statfs /tmp
{
"Type": 16914836,
"Bsize": 4096,
"Blocks": 3067428,
"Bfree": 3067411,
"Bavail": 3067411,
"Files": 3067428,
"Ffree": 3067381,
"Fsid": {
"Val": [
0,
0
]
},
"Namelen": 255,
"Frsize": 4096,
"Flags": 38,
"Spare": [
0,
0,
0,
0
]
}
```
SEE ALSO
========
statfs(2) gocryptfs(1)

@ -1,64 +0,0 @@
% GOCRYPTFS-XRAY(1)
% github.com/rfjakob
% Jan 2018
NAME
====
gocryptfs-xray - examine gocryptfs-related data
SYNOPSIS
========
#### Examine encrypted file/directory
gocryptfs-xray CIPHERDIR/ENCRYPTED-FILE-OR-DIR
#### Decrypt and show master key
gocryptfs-xray -dumpmasterkey CIPHERDIR/gocryptfs.conf
#### Encrypt paths
gocryptfs-xray -encrypt-paths SOCKET
DESCRIPTION
===========
Available options are listed below.
#### -0
Use \\0 instead of \\n as separator for -decrypt-paths and -encrypt-paths.
#### -aessiv
Assume AES-SIV mode instead of AES-GCM when examining an encrypted file.
Is not needed and has no effect in `-dumpmasterkey` mode.
#### -decrypt-paths
Decrypt file paths using gocryptfs control socket. Reads from stdin.
See `-ctlsock` in gocryptfs(1).
#### -dumpmasterkey
Decrypts and shows the master key.
#### -encrypt-paths
Encrypt file paths using gocryptfs control socket. Reads from stdin.
See `-ctlsock` in gocryptfs(1).
EXAMPLES
========
Examine an encrypted file:
gocryptfs-xray myfs/mCXnISiv7nEmyc0glGuhTQ
Print the master key:
gocryptfs-xray -dumpmasterkey myfs/gocryptfs.conf
Mount gocryptfs with control socket and use gocryptfs-xray to
encrypt some paths:
gocryptfs -ctlsock myfs.sock myfs myfs.mnt
echo -e "foo\nbar" | gocryptfs-xray -encrypt-paths myfs.sock
SEE ALSO
========
gocryptfs(1) fuse(8)

@ -1,18 +0,0 @@
#!/bin/bash
set -eu
cd $(dirname "$0")
# Render Markdown to a proper man(1) manpage
function render {
IN=$1
OUT=$2
echo "Rendering $IN to $OUT"
echo ".\\\" This man page was generated from $IN. View it using 'man ./$OUT'" > $OUT
echo ".\\\"" >> $OUT
pandoc "$IN" -s -t man >> $OUT
}
render MANPAGE.md gocryptfs.1
render MANPAGE-XRAY.md gocryptfs-xray.1
render MANPAGE-STATFS.md statfs.1

@ -1,619 +0,0 @@
% GOCRYPTFS(1)
% github.com/rfjakob
% Aug 2017
NAME
====
gocryptfs - create or mount an encrypted filesystem
SYNOPSIS
========
#### Initialize new encrypted filesystem
`gocryptfs -init [OPTIONS] CIPHERDIR`
#### Mount
`gocryptfs [OPTIONS] CIPHERDIR MOUNTPOINT [-o COMMA-SEPARATED-OPTIONS]`
#### Unmount
`fusermount -u MOUNTPOINT`
#### Change password
`gocryptfs -passwd [OPTIONS] CIPHERDIR`
#### Check consistency
`gocryptfs -fsck [OPTIONS] CIPHERDIR`
#### Show filesystem information
`gocryptfs -info [OPTIONS] CIPHERDIR`
DESCRIPTION
===========
gocryptfs is an encrypted overlay filesystem written in Go.
Encrypted files are stored in CIPHERDIR, and a plain-text
view can be presented by mounting the filesystem at MOUNTPOINT.
gocryptfs was inspired by encfs(1) and strives to fix its
security issues while providing good performance.
ACTION FLAGS
============
Unless one of the following *action flags* is passed, the default
action is to mount a filesystem (see SYNOPSIS).
#### -fsck
Check CIPHERDIR for consistency. If corruption is found, the
exit code is 26.
#### -h, -help
Print a short help text that shows the more-often used options.
#### -hh
Long help text, shows all available options.
#### -info
Pretty-print the contents of the config file in CIPHERDIR for
human consumption, stripping out sensitive data.
Example:
$ gocryptfs -info my_cipherdir
Creator: gocryptfs v2.0-beta2
FeatureFlags: GCMIV128 HKDF DirIV EMENames LongNames Raw64
EncryptedKey: 64B
ScryptObject: Salt=32B N=65536 R=8 P=1 KeyLen=32
#### -init
Initialize encrypted directory.
#### -passwd
Change the password. Will ask for the old password, check if it is
correct, and ask for a new one.
This can be used together with `-masterkey` if
you forgot the password but know the master key. Note that without the
old password, gocryptfs cannot tell if the master key is correct and will
overwrite the old one without mercy. It will, however, create a backup copy
of the old config file as `gocryptfs.conf.bak`. Delete it after
you have verified that you can access your files with the
new password.
#### -speed
Run crypto speed test. Benchmark Go's built-in GCM against OpenSSL
(if available). The library that will be selected on "-openssl=auto"
(the default) is marked as such.
#### -version
Print version and exit. The output contains three fields separated by ";".
Example: "gocryptfs v1.1.1-5-g75b776c; go-fuse 6b801d3; 2016-11-01 go1.7.3".
Field 1 is the gocryptfs version, field 2 is the version of the go-fuse
library, field 3 is the compile date and the Go version that was
used.
INIT OPTIONS
============
Available options for `-init` are listed below. Usually, you don't need any.
Defaults are fine.
#### -aessiv
Use the AES-SIV encryption mode. This is slower than GCM but is
secure with deterministic nonces as used in "-reverse" mode.
#### -devrandom
Use `/dev/random` for generating the master key instead of the default Go
implementation. This is especially useful on embedded systems with Go versions
prior to 1.9, which fall back to weak random data when the getrandom syscall
is blocking. Using this option can block indefinitely when the kernel cannot
harvest enough entropy.
#### -hkdf
Use HKDF to derive separate keys for content and name encryption from
the master key. Default true.
#### -nosyslog
Diagnostic messages are normally redirected to syslog once gocryptfs
daemonizes. This option disables the redirection and messages will
continue be printed to stdout and stderr.
#### -plaintextnames
Do not encrypt file names and symlink targets.
#### -raw64
Use unpadded base64 encoding for file names. This gets rid of the
trailing "\\=\\=". A filesystem created with this option can only be
mounted using gocryptfs v1.2 and higher. Default true.
#### -reverse
Reverse mode shows a read-only encrypted view of a plaintext
directory. Implies "-aessiv".
#### -scryptn int
scrypt cost parameter expressed as scryptn=log2(N). Possible values are
10 to 28, representing N=2^10 to N=2^28.
Setting this to a lower
value speeds up mounting and reduces its memory needs, but makes
the password susceptible to brute-force attacks. The default is 16.
MOUNT OPTIONS
=============
Available options for mounting are listed below. Usually, you don't need any.
Defaults are fine.
#### -allow_other
By default, the Linux kernel prevents any other user (even root) to
access a mounted FUSE filesystem. Settings this option allows access for
other users, subject to file permission checking. Only works if
user_allow_other is set in /etc/fuse.conf. This option is equivalent to
"allow_other" plus "default_permissions" described in fuse(8).
#### -ctlsock string
Create a control socket at the specified location. The socket can be
used to decrypt and encrypt paths inside the filesystem. When using
this option, make sure that the directory you place the socket in is
not world-accessible. For example, `/run/user/UID/my.socket` would
be suitable.
#### -dev, -nodev
Enable (`-dev`) or disable (`-nodev`) device files in a gocryptfs mount
(default: `-nodev`). If both are specified, `-nodev` takes precedence.
You need root permissions to use `-dev`.
#### -e PATH, -exclude PATH
Only for reverse mode: exclude relative plaintext path from the encrypted
view, matching only from root of mounted filesystem. Can be passed multiple
times. Example:
gocryptfs -reverse -exclude Music -exclude Movies /home/user /mnt/user.encrypted
See also `-exclude-wildcard`, `-exclude-from` and the [EXCLUDING FILES](#excluding-files) section.
#### -ew PATH, -exclude-wildcard PATH
Only for reverse mode: exclude paths from the encrypted view, matching anywhere.
Wildcards supported. Can be passed multiple times. Example:
gocryptfs -reverse -exclude-wildcard '*~' /home/user /mnt/user.encrypted
See also `-exclude`, `-exclude-from` and the [EXCLUDING FILES](#excluding-files) section.
#### -exclude-from FILE
Only for reverse mode: reads exclusion patters (using `-exclude-wildcard` syntax)
from a file. Can be passed multiple times. Example:
gocryptfs -reverse -exclude-from ~/crypt-exclusions /home/user /mnt/user.encrypted
See also `-exclude`, `-exclude-wildcard` and the [EXCLUDING FILES](#excluding-files) section.
#### -exec, -noexec
Enable (`-exec`) or disable (`-noexec`) executables in a gocryptfs mount
(default: `-exec`). If both are specified, `-noexec` takes precedence.
#### -fg, -f
Stay in the foreground instead of forking away.
For compatibility, "-f" is also accepted, but "-fg" is preferred.
Unless `-notifypid` is also passed, the logs go to stdout and stderr
instead of syslog.
#### -force_owner string
If given a string of the form "uid:gid" (where both "uid" and "gid" are
substituted with positive integers), presents all files as owned by the given
uid and gid, regardless of their actual ownership. Implies "allow_other".
This is rarely desired behavior: One should *usually* run gocryptfs as the
account which owns the backing-store files, which should *usually* be one and
the same with the account intended to access the decrypted content. An example
of a case where this may be useful is a situation where content is stored on a
filesystem that doesn't properly support UNIX ownership and permissions.
#### -forcedecode
Force decode of encrypted files even if the integrity check fails, instead of
failing with an IO error. Warning messages are still printed to syslog if corrupted
files are encountered.
It can be useful to recover files from disks with bad sectors or other corrupted
media. It shall not be used if the origin of corruption is unknown, specially
if you want to run executable files.
For corrupted media, note that you probably want to use dd_rescue(1)
instead, which will recover all but the corrupted 4kB block.
This option makes no sense in reverse mode. It requires gocryptfs to be compiled with openssl
support and implies -openssl true. Because of this, it is not compatible with -aessiv,
that uses built-in Go crypto.
Setting this option forces the filesystem to read-only and noexec.
#### -fsname string
Override the filesystem name (first column in df -T). Can also be
passed as "-o fsname=" and is equivalent to libfuse's option of the
same name. By default, CIPHERDIR is used.
#### -fusedebug
Enable fuse library debug output.
#### -i duration, -idle duration
Only for forward mode: automatically unmount the filesystem if it has been idle
for the specified duration. Durations can be specified like "500s" or "2h45m".
0 (the default) means stay mounted indefinitely.
When a process has open files or its working directory in the mount,
this will keep it not idle indefinitely.
#### -kernel_cache
Enable the kernel_cache option of the FUSE filesystem, see fuse(8) for details.
#### -ko
Pass additional mount options to the kernel (comma-separated list).
FUSE filesystems are mounted with "nodev,nosuid" by default. If gocryptfs
runs as root, you can enable device files by passing the opposite mount option,
"dev", and if you want to enable suid-binaries, pass "suid".
"ro" (equivalent to passing the "-ro" option) and "noexec" may also be
interesting. For a complete list see the section
`FILESYSTEM-INDEPENDENT MOUNT OPTIONS` in mount(8). On MacOS, "local",
"noapplexattr", "noappledouble" may be interesting.
Note that unlike "-o", "-ko" is a regular option and must be passed BEFORE
the directories. Example:
gocryptfs -ko noexec /tmp/foo /tmp/bar
#### -longnames
Store names longer than 176 bytes in extra files (default true)
This flag is useful when recovering old gocryptfs filesystems using
"-masterkey". It is ignored (stays at the default) otherwise.
#### -nodev
See `-dev, -nodev`.
#### -noexec
See `-exec, -noexec`.
#### -nofail
Having the `nofail` option in `/etc/fstab` instructs `systemd` to continue
booting normally even if the mount fails (see `man systemd.fstab`).
The option is ignored by `gocryptfs` itself and has no effect outside `/etc/fstab`.
#### -nonempty
Allow mounting over non-empty directories. FUSE by default disallows
this to prevent accidental shadowing of files.
#### -noprealloc
Disable preallocation before writing. By default, gocryptfs
preallocates the space the next write will take using fallocate(2)
in mode FALLOC_FL_KEEP_SIZE. The preallocation makes sure it cannot
run out of space in the middle of the write, which would cause the
last 4kB block to be corrupt and unreadable.
On ext4, preallocation is fast and does not cause a
noticeable performance hit. Unfortunately, on Btrfs, preallocation
is very slow, especially on rotational HDDs. The "-noprealloc"
option gives users the choice to trade robustness against
out-of-space errors for a massive speedup.
For benchmarks and more details of the issue see
https://github.com/rfjakob/gocryptfs/issues/63 .
#### -nosuid
See `-suid, -nosuid`.
#### -notifypid int
Send USR1 to the specified process after successful mount. This is
used internally for daemonization.
#### -rw, -ro
Mount the filesystem read-write (`-rw`, default) or read-only (`-ro`).
If both are specified, `-ro` takes precedence.
#### -reverse
See the `-reverse` section in INIT FLAGS. You need to specifiy the
`-reverse` option both at `-init` and at mount.
#### -serialize_reads
The kernel usually submits multiple concurrent reads to service
userspace requests and kernel readahead. gocryptfs serves them
concurrently and in arbitrary order. On backing storage that performs
poorly for concurrent or out-of-order reads (like Amazon Cloud Drive),
this behavior can cause very slow read speeds.
The `-serialize_reads`
option does two things: (1) reads will be submitted one-by-one (no
concurrency) and (2) gocryptfs tries to order the reads by file
offset order.
The ordering requires gocryptfs to wait a certain time before
submitting a read. The serialization introduces extra locking.
These factors will limit throughput to below 70MB/s.
For more details visit https://github.com/rfjakob/gocryptfs/issues/92 .
#### -sharedstorage
Enable work-arounds so gocryptfs works better when the backing
storage directory is concurrently accessed by multiple gocryptfs
instances.
At the moment, it does two things:
1. Disable stat() caching so changes to the backing storage show up
immediately.
2. Disable hard link tracking, as the inode numbers on the backing
storage are not stable when files are deleted and re-created behind
our back. This would otherwise produce strange "file does not exist"
and other errors.
When "-sharedstorage" is active, performance is reduced and hard
links cannot be created.
Even with this flag set, you may hit occasional problems. Running
gocryptfs on shared storage does not receive as much testing as the
usual (exclusive) use-case. Please test your workload in advance
and report any problems you may hit.
More info: https://github.com/rfjakob/gocryptfs/issues/156
#### -suid, -nosuid
Enable (`-suid`) or disable (`-nosuid`) suid and sgid executables in a gocryptfs
mount (default: `-nosuid`). If both are specified, `-nosuid` takes precedence.
You need root permissions to use `-suid`.
#### -zerokey
Use all-zero dummy master key. This options is only intended for
automated testing as it does not provide any security.
COMMON OPTIONS
==============
Options that apply to more than one action are listed below.
Each options lists where it is applicable. Again, usually you
don't need any.
#### -config string
Use specified config file instead of `CIPHERDIR/gocryptfs.conf`.
Applies to: all actions that use a config file: mount, `-fsck`, `-passwd`, `-info`, `-init`.
#### -cpuprofile string
Write cpu profile to specified file.
Applies to: all actions.
#### -d, -debug
Enable debug output.
Applies to: all actions.
#### -extpass CMD [-extpass ARG1 ...]
Use an external program (like ssh-askpass) for the password prompt.
The program should return the password on stdout, a trailing newline is
stripped by gocryptfs. If you just want to read from a password file, see `-passfile`.
When `-extpass` is specified once, the string argument will be split on spaces.
For example, `-extpass "md5sum my password.txt"` will be executed as
`"md5sum" "my" "password.txt"`, which is NOT what you want.
Specify `-extpass` twice or more to use the string arguments as-is.
For example, you DO want to call `md5sum` like this:
`-extpass "md5sum" -extpass "my password.txt"`.
If you want to prevent splitting on spaces but don't want to pass arguments
to your program, use `"--"`, which is accepted by most programs:
`-extpass "my program" -extpass "--"`
Applies to: all actions that ask for a password.
#### -fido2 DEVICE_PATH
Use a FIDO2 token to initialize and unlock the filesystem.
Use "fido2-token -L" to obtain the FIDO2 token device path.
Applies to: all actions that ask for a password.
#### -masterkey string
Use a explicit master key specified on the command line or, if the special
value "stdin" is used, read the masterkey from stdin, instead of reading
the config file and asking for the decryption password.
Note that the command line, and with it the master key, is visible to
anybody on the machine who can execute "ps -auxwww". Use "-masterkey=stdin"
to avoid that risk.
The masterkey option is meant as a recovery option for emergencies, such as
if you have forgotten the password or lost the config file.
Even if a config file exists, it will not be used. All non-standard
settings have to be passed on the command line: `-aessiv` when you
mount a filesystem that was created using reverse mode, or
`-plaintextnames` for a filesystem that was created with that option.
Examples:
-masterkey=6f717d8b-6b5f8e8a-fd0aa206-778ec093-62c5669b-abd229cd-241e00cd-b4d6713d
-masterkey=stdin
Applies to: all actions that ask for a password.
#### -memprofile string
Write memory profile to the specified file. This is useful when debugging
memory usage of gocryptfs.
Applies to: all actions.
#### -o COMMA-SEPARATED-OPTIONS
For compatibility with mount(1), options are also accepted as
"-o COMMA-SEPARATED-OPTIONS" at the end of the command line.
For example, "-o q,zerokey" is equivalent to passing "-q -zerokey".
Note that you can only use options that are understood by gocryptfs
with "-o". If you want to pass special flags to the kernel, you should
use "-ko" (*k*ernel *o*ption). This is different in libfuse-based
filesystems, that automatically pass any "-o" options they do not
understand along to the kernel.
Example:
gocryptfs /tmp/foo /tmp/bar -o q,zerokey
Applies to: all actions.
#### -openssl bool/"auto"
Use OpenSSL instead of built-in Go crypto (default "auto"). Using
built-in crypto is 4x slower unless your CPU has AES instructions and
you are using Go 1.6+. In mode "auto", gocrypts chooses the faster
option.
Applies to: all actions.
#### -passfile FILE [-passfile FILE2 ...]
Read password from the specified plain text file. The file should contain exactly
one line (do not use binary files!).
A warning will be printed if there is more than one line, and only
the first line will be used. A single
trailing newline is allowed and does not cause a warning.
Pass this option multiple times to read the first line from multiple
files. They are concatenated for the effective password.
Example:
echo hello > hello.txt
echo word > world.txt
gocryptfs -passfile hello.txt -passfile world.txt
The effective password will be "helloworld".
Applies to: all actions that ask for a password.
#### -q, -quiet
Quiet - silence informational messages.
Applies to: all actions.
#### -trace string
Write execution trace to file. View the trace using "go tool trace FILE".
Applies to: all actions.
#### -wpanic
When encountering a warning, panic and exit immediately. This is
useful in regression testing.
Applies to: all actions.
#### \-\-
Stop option parsing. Helpful when CIPHERDIR may start with a
dash "-".
Applies to: all actions.
EXCLUDING FILES
===============
In reverse mode, it is possible to exclude files from the encrypted view, using
the `-exclude`, `-exclude-wildcard` and `-exclude-from` options.
`-exclude` matches complete paths, so `-exclude file.txt` only excludes a file
named `file.txt` in the root of the mounted filesystem; files named `file.txt`
in subdirectories are still visible. (This option is kept for compatibility
with the behavior up to version 1.6.x)
`-exclude-wildcard` matches files anywhere, so `-exclude-wildcard file.txt`
excludes files named `file.txt` in any directory. If you want to match complete
paths, you can prefix the filename with a `/`: `-exclude-wildcard /file.txt`
excludes only `file.txt` in the root of the mounted filesystem.
If there are many exclusions, you can use `-exclude-from` to read exclusion
patterns from a file. The syntax is that of `-exclude-wildcard`, so use a
leading `/` to match complete paths.
The rules for exclusion are that of [gitignore](https://git-scm.com/docs/gitignore#_pattern_format).
In short:
1. A blank line matches no files, so it can serve as a separator
for readability.
2. A line starting with `#` serves as a comment. Put a backslash (`\`)
in front of the first hash for patterns that begin with a hash.
3. Trailing spaces are ignored unless they are quoted with backslash (`\`).
4. An optional prefix `!` negates the pattern; any matching file
excluded by a previous pattern will become included again. It is not
possible to re-include a file if a parent directory of that file is
excluded. Put a backslash (`\`) in front of the first `!` for
patterns that begin with a literal `!`, for example, `\!important!.txt`.
5. If the pattern ends with a slash, it is removed for the purpose of the
following description, but it would only find a match with a directory.
In other words, `foo/` will match a directory foo and paths underneath it,
but will not match a regular file or a symbolic link foo.
6. If the pattern does not contain a slash `/`, it is treated as a shell glob
pattern and checked for a match against the pathname relative to the
root of the mounted filesystem.
7. Otherwise, the pattern is treated as a shell glob suitable for
consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the
pattern will not match a `/` in the pathname. For example,
`Documentation/*.html` matches `Documentation/git.html` but not
`Documentation/ppc/ppc.html` or `tools/perf/Documentation/perf.html`.
8. A leading slash matches the beginning of the pathname. For example,
`/*.c` matches `cat-file.c` but not `mozilla-sha1/sha1.c`.
9. Two consecutive asterisks (`**`) in patterns matched against full
pathname may have special meaning:
i. A leading `**` followed by a slash means match in all directories.
For example, `**/foo` matches file or directory `foo` anywhere,
the same as pattern `foo`. `**/foo/bar` matches file or directory
`bar` anywhere that is directly under directory `foo`.
ii. A trailing `/**` matches everything inside. For example, `abc/**`
matches all files inside directory `abc`, with infinite depth.
iii. A slash followed by two consecutive asterisks then a slash matches
zero or more directories. For example, `a/**/b` matches `a/b`,
`a/x/b`, `a/x/y/b` and so on.
iv. Other consecutive asterisks are considered invalid.
EXAMPLES
========
### Init
Create an encrypted filesystem in directory "mydir.crypt", mount it on "mydir":
mkdir mydir.crypt mydir
gocryptfs -init mydir.crypt
gocryptfs mydir.crypt mydir
### Mount
Mount an encrypted view of joe's home directory using reverse mode:
mkdir /home/joe.crypt
gocryptfs -init -reverse /home/joe
gocryptfs -reverse /home/joe /home/joe.crypt
### fstab
Adding this line to `/etc/fstab` will mount `/tmp/cipher` to `/tmp/plain` on boot, using the
password in `/tmp/passfile`. Use `sudo mount -av` to test the line without having
to reboot. Adjust the gocryptfs path acc. to the output of the command `which gocryptfs`.
Do use the `nofail` option to prevent an unbootable system if the gocryptfs mount fails (see
the `-nofail` option for details).
/tmp/cipher /tmp/plain fuse./usr/local/bin/gocryptfs nofail,allow_other,passfile=/tmp/password 0 0
EXIT CODES
==========
0: success
6: CIPHERDIR is not an empty directory (on "-init")
10: MOUNTPOINT is not an empty directory
12: password incorrect
22: password is empty (on "-init")
23: could not read gocryptfs.conf
24: could not write gocryptfs.conf (on "-init" or "-password")
26: fsck found errors
other: please check the error message
See also: https://github.com/rfjakob/gocryptfs/blob/master/internal/exitcodes/exitcodes.go
SEE ALSO
========
mount(2) fuse(8) fallocate(2) encfs(1)

@ -1 +0,0 @@
This page has been moved to https://nuetzlich.net/gocryptfs/security/ .

File diff suppressed because one or more lines are too long

@ -1,36 +0,0 @@
ls: cannot access foo: No such file or directory
ls: cannot access foo: No such file or directory
ls: cannot access foo: No such file or directory
ls: cannot access foo: No such file or directory
36962337 -rwxrwxrwx 1 u1026 users 0 Nov 11 18:00 foo
36962337 -rwxrwxrwx 1 u1026 users 0 Nov 11 18:00 foo
36962337 -rwxrwxrwx 1 u1026 users 0 Nov 11 18:00 foo
36962337 -rwxrwxrwx 1 u1026 users 0 Nov 11 18:00 foo
u1026@d8min:/mnt/synology/public/tmp/g1$ strace -e lstat -p 8899 -f
Process 8899 attached with 10 threads
2017/11/11 18:12:21 Dispatch 238: LOOKUP, NodeId: 1. names: [foo] 4 bytes
[pid 10539] lstat("/mnt/synology/public/tmp/g1/a/4DZNVle_txclugO7n_FRIg", 0xc4241adbe8) = -1 ENOENT (No such file or directory)
2017/11/11 18:12:21 Serialize 238: LOOKUP code: OK value: {NodeId: 0 Generation=0 EntryValid=1.000 AttrValid=0.000 Attr={M00 SZ=0 L=0 0:0 B0*0 i0:0 A 0.000000000 M 0.000000000 C 0.000000000}}
2017/11/11 18:12:22 Dispatch 239: LOOKUP, NodeId: 1. names: [foo] 4 bytes
[pid 8903] lstat("/mnt/synology/public/tmp/g1/a/Xsy8mhdcIh0u9aiI7-iLiw", {st_mode=S_IFREG|0777, st_size=0, ...}) = 0
2017/11/11 18:12:22 Serialize 239: LOOKUP code: OK value: {NodeId: 3 Generation=4 EntryValid=1.000 AttrValid=1.000 Attr={M0100777 SZ=0 L=1 1026:100 B0*16384 i0:36962337 A 1510419642.457639700 M 1510419642.457639700 C 1510419702.353712800}}
Call Trace:
nodefs/fsops.go (c *rawBridge) Lookup
nodefs/fsops.go (c *FileSystemConnector) internalLookup
nodefs/inode.go (n *Inode) GetChild
pathfs/pathfs.go (n *pathInode) GetAttr
pathfs/pathfs.go (n *pathInode) GetPath
nodefs/inode.go (n *Inode) Parent()
pathfs/loopback.go (fs *loopbackFileSystem) GetAttr
Call Trace 2 (new child):
nodefs/fsops.go (c *rawBridge) Lookup
nodefs/fsops.go (c *FileSystemConnector) internalLookup
pathfs/pathfs.go (n *pathInode) Lookup
pathfs/pathfs.go (n *pathInode) findChild

@ -1,56 +0,0 @@
# extractloop.bash results
Memory usage stabilises at 141MiB, we do not run out of fds,
and the iteration time is stable around 38 seconds:
![](extractloop_plot_csv.png)
What the extractloop stress test does is (top comment in `tests/stress_tests/extractloop.bash`):
```
# Mount a gocryptfs filesystem somewhere on /tmp, then run two parallel
# infinite loops inside that do the following:
# 1) Extract linux-3.0.tar.gz
# 2) Verify the md5sums
# 3) Delete, go to (1)
#
# This test is good at discovering inode-related memory leaks because it creates
# huge numbers of files.
```
Test output (trimmed for brevity):
```
~/go/src/github.com/rfjakob/gocryptfs/tests/stress_tests$ ./extractloop.bash
20803 (process ID) old priority 0, new priority 19
Testing gocryptfs
Test dir: /tmp/extractloop_tmpdir/SMc
'/tmp/extractloop.csv' -> '/tmp/extractloop_tmpdir/SMc.csv'
[looper 2] Starting
[looper 1] Starting
[looper 2] Iteration 1 done, 42 seconds, RSS 36020 kiB
[looper 1] Iteration 1 done, 42 seconds, RSS 36020 kiB
[looper 2] Iteration 2 done, 40 seconds, RSS 45400 kiB
[looper 1] Iteration 2 done, 40 seconds, RSS 45400 kiB
[looper 1] Iteration 3 done, 40 seconds, RSS 53396 kiB
[looper 2] Iteration 3 done, 40 seconds, RSS 53396 kiB
[looper 1] Iteration 4 done, 39 seconds, RSS 64588 kiB
[looper 2] Iteration 4 done, 40 seconds, RSS 64588 kiB
[looper 1] Iteration 5 done, 40 seconds, RSS 64588 kiB
[looper 2] Iteration 5 done, 39 seconds, RSS 64588 kiB
[looper 1] Iteration 6 done, 39 seconds, RSS 71628 kiB
[...]
[looper 1] Iteration 945 done, 38 seconds, RSS 140832 kiB
[looper 2] Iteration 946 done, 38 seconds, RSS 140832 kiB
[looper 1] Iteration 946 done, 38 seconds, RSS 140832 kiB
[looper 1] Iteration 947 done, 37 seconds, RSS 140832 kiB
[looper 2] Iteration 947 done, 37 seconds, RSS 140832 kiB
[looper 1] Iteration 948 done, 38 seconds, RSS 140832 kiB
[looper 2] Iteration 948 done, 38 seconds, RSS 140832 kiB
[looper 1] Iteration 949 done, 38 seconds, RSS 140832 kiB
[looper 2] Iteration 949 done, 38 seconds, RSS 140832 kiB
[looper 1] Iteration 950 done, 38 seconds, RSS 140832 kiB
[looper 2] Iteration 950 done, 38 seconds, RSS 140832 kiB
[looper 1] Iteration 951 done, 38 seconds, RSS 140832 kiB
[looper 2] Iteration 951 done, 38 seconds, RSS 140832 kiB
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

@ -1,39 +0,0 @@
File Format
===========
Header
2 bytes header version (big endian uint16, currently 2)
16 bytes file id
Data block, default AES-GCM mode
16 bytes GCM IV (nonce)
1-4096 bytes encrypted data
16 bytes GHASH
Data block, AES-SIV mode (used in reverse mode, or when explicitly enabled with `-init -aessiv`)
16 bytes nonce
16 bytes SIV
1-4096 bytes encrypted data
Full block overhead = 32/4096 = 1/128 = 0.78125 %
Example: 1-byte file
--------------------
Header 18 bytes
Data block 33 bytes
Total: 51 bytes
Example: 5000-byte file
-----------------------
Header 18 bytes
Data block 4128 bytes
Data block 936 bytes
Total: 5082 bytes

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

@ -1,10 +0,0 @@
Results from benchmark-reverse.bash
VERSION LS CAT ENV
------- --- ---- ---
v1.3 2.1 19.9 go1.9.2
v1.4 2.1 18.2
v1.5 3.4 19.6 go1.10.3, Linux 4.17.12
v1.6 3.6 19.9 go1.10.3, Linux 4.17.12
(seconds)

@ -1,86 +0,0 @@
Tests of gocryptfs v1.7 and later are run on an
Intel Core i5-3470 CPU (quad-core Ivy Bridge, AES-NI supported).
Earlier tests on a Pentium G630 (Dual-core Sandy Bridge, no AES-NI).
The working directory is on tmpfs.
The untar test uses https://cdn.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz .
The archive is placed on tmpfs as well.
WRITE: dd if=/dev/zero of=zero bs=131072 count=2000
READ: dd if=zero of=/dev/null bs=131072 count=2000
UNTAR: time tar xzf ../linux-3.0.tar.gz
MD5: time md5sum --quiet -c linux-3.0.md5sums
LS: time ls -lR linux-3.0 > /dev/null
RM: time rm -Rf linux-3.0
(or just run benchmark.bash)
VERSION WRITE READ UNTAR MD5 LS RM ENV CHANGE? COMMIT MSG
**********************
* CPU = Pentium G630 *
**********************
v0.4 48 1.5 5
v0.5-rc1 56 7 19
v0.5-rc1-1 54 4.1 9
v0.5-rc1-2 45 1.7 3.4
v0.6 47 1.8 4.3
v0.7 43 1.7 4.3
v0.7.2 26 1.8 4.3
v0.8 23 1.8 4.3
v0.9-rc2 94 24 1.8 4.5
v0.9 94 24 1.8 4.5
v0.11 104 22 1.7 4.5
v1.1 104 20 1.5 3.4 go1.7.1
v1.1.1-34 112 22 1.5 3.6 go1.7.3
v1.2.1-33 112 21 12 1.6 4.4 go1.8
-serialize_reads 116 21 39 1.5 4.4 (v1.2.1-33 with -serialize_reads)
v1.3-27 113 20 11 1.4 4.2
v1.3-53-gf44902a 119 19 12 1.6 4.1
v1.3-64-g80516ed 123 19 11 1.3 4.2
v1.3-67-g9837cb0 125 19 11 1.4 4.2 go1.8.3, Linux 4.10
v1.3-69-ge52594d 145 19.0 11.6 1.4 4.1
v1.4-1-g3c6fe98 154 17.2 11.7 1.4 4.1
v1.4-5-g0cc6f53 182 144 16.7 11.1 1.3 3.3
v1.4-8-g80676c6 178 148 16.1 11.0 1.3 4.0
v1.4-14-g9f4bd76 182 286 15.4 7.5 1.3 4.1
v1.4-45-gd5671b7 183 282 14.9 7.3 1.1 2.9
v1.4-45-gd5671b7 252 285 15.5 7.2 1.1 2.9 go1.8.3, Linux 4.11
v1.4.1 253 285 16.0 7.4 1.3 3.0 go1.9, Linux 4.12.5
v1.4.1-6-g276567e 258 289 16.1 7.5 1.3 3.0
v1.5 228 292 17.6 9.3 1.5 3.5 go1.10.2, Linux 4.16.8
v1.6 250 289 17.7 8.0 1.3 3.2 go1.10.3, Linux 4.17.12
v1.7-beta1 229 278 17.1 8.8 1.7 3.2 go1.11.4, Linux 4.19.12
v1.7-rc1 226 289 17.6 8.9 1.7 2.9
********************************************
* CPU = Core i5-3470, governor = powersave *
********************************************
v1.7 232 698 12.2 9.4 1.7 4.3 go1.12.9, Linux 5.2.17
v1.7.1 450 697 11.5 9.5 1.5 3.6
**********************************************
* CPU = Core i5-3470, governor = performance *
**********************************************
v1.7.1 556 1000 9.0 4.2 0.9 2.0 go1.13.6, Linux 5.4.17
v1.7.1 577 1100 8.3 4.2 0.9 2.0 go1.14.2, Linux 5.6.7
v1.7.1-60-gb23f77c 472 1100 12.7 4.2 0.8 2.0
v1.8.0 410 1000 17.5 6.7 5.4 7.8 go1.15.3, Linux 5.8.13
v2.0-beta1 387 1100 36.2 14.4 12.8 19.3
v2.0-beta1-5-gc943ed3 417 1000 30.4 12.7 9.9 16.4
v2.0-beta1-6 529 1100 17.5 9.0 3.6 9.0
v2.0-beta1-9-g029e44d 477 1000 15.5 8.7 2.8 7.6
v2.0-beta2-16-geaca820 542 997 15.9 8.8 6.2 7.8 go1.16.2, Linux 5.11.10 fusefrontend: do not encrypt ACLs
v2.0-beta2-36-g6aae2aa 505 1000 16.1 8.2 6.3 7.7
v2.0-beta2-37-g24d5d39 558 1000 12.3 6.4 4.4 2.8 fs: add initial dirfd caching
v2.0-beta2-42-g4a07d65 549 1000 8.2 4.7 1.8 2.4 fusefrontend: make dirCache work for "node itself"
v2.0 420 1000 8.5 4.5 1.8 2.3 go1.16.5, Linux 5.11.21
Results for EncFS for comparison (benchmark.bash -encfs):
VERSION WRITE READ UNTAR MD5 LS RM
**********************
* CPU = Pentium G630 *
**********************
encfs v1.9.1 95 20 8 2.8 3.8
**********************************************
* CPU = Core i5-3470, governor = performance *
**********************************************
encfs v1.9.5 138 459 12.2 5.1 2.2 3.0

@ -1,25 +0,0 @@
.phony: build
build:
./build.bash
./Documentation/MANPAGE-render.bash
.phony: test
test:
./test.bash
.phony: root_test
root_test:
./build.bash
cd tests/root_test && go test -c && sudo ./root_test.test -test.v
.phony: format
format:
go fmt ./...
.phony: install
install:
install -Dm755 -t "$(DESTDIR)/usr/bin/" gocryptfs
install -Dm755 -t "$(DESTDIR)/usr/bin/" gocryptfs-xray/gocryptfs-xray
install -Dm644 -t "$(DESTDIR)/usr/share/man/man1/" Documentation/gocryptfs.1
install -Dm644 -t "$(DESTDIR)/usr/share/man/man1/" Documentation/gocryptfs-xray.1
install -Dm644 -t "$(DESTDIR)/usr/share/licenses/gocryptfs" LICENSE

@ -1,700 +1,6 @@
[![gocryptfs](Documentation/gocryptfs-logo.png)](https://nuetzlich.net/gocryptfs/)
[![Build Status](https://travis-ci.org/rfjakob/gocryptfs.svg?branch=master)](https://travis-ci.org/rfjakob/gocryptfs)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/rfjakob/gocryptfs)](https://goreportcard.com/report/github.com/rfjakob/gocryptfs)
[![Latest release](https://img.shields.io/github/release/rfjakob/gocryptfs.svg)](https://github.com/rfjakob/gocryptfs/releases)
[![Homebrew version](https://img.shields.io/homebrew/v/gocryptfs.svg)](https://formulae.brew.sh/formula/gocryptfs#default)
libgocryptfs is a re-desing of the original [gocryptfs](https://github.com/rfjakob/gocryptfs) code to work as a library. Volumes are not mounted with [FUSE](https://www.kernel.org/doc/html/latest/filesystems/fuse.html) but rather opened in memory and accessed through API calls. What the purpose ?
- Allow the use of gocryptfs in embedded devices where FUSE is not available (such as Android)
- Reduce attack surface by restricting volumes access to only one process rather than one user
An encrypted overlay filesystem written in Go.
Official website: https://nuetzlich.net/gocryptfs ([markdown source](https://github.com/rfjakob/gocryptfs-website/blob/master/docs/index.md)).
![Folders side-by-side animation](Documentation/folders-side-by-side.gif)
gocryptfs is built on top the excellent
[go-fuse](https://github.com/hanwen/go-fuse) FUSE library.
This project was inspired by EncFS and strives to fix its security
issues while providing good performance
([benchmarks](https://nuetzlich.net/gocryptfs/comparison/#performance)).
For details on the security of gocryptfs see the
[Security](https://nuetzlich.net/gocryptfs/security/) design document.
All tags from v0.4 onward are signed by the *gocryptfs signing key*.
Please check [Signed Releases](https://nuetzlich.net/gocryptfs/releases/)
for details.
Current Status
--------------
gocryptfs has reached version 1.0 on July 17, 2016. It has gone through
hours and hours of stress (fsstress, extractloop.bash) and correctness
testing (xfstests). It is now considered ready for general consumption.
The old principle still applies: Important data should have a backup.
Also, keep a copy of your master key (printed on mount) in a safe place.
This allows you to access the data even if the gocryptfs.conf config
file is damaged or you lose the password.
The security of gocryptfs has been audited in March 3, 2017. The audit
is available [here (defuse.ca)](https://defuse.ca/audits/gocryptfs.htm).
Platforms
---------
Linux is gocryptfs' native platform.
Beta-quality Mac OS X support is available, which means most things work
fine but you may hit an occasional problem. Check out
[ticket #15](https://github.com/rfjakob/gocryptfs/issues/15) for the history
of Mac OS X support but please create a new ticket if you hit a problem.
For Windows, an independent C++ reimplementation can be found here:
[cppcryptfs](https://github.com/bailey27/cppcryptfs)
A standalone Python tool that can decrypt files & file names is here:
[gocryptfs-inspect](https://github.com/slackner/gocryptfs-inspect)
Installation
------------
Precompiled binaries that work on all x86_64 Linux systems are available for download from the github releases page.
On Debian, gocryptfs is available as a deb package:
```bash
apt install gocryptfs
```
On Mac OS X, gocryptfs is available as a Homebrew formula:
```bash
brew install gocryptfs
```
On Fedora, gocryptfs is available as an rpm package:
```bash
sudo dnf install gocryptfs
```
If you use the standalone binary, make sure you install the `fuse` package
from your distributions package repository before running `gocryptfs`.
See the [Quickstart](https://nuetzlich.net/gocryptfs/quickstart/) page for more info.
Testing
-------
gocryptfs comes with is own test suite that is constantly expanded as features are
added. Run it using `./test.bash`. It takes about 1 minute and requires FUSE
as it mounts several test filesystems.
The `stress_tests` directory contains stress tests that run indefinitely.
In addition, I have ported `xfstests` to FUSE, the result is the
[fuse-xfstests](https://github.com/rfjakob/fuse-xfstests) project. gocryptfs
passes the "generic" tests with one exception, results: [XFSTESTS.md](Documentation/XFSTESTS.md)
A lot of work has gone into this. The testing has found bugs in gocryptfs
as well as in the go-fuse library.
Compile
-------
Install Go 1.11 or higher:
* Debian/Ubuntu: `apt install golang`
* Fedora: `dnf install golang`
Then, download the source code and compile:
$ git clone https://github.com/rfjakob/gocryptfs.git
$ cd gocryptfs
$ ./build-without-openssl.bash
This will compile a static binary that uses the Go stdlib crypto backend.
If you want to use the OpenSSL crypto backend (faster on
old CPUs lacking AES-NI), you have to install a few dependencies:
* Debian/Ubuntu: `apt install libssl-dev gcc pkg-config`
* Fedora: `dnf install openssl-devel gcc pkg-config`
Then, run:
$ ./build.bash
Use
---
$ mkdir cipher plain
$ ./gocryptfs -init cipher
$ ./gocryptfs cipher plain
See the [Quickstart](https://nuetzlich.net/gocryptfs/quickstart/) page for more info.
The [MANPAGE.md](Documentation/MANPAGE.md) describes all available command-line options.
Use: Reverse Mode
-----------------
$ mkdir cipher plain
$ ./gocryptfs -reverse -init plain
$ ./gocryptfs -reverse plain cipher
Graphical Interface
-------------------
The [SiriKali](https://mhogomchungu.github.io/sirikali/) project supports
gocryptfs and runs on Linux and OSX.
[cppcryptfs](https://github.com/bailey27/cppcryptfs) on Windows provides
its own GUI.
Stable CLI ABI
--------------
If you want to call gocryptfs from your app or script, see
[CLI_ABI.md](Documentation/CLI_ABI.md) for the official stable
ABI. This ABI is regression-tested by the test suite.
Storage Overhead
----------------
* Empty files take 0 bytes on disk
* 18 byte file header for non-empty files (2 bytes version, 16 bytes random file id)
* 32 bytes of storage overhead per 4kB block (16 byte nonce, 16 bytes auth tag)
[file-format.md](Documentation/file-format.md) contains a more detailed description.
Performance
-----------
Since version 0.7.2, gocryptfs is as fast as EncFS in the default mode,
and significantly faster than EncFS' "paranoia" mode that provides
a security level comparable to gocryptfs.
On CPUs without AES-NI, gocryptfs uses OpenSSL through a thin wrapper called `stupidgcm`.
This provides a 4x speedup compared to Go's builtin AES-GCM
implementation. See [CPU-Benchmarks](https://github.com/rfjakob/gocryptfs/wiki/CPU-Benchmarks)
for details, or run `gocryptfs -speed` to see the encryption performance of your CPU.
Example for a CPU without AES-NI:
```
$ ./gocryptfs -speed
gocryptfs v2.0; go-fuse v2.1.1-0.20210508151621-62c5aa1919a7; 2021-06-06 go1.16.5 linux/amd64
AES-GCM-256-OpenSSL 536.63 MB/s
AES-GCM-256-Go 831.84 MB/s (selected in auto mode)
AES-SIV-512-Go 155.85 MB/s
XChaCha20-Poly1305-Go 700.02 MB/s (benchmark only, not selectable yet)
```
You can run `./benchmark.bash` to run gocryptfs' canonical set of
benchmarks that include streaming write, extracting a linux kernel
tarball, recursively listing and finally deleting it. The output will
look like this:
```
$ ./benchmark.bash
Testing gocryptfs at /tmp/benchmark.bash.xFD: gocryptfs v2.0; go-fuse v2.1.1-0.20210508151621-62c5aa1919a7; 2021-06-06 go1.16.5 linux/amd64
WRITE: 262144000 bytes (262 MB, 250 MiB) copied, 0,698174 s, 375 MB/s
READ: 262144000 bytes (262 MB, 250 MiB) copied, 0,268916 s, 975 MB/s
UNTAR: 8,970
MD5: 4,846
LS: 1,851
RM: 2,367
```
Changelog
---------
v2.0.1, 2021-06-07
* Fix symlink creation reporting the wrong size, causing git to report it as modified
([#574](https://github.com/rfjakob/gocryptfs/issues/574))
v2.0, 2021-06-05
* Fix a few [issues discovered by xfstests](https://github.com/rfjakob/fuse-xfstests/wiki/results_2021-05-19)
* Biggest change: rewrite SEEK_HOLE / SEEK_DATA logic (now emulates 4k alignment)
v2.0-beta4, 2021-05-15
* **Make ACLs *actually* work (pass `-acl` to enable)** ([#536](https://github.com/rfjakob/gocryptfs/issues/536))
* Blocklist `RENAME_EXCHANGE` and `RENAME_WHITEOUT` (broken as discovered by [fuse-xfstest/gocryptfs-2019-12](https://github.com/rfjakob/fuse-xfstests/tree/gocryptfs-2019-12))
v2.0-beta3, 2021-04-24
* MANPAGE: Split options into sections acc. to where they apply ([#517](https://github.com/rfjakob/gocryptfs/issues/517))
* `-idle`: count cwd inside the mount as busy ([#533](https://github.com/rfjakob/gocryptfs/issues/533))
* Make `gocryptfs.diriv` and `gocryptfs.xxx.name` files world-readable to make encrypted backups easier
when mounting via [/etc/fstab](Documentation/MANPAGE.md#fstab) ([#539](https://github.com/rfjakob/gocryptfs/issues/539))
* Make it work with MacFUSE v4.x ([#524](https://github.com/rfjakob/gocryptfs/issues/524))
* **Disable ACL encryption**, it causes a lot of problems ([#543](https://github.com/rfjakob/gocryptfs/issues/543),
[#536](https://github.com/rfjakob/gocryptfs/issues/536))
* Old encrypted ACLs are reported by `gocryptfs -fsck` but otherwise ignored
* This fixes inheritance, but does not yet enforce them correctly
* Include `gocryptfs-xray` in binary releases ([#496](https://github.com/rfjakob/gocryptfs/issues/496))
* go-fuse: track *most recent* parent. This improves robustness when the filesystem is modified behind
the back of gocryptfs. Helps both with `-sharedstorage` and also without.
([commit 1](https://github.com/hanwen/go-fuse/commit/c3186132bf8b7a04b5e5bc27489d88181f92e4e0),
[commit 2](https://github.com/hanwen/go-fuse/commit/a90e1f463c3f172a7690a6449fe5955a180dfec3),
[#549](https://github.com/rfjakob/gocryptfs/issues/549))
* Add directory fd caching for 2x - 3x speed boost in small file ops compared to v2.0-beta2
([performance numbers](https://github.com/rfjakob/gocryptfs/blob/5cb1e55714aa92a848c0fb5fc3fa7b91625210fe/Documentation/performance.txt#L73))
v2.0-beta2, 2020-11-14
* Improve [performance](Documentation/performance.txt#L69)
* Fix [GETATTR panic](https://github.com/rfjakob/gocryptfs/issues/519#issuecomment-718790790) in reverse mode
v2.0-beta1, 2020-10-15
* **Switch to the improved go-fuse [v2 API](https://pkg.go.dev/github.com/hanwen/go-fuse/v2@v2.0.3/fs)**
* This is a big change, a lot of code has been reorganized or rewritten
to fit the v2 API model.
* Please test & report bugs
* No changes to the on-disk format
* File descriptor caching is not yet implemented,
causing a slowdown. Caching will be implemented for v2.0 final.
* **Add support for FIDO2 tokens (`-fido2`, [#505](https://github.com/rfjakob/gocryptfs/pull/505))**
* Add `-encrypt-paths` / `-decrypt-paths` functionality to `gocryptfs-xray`
([#416](https://github.com/rfjakob/gocryptfs/issues/416))
* Accept multiple `-passfile`s
([#288](https://github.com/rfjakob/gocryptfs/issues/288))
* Make `-masterkey=stdin` work together with `-passwd`
([#461](https://github.com/rfjakob/gocryptfs/issues/461))
* Fix `Unknown opcode 2016` crash on Google Cloud
([go-fuse #276](https://github.com/hanwen/go-fuse/issues/276),
[gocryptfs commit ec74d1d](https://github.com/rfjakob/gocryptfs/commit/ec74d1d2f4217a9a337d1db9902f32ae2aecaf33))
v1.8.0, 2020-05-09
* Enable ACL support ([#453](https://github.com/rfjakob/gocryptfs/issues/453))
* **Warning 2021-02-07**: This feature is incomplete! Do not use ACLs before gocryptfs v2.0 final!
Reading and writing ACLs works, but they are not enforced or inherited ([#542](https://github.com/rfjakob/gocryptfs/issues/542))
* Ignore `.nfsXXX` temporary files
([#367](https://github.com/rfjakob/gocryptfs/issues/431))
* Handle inode number collisions from multiple devices
([#435](https://github.com/rfjakob/gocryptfs/issues/435))
* Drop `-nonempty` for fusermount3
([#440](https://github.com/rfjakob/gocryptfs/pull/440))
* Reverse mode: improve inode number mapping and max=1000000000000000000 limitation
([#457](https://github.com/rfjakob/gocryptfs/issues/457))
* Enable `--buildmode=pie` ([#460](https://github.com/rfjakob/gocryptfs/pull/460))
* Migrate from dep to Go Modules
([commit cad711993](https://github.com/rfjakob/gocryptfs/commit/cad711993d67dd920f9749a09414dbbba6ab8136))
* go mod: update dependencies
([commit b23f77c](https://github.com/rfjakob/gocryptfs/commit/b23f77c8ead0dbb5ed59dd50e94f13aacf7dbaf1))
* `gocryptfs -speed`: add XChaCha20-Poly1305-Go
([#452](https://github.com/rfjakob/gocryptfs/issues/452))
* Respect `GOMAXPROCS` environment variable
([commit ff210a06f](https://github.com/rfjakob/gocryptfs/commit/ff210a06fb3097eecd5668ddb3ace9c76873eb00)
* Completely remove Trezor-related code (commit 1364b44ae356da31e24e5605fe73a307e9d6fb03)
* Has been disabled since v1.7 due to issues a third-party module.
* Please use FIDO2 instead (gocryptfs v2.0)
v1.7.1, 2019-10-06
* Support wild cards in reverse mode via `--exclude-wildcard`
([#367](https://github.com/rfjakob/gocryptfs/pull/367)). Thanks @ekalin!
* Create `gocryptfs.diriv` files with 0440 permissions to make it easier to
share an encrypted folder via a network drive
([#387](https://github.com/rfjakob/gocryptfs/issues/387)).
Note: as a security precaution, the owner must still manually
`chmod gocryptfs.conf 0440` to allow mounting.
* Allow the `nofail` option in `/etc/fstab`
* `-passwd` can now change the `-scryptn` parameter for existing filesystems
([#400](https://github.com/rfjakob/gocryptfs/issues/400))
* Fix `-idle` unmounting the filesystem despite recent activity
([#421](https://github.com/rfjakob/gocryptfs/issues/421))
* **Fix a race condition related to inode number reuse
([#363](https://github.com/rfjakob/gocryptfs/issues/363))**.
It could be triggered by concurrently creating and deleting files and can lead to data loss
in the affected file. This bug was found by the automated tests on Travis
and was very hard to trigger locally.
* tests: use /var/tmp instead of /tmp by default
([commit 8c4429](https://github.com/rfjakob/gocryptfs/commit/8c4429408716d9890a98a48c246d616dbfea7e31))
v1.7, 2019-03-17
* **Fix possible symlink race attacks in forward mode** when using allow_other + plaintextnames
* If you use *both* `-allow_other` *and* `-plaintextnames`, you should upgrade.
Malicious users could trick gocryptfs into modifying files outside of `CIPHERDIR`,
or reading files inside `CIPHERDIR` that they should not have access to.
* If you do not use `-plaintextnames` (disabled per default), these attacks do
not work as symlinks are encrypted.
* Forward mode has been reworked to use the "\*at" family of system calls everywhere
(`Openat/Unlinkat/Symlinkat/...`).
* As a result, gocryptfs may run slightly slower, as the caching logic has been
replaced and is very simple at the moment.
* The possibility for such attacks was found during an internal code review.
* Reverse mode: fix excluded, unaccessible files showing up in directory listings
([#285](https://github.com/rfjakob/gocryptfs/issues/285),
[#286](https://github.com/rfjakob/gocryptfs/issues/286))
* gocryptfs-xray: add `-aessiv` flag for correctly parsing AES-SIV format files
([#299](https://github.com/rfjakob/gocryptfs/issues/299))
* Ensure that standard fds 0,1,2 are always initialized
([#320](https://github.com/rfjakob/gocryptfs/issues/320)).
Prevents trouble in the unlikely case that gocryptfs is called with
stdin,stdout and/or stderr closed.
* `-extpass` now can be specified multiple times to support arguments containing spaces
([#289](https://github.com/rfjakob/gocryptfs/issues/289))
* Drop Fstatat, Mkdirat, Syslinkat, Fchownat, Unlinkat, Renameat, Openat emulation of MacOS
and instead use native functions (thanks @slackner !)
* Use `Setreuid` to robustly set the owner with allow_other (@slackner,
([commit](https://github.com/rfjakob/gocryptfs/commit/03b9d65cce53fb95b7d489ecd03d0853b9b923fb)))
* Pack the rendered man page into the source code archive for user convenience
([issue 355](https://github.com/rfjakob/gocryptfs/issues/355))
* Disable Trezor support again (commit 16fac26c57ba303bf60266d24c17f5243e5ea376)
* Trezor support has been broken since Sept 2018 due to issues
in a third-party module ([#261](https://github.com/rfjakob/gocryptfs/issues/261))
v1.6.1, 2018-12-12
* Fix "Operation not supported" chmod errors on Go 1.11
([#271](https://github.com/rfjakob/gocryptfs/issues/271))
v1.6, 2018-08-18
* **Add `-e` / `-exclude` option** for reverse mode
([#235](https://github.com/rfjakob/gocryptfs/issues/235),
[commit](https://github.com/rfjakob/gocryptfs/commit/ec2fdc19cf9358ae7ba09c528a5807b6b0760f9b))
* Add support for the Trezor One HSM [PR#247](https://github.com/rfjakob/gocryptfs/pull/247), thanks @xaionaro!
* Use `./build.bash -tags enable_trezor` to compile with Trezor support
* Then, use `gocryptfs -init -trezor` to create a filesystem locked with a physical Trezor device.
* Note 2021-01-31: Support was removed again in gocryptfs v1.7. Please use `-fido2` in gocryptfs v2.0.
* Only print master key once, on init
([#76](https://github.com/rfjakob/gocryptfs/issues/76),
[commit](https://github.com/rfjakob/gocryptfs/commit/6d64dfe8f7acd8e9ca4a659d26318e442c2db85a))
* Fall back to buffered IO even when passed `O_DIRECT`
([commit](https://github.com/rfjakob/gocryptfs/commit/893e41149ed353f355047003b89eeff456990e76))
v1.5, 2018-06-12
* **Support extended attributes (xattr)** in forward mode
([#217](https://github.com/rfjakob/gocryptfs/issues/217)). Older gocryptfs versions
will ignore the extended attributes.
* **Add `-fsck` function**
([#191](https://github.com/rfjakob/gocryptfs/issues/191))
* Fix clobbered timestamps on MacOS High Sierra
([#229](https://github.com/rfjakob/gocryptfs/issues/229))
* Add `-masterkey=stdin` functionality
([#218](https://github.com/rfjakob/gocryptfs/issues/218))
* Accept `-dev`/`-nodev`, `suid`/`nosuid`, `-exec`/`-noexec`,
`-ro`/`-rw` flags to make mounting via `/etc/fstab` possible.
Thanks @mahkoh! ([#233](https://github.com/rfjakob/gocryptfs/pull/233),
[commit](https://github.com/rfjakob/gocryptfs/commit/53d6a9999dd0e4c31636d16179f284fff35a35d9),
[commit](https://github.com/rfjakob/gocryptfs/commit/10212d791a3196c2c8705a7a3cccdeb14a8efdbe))
* Fix a `logger` path issue on SuSE
[#225](https://github.com/rfjakob/gocryptfs/issues/225)
* Stop printing the help text on a "flag provided but not defined"
error ([commit](https://github.com/rfjakob/gocryptfs/commit/5ad26495fc86527bbfe75ac6b46528d49a373676))
v1.4.4, 2018-03-18
* Overwrite secrets in memory with zeros as soon as possible
([#211](https://github.com/rfjakob/gocryptfs/issues/211))
* Fix Getdents problems on i386 and mips64le
([#197](https://github.com/rfjakob/gocryptfs/issues/197),
[#200](https://github.com/rfjakob/gocryptfs/issues/200))
* Make building with gccgo work
([#201](https://github.com/rfjakob/gocryptfs/issues/201))
* MacOS: fix `osxfuse: vnode changed generation` / `Error code -36` issue in go-fuse
([#213](https://github.com/rfjakob/gocryptfs/issues/213),
[commit](https://github.com/hanwen/go-fuse/commit/a9ddcb8a4b609500fc59c89ccc9ee05f00a5fefd))
* Fix various test issues on MacOS
v1.4.3, 2018-01-21
* **Fix several symlink race attacks** in connection with reverse mode
and allow_other. Thanks to @slackner for reporting and helping to fix
the issues:
* Fix symlink races in reverse mode
([issue #165](https://github.com/rfjakob/gocryptfs/issues/165))
* Fix symlink races in connection with `-allow_other`
([issue #177](https://github.com/rfjakob/gocryptfs/issues/177))
* Fix problems with special names when using `-plaintextnames`
([issue #174](https://github.com/rfjakob/gocryptfs/issues/174))
* Add `-devrandom` command-line option
([commit](https://github.com/rfjakob/gocryptfs/commit/f3c777d5eaa682d878c638192311e52f9c204294))
* Add `-sharedstorage` command-line option
([commit](https://github.com/rfjakob/gocryptfs/commit/e36a0ebf189a826aaa63909c5518c16356f5f903),
[issue #156](https://github.com/rfjakob/gocryptfs/issues/156))
* MacOS: let OSXFuse create the mountpoint if it does not exist
([issue #194](https://github.com/rfjakob/gocryptfs/issues/194))
v1.4.2, 2017-11-01
* Add `Gopkg.toml` file for `dep` vendoring and reproducible builds
([issue #142](https://github.com/rfjakob/gocryptfs/issues/142))
* MacOS: deal with `.DS_Store` files inside CIPHERDIR
([issue #140](https://github.com/rfjakob/gocryptfs/issues/140))
* Reverse mode: fix ENOENT error affecting names exactly 176 bytes long
([issue #143](https://github.com/rfjakob/gocryptfs/issues/143))
* Support kernels compiled with > 128 kiB FUSE request size (Synology NAS)
([issue #145](https://github.com/rfjakob/gocryptfs/issues/145),
[commit](https://github.com/rfjakob/gocryptfs/commit/4954c87979efaf5b8184efccc7d9a38c21e4209b))
* Fix a startup hang when `$PATH` contains the mountpoint
([issue #146](https://github.com/rfjakob/gocryptfs/issues/146))
v1.4.1, 2017-08-21
* **Use memory pools for buffer handling** (
[3c6fe98](https://github.com/rfjakob/gocryptfs/commit/3c6fe98),
[b2a23e9](https://github.com/rfjakob/gocryptfs/commit/b2a23e9),
[12c0101](https://github.com/rfjakob/gocryptfs/commit/12c0101))
* On my machine, this **doubles** the streaming read speed
(see [performance.txt](https://github.com/rfjakob/gocryptfs/blob/v1.4.1/Documentation/performance.txt#L38))
* Implement and use the getdents(2) syscall for a more efficient
OpenDir implementation
([e50a6a5](https://github.com/rfjakob/gocryptfs/commit/e50a6a5))
* Purge masterkey from memory as soon as possible
([issue #137](https://github.com/rfjakob/gocryptfs/issues/137))
* Reverse mode: fix inode number collision between .name and .diriv
files
([d12aa57](https://github.com/rfjakob/gocryptfs/commit/d12aa57))
* Prevent the logger from holding stdout open
([issue #130](https://github.com/rfjakob/gocryptfs/issues/130))
* MacOS: make testing without openssl work properly
([ccf1a84](https://github.com/rfjakob/gocryptfs/commit/ccf1a84))
* MacOS: specify a volume name
([9f8e19b](https://github.com/rfjakob/gocryptfs/commit/9f8e19b))
* Enable writing to write-only files