aboutsummaryrefslogtreecommitdiff
path: root/internal/configfile/config_file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-06-06 23:13:10 +0200
committerJakob Unterwurzacher2016-06-06 23:13:10 +0200
commit0f4d3501369e13c8ba6ee4c9fc7df02a3cc698b1 (patch)
treee0009f099fcf9783b5bc6544d7a4ce6a289f14a5 /internal/configfile/config_file.go
parentcc5d5a3fcdabca0ecd86646091c545509351dbbe (diff)
configfile: warn about missing feature flags
The plan is to drop support for the oldest filesystem versions in gocryptfs v1.0. For now, we only warn the user.
Diffstat (limited to 'internal/configfile/config_file.go')
-rw-r--r--internal/configfile/config_file.go32
1 files changed, 30 insertions, 2 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index 006f6fe..ea023d0 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -92,12 +92,40 @@ func LoadConfFile(filename string, password string) ([]byte, *ConfFile, error) {
return nil, nil, fmt.Errorf("Unsupported on-disk format %d", cf.Version)
}
+ // Check that all set feature flags are known
for _, flag := range cf.FeatureFlags {
- if cf.isFeatureFlagKnown(flag) == false {
- return nil, nil, fmt.Errorf("Unsupported feature flag %s", flag)
+ if !cf.isFeatureFlagKnown(flag) {
+ return nil, nil, fmt.Errorf("Unsupported feature flag %q", flag)
}
}
+ // Check that all required feature flags are set
+ var requiredFlags []flagIota
+ if cf.IsFeatureFlagSet(FlagPlaintextNames) {
+ requiredFlags = requiredFlagsPlaintextNames
+ } else {
+ requiredFlags = requiredFlagsNormal
+ }
+ deprecatedFs := false
+ for _, i := range requiredFlags {
+ if !cf.IsFeatureFlagSet(i) {
+ // For now, warn but continue.
+ fmt.Printf("Deprecated filesystem: feature flag %q is missing\n", knownFlags[i])
+ deprecatedFs = true
+ //return nil, nil, fmt.Errorf("Required feature flag %q is missing", knownFlags[i])
+ }
+ }
+ if deprecatedFs {
+ fmt.Printf("\033[33m" + `
+ This filesystem was created by gocryptfs v0.6 or earlier. You are missing
+ security improvements. gocryptfs v1.0 is scheduled to drop support for this
+ filesystem, please upgrade!
+ If you disagree with the plan or have trouble upgrading, please join the
+ discussion at https://github.com/rfjakob/gocryptfs/issues/29 .
+
+` + "\033[0m")
+ }
+
// Generate derived key from password
scryptHash := cf.ScryptObject.DeriveKey(password)