Mount v0.6 and older filesystems as read-only
This is part of the phase-out of very old filesystems. See https://github.com/rfjakob/gocryptfs/wiki/Compatibility for more info.
This commit is contained in:
parent
3234b9b5ce
commit
cc2a75b050
@ -118,10 +118,12 @@ func LoadConfFile(filename string, password string) ([]byte, *ConfFile, error) {
|
|||||||
if deprecatedFs {
|
if deprecatedFs {
|
||||||
fmt.Printf("\033[33m" + `
|
fmt.Printf("\033[33m" + `
|
||||||
This filesystem was created by gocryptfs v0.6 or earlier. You are missing
|
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
|
security improvements. Mounting read-only, please upgrade!
|
||||||
filesystem, please upgrade!
|
Instructions: https://github.com/rfjakob/gocryptfs/wiki/Upgrading
|
||||||
If you disagree with the plan or have trouble upgrading, please join the
|
|
||||||
discussion at https://github.com/rfjakob/gocryptfs/issues/29 .
|
gocryptfs v1.0 is scheduled to drop support for this filesystem completely.
|
||||||
|
If you disagree with the plan or have trouble upgrading, please join
|
||||||
|
the discussion at https://github.com/rfjakob/gocryptfs/issues/29 .
|
||||||
|
|
||||||
` + "\033[0m")
|
` + "\033[0m")
|
||||||
}
|
}
|
||||||
@ -143,8 +145,16 @@ func LoadConfFile(filename string, password string) ([]byte, *ConfFile, error) {
|
|||||||
return nil, nil, fmt.Errorf("Password incorrect.")
|
return nil, nil, fmt.Errorf("Password incorrect.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return key, &cf, nil
|
if deprecatedFs {
|
||||||
|
err = DeprecatedFsError{}
|
||||||
}
|
}
|
||||||
|
return key, &cf, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// The filesystem is deprecated.
|
||||||
|
type DeprecatedFsError struct{}
|
||||||
|
|
||||||
|
func (e DeprecatedFsError) Error() string { return "deprecated filesystem" }
|
||||||
|
|
||||||
// EncryptKey - encrypt "key" using an scrypt hash generated from "password"
|
// EncryptKey - encrypt "key" using an scrypt hash generated from "password"
|
||||||
// and store it in cf.EncryptedKey.
|
// and store it in cf.EncryptedKey.
|
||||||
|
7
main.go
7
main.go
@ -122,8 +122,11 @@ func loadConfig(args *argContainer) (masterkey []byte, confFile *configfile.Conf
|
|||||||
pw := readpassword.Once(args.extpass)
|
pw := readpassword.Once(args.extpass)
|
||||||
tlog.Info.Println("Decrypting master key")
|
tlog.Info.Println("Decrypting master key")
|
||||||
masterkey, confFile, err = configfile.LoadConfFile(args.config, pw)
|
masterkey, confFile, err = configfile.LoadConfFile(args.config, pw)
|
||||||
if err != nil {
|
if _, ok := err.(configfile.DeprecatedFsError); ok {
|
||||||
tlog.Fatal.Println(err.Error())
|
// Force read-only mode
|
||||||
|
args.ro = true
|
||||||
|
} else if err != nil {
|
||||||
|
tlog.Fatal.Println(err)
|
||||||
os.Exit(ERREXIT_LOADCONF)
|
os.Exit(ERREXIT_LOADCONF)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user