From 3409ade2723d931097560fbbe35e461553c5912c Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 24 Apr 2017 00:25:02 +0200 Subject: forcedecode: tighten checks ...and fix a few golint issues and print a scary warning message on mount. Also, force the fs to ro,noexec. --- cli_args.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cli_args.go') diff --git a/cli_args.go b/cli_args.go index f0bfb48..e42d9ae 100644 --- a/cli_args.go +++ b/cli_args.go @@ -171,11 +171,17 @@ func parseCliOpts() (args argContainer) { tlog.Fatal.Printf("The reverse mode and the -forcedecode option are not compatible") os.Exit(ErrExitUsage) } - v, e := strconv.ParseBool(opensslAuto) - if e == nil && v == false { - tlog.Warn.Printf("-openssl set to true, as it is required by -forcedecode flag") + // Has the user explicitely disabled openssl using "-openssl=false/0"? + if !args.openssl && opensslAuto != "auto" { + tlog.Fatal.Printf("-forcedecode requires openssl, but is disabled via command-line option") + os.Exit(ErrExitUsage) } args.openssl = true + + // Try to make it harder for the user to shoot himself in the foot. + args.ro = true + args.allow_other = false + args.ko = "noexec" } // '-passfile FILE' is a shortcut for -extpass='/bin/cat -- FILE' if args.passfile != "" { -- cgit v1.2.3