summaryrefslogtreecommitdiff
path: root/cli_args.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-09 20:08:10 +0200
committerJakob Unterwurzacher2016-10-09 20:08:10 +0200
commite1c5e71b0965b6d17e0902b60adadc67e01190fe (patch)
treea9d2d15b5378e4869358bce7b86ebeda1794ea53 /cli_args.go
parent03c8b133710c190364858de09b2f24c5fa891d88 (diff)
main: add "-passfile" option
Make it easier to read the password from a file. Internally this is equivalent to "-extpass /bin/cat FILE".
Diffstat (limited to 'cli_args.go')
-rw-r--r--cli_args.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/cli_args.go b/cli_args.go
index 4f16cd4..2d5ad7e 100644
--- a/cli_args.go
+++ b/cli_args.go
@@ -17,7 +17,7 @@ type argContainer struct {
plaintextnames, quiet, nosyslog, wpanic,
longnames, allow_other, ro, reverse, aessiv, nonempty bool
masterkey, mountpoint, cipherdir, cpuprofile, extpass,
- memprofile, ko string
+ memprofile, ko, passfile string
// Configuration file name override
config string
notifypid, scryptn int
@@ -86,6 +86,7 @@ func parseCliOpts() (args argContainer) {
flagSet.StringVar(&args.memprofile, "memprofile", "", "Write memory profile to specified file")
flagSet.StringVar(&args.config, "config", "", "Use specified config file instead of CIPHERDIR/gocryptfs.conf")
flagSet.StringVar(&args.extpass, "extpass", "", "Use external program for the password prompt")
+ flagSet.StringVar(&args.passfile, "passfile", "", "Read password from file")
flagSet.StringVar(&args.ko, "ko", "", "Pass additional options directly to the kernel, comma-separated list")
flagSet.IntVar(&args.notifypid, "notifypid", 0, "Send USR1 to the specified process after "+
"successful mount - used internally for daemonization")
@@ -110,6 +111,9 @@ func parseCliOpts() (args argContainer) {
os.Exit(ErrExitUsage)
}
}
-
+ // "-passfile FILE" is a shortcut for "-extpass=/bin/cat FILE"
+ if args.passfile != "" {
+ args.extpass = "/bin/cat " + args.passfile
+ }
return args
}