mirror of
https://github.com/systemd/systemd.git
synced 2025-01-20 18:04:03 +03:00
parent
77064620d7
commit
a5b2973850
@ -97,16 +97,19 @@ int action_setup_keys(void) {
|
|||||||
state_size = FSPRG_stateinbytes(FSPRG_RECOMMENDED_SECPAR);
|
state_size = FSPRG_stateinbytes(FSPRG_RECOMMENDED_SECPAR);
|
||||||
state = alloca_safe(state_size);
|
state = alloca_safe(state_size);
|
||||||
|
|
||||||
|
if (!arg_quiet)
|
||||||
log_info("Generating seed...");
|
log_info("Generating seed...");
|
||||||
r = crypto_random_bytes(seed, seed_size);
|
r = crypto_random_bytes(seed, seed_size);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to acquire random seed: %m");
|
return log_error_errno(r, "Failed to acquire random seed: %m");
|
||||||
|
|
||||||
|
if (!arg_quiet)
|
||||||
log_info("Generating key pair...");
|
log_info("Generating key pair...");
|
||||||
r = FSPRG_GenMK(NULL, mpk, seed, seed_size, FSPRG_RECOMMENDED_SECPAR);
|
r = FSPRG_GenMK(NULL, mpk, seed, seed_size, FSPRG_RECOMMENDED_SECPAR);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to generate key pair: %m");
|
return log_error_errno(r, "Failed to generate key pair: %m");
|
||||||
|
|
||||||
|
if (!arg_quiet)
|
||||||
log_info("Generating sealing key...");
|
log_info("Generating sealing key...");
|
||||||
r = FSPRG_GenState0(state, mpk, seed, seed_size);
|
r = FSPRG_GenState0(state, mpk, seed, seed_size);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
@ -122,7 +125,7 @@ int action_setup_keys(void) {
|
|||||||
|
|
||||||
r = chattr_secret(fd, CHATTR_WARN_UNSUPPORTED_FLAGS);
|
r = chattr_secret(fd, CHATTR_WARN_UNSUPPORTED_FLAGS);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING,
|
log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) || arg_quiet ? LOG_DEBUG : LOG_WARNING,
|
||||||
r, "Failed to set file attributes on a temporary file for '%s', ignoring: %m", path);
|
r, "Failed to set file attributes on a temporary file for '%s', ignoring: %m", path);
|
||||||
|
|
||||||
struct FSSHeader h = {
|
struct FSSHeader h = {
|
||||||
@ -155,7 +158,7 @@ int action_setup_keys(void) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (!on_tty()) {
|
if (!on_tty() || arg_quiet) {
|
||||||
/* If we are not on a TTY, show only the key. */
|
/* If we are not on a TTY, show only the key. */
|
||||||
puts(key);
|
puts(key);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -10,8 +10,10 @@ if ! journalctl --version | grep -qF +GCRYPT; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
journalctl --force --setup-keys --interval=2 |& tee /tmp/fss
|
# without --quiet, should be effectively equivalent to the below, as we are not on tty
|
||||||
FSS_VKEY="$(sed -rn '/([a-f0-9]{6}\-){3}[a-f0-9]{6}\/[a-f0-9]+\-[a-f0-9]+/p' /tmp/fss)"
|
journalctl --force --setup-keys --interval=2
|
||||||
|
|
||||||
|
FSS_VKEY=$(journalctl --force --setup-keys --interval=2 --quiet)
|
||||||
[[ -n "$FSS_VKEY" ]]
|
[[ -n "$FSS_VKEY" ]]
|
||||||
|
|
||||||
# Generate some buzz in the journal and wait until the FSS key is changed
|
# Generate some buzz in the journal and wait until the FSS key is changed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user