diff --git a/zkey/zkey-cryptsetup.1 b/zkey/zkey-cryptsetup.1 index fd1741aa..c82ff006 100644 --- a/zkey/zkey-cryptsetup.1 +++ b/zkey/zkey-cryptsetup.1 @@ -102,6 +102,7 @@ behave in the same way as with \fBcryptsetup\fP. .IR bytes ] .RB [ \-\-tries | \-T .IR number ] +.RB [ \-\-batch\-mode | \-q ] .RB [ \-\-verbose | \-V ] .RB [ \-\-debug | \-D ] .PP @@ -261,6 +262,7 @@ behave in the same way as with \fBcryptsetup\fP. .IR bytes ] .RB [ \-\-tries | \-T .IR number ] +.RB [ \-\-batch\-mode | \-q ] .RB [ \-\-verbose | \-V ] .RB [ \-\-debug | \-D ] .PP @@ -347,6 +349,9 @@ has been set (made active). When completing the staged re-enciphering, the (unbound) key slot containing the re-enciphered secure volume key becomes the active key slot and, optionally, all key slots containing the old secure volume key are removed. +.TP +.BR \-q ", " \-\-batch\-mode +Suppresses all confirmation questions. Use with care! . . . @@ -355,6 +360,9 @@ volume key are removed. .BR \-m ", " \-\-master\-key\-file\~\fIfile\-name\fP Specifies the name of a file containing the secure AES key that is set as the new volume key. +.TP +.BR \-q ", " \-\-batch\-mode +Suppresses all confirmation questions. Use with care! . . . diff --git a/zkey/zkey-cryptsetup.c b/zkey/zkey-cryptsetup.c index 24e2452c..8180b4a3 100644 --- a/zkey/zkey-cryptsetup.c +++ b/zkey/zkey-cryptsetup.c @@ -98,6 +98,7 @@ static struct zkey_cryptsetup_globals { bool inplace; bool staged; char *master_key_file; + bool batch_mode; bool debug; bool verbose; void *lib_csulcca; @@ -181,6 +182,11 @@ static struct util_opt opt_vec[] = { .command = COMMAND_REENCIPHER, }, OPT_PASSPHRASE_ENTRY(COMMAND_REENCIPHER), + { + .option = {"batch-mode", 0, NULL, 'q'}, + .desc = "Suppresses all confirmation questions. Use with care!", + .command = COMMAND_REENCIPHER, + }, /***********************************************************/ { .flags = UTIL_OPT_FLAG_SECTION, @@ -209,6 +215,11 @@ static struct util_opt opt_vec[] = { .command = COMMAND_SETKEY, }, OPT_PASSPHRASE_ENTRY(COMMAND_SETKEY), + { + .option = {"batch-mode", 0, NULL, 'q'}, + .desc = "Suppresses all confirmation questions. Use with care!", + .command = COMMAND_SETKEY, + }, /***********************************************************/ { .flags = UTIL_OPT_FLAG_SECTION, @@ -1173,6 +1184,12 @@ static bool prompt_for_yes(void) { char str[20]; + if (g.batch_mode) { + printf("(yes implied because '--batch-mode' | '-q' option is " + "specified)\n"); + return true; + } + if (fgets(str, sizeof(str), stdin) == NULL) return false; @@ -2236,6 +2253,9 @@ int main(int argc, char *argv[]) case 'm': g.master_key_file = optarg; break; + case 'q': + g.batch_mode = true; + break; case 'D': g.debug = true; g.verbose = true;