feat: v0.2.0, add harden support

This commit is contained in:
2022-07-27 23:31:25 +08:00
parent 7af1521354
commit 77591990ad
3 changed files with 27 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
use clap::{App, AppSettings, ArgMatches};
use rust_util::{failure_and_exit, information};
use rust_util::{failure_and_exit, information, success, warning};
use rust_util::util_clap::{Command, CommandError};
mod db;
@@ -20,6 +20,16 @@ impl DefaultCommandImpl {
}
fn main() {
let ignore_harden_process_error = std::env::var("IGNORE_HARDEN_PROCESS_ERROR")
.map(|v| &v == "true").unwrap_or_else(|_| false);
match secmem_proc::harden_process() {
Err(e) => if ignore_harden_process_error {
warning!("Harden local-mini-kms failed: {}", e);
} else {
failure_and_exit!("Harden local-mini-kms failed: {}", e);
}
Ok(_) => success!("Harden local-mini-kms success"),
}
if let Err(e) = inner_main() {
failure_and_exit!("Run local-mini-kms error: {}", e);
}