mirror of
https://github.com/linuxboot/heads.git
synced 2025-01-29 15:44:07 +00:00
supress errors on console when files don't exist (equivalent of rm -f)
This commit is contained in:
parent
0722d42d65
commit
14c76d062c
@ -38,7 +38,7 @@ for tries in 1 2 3; do
|
||||
-hk 40000000 \
|
||||
; then
|
||||
# should be okay if this fails
|
||||
shred -n 10 -z -u /tmp/secret/sealed || true
|
||||
shred -n 10 -z -u /tmp/secret/sealed 2> /dev/null || true
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -28,9 +28,9 @@ tpm unsealfile \
|
||||
-of "$HOTP_SECRET" \
|
||||
|| die "Unable to unseal HOTP secret"
|
||||
|
||||
shred -n 10 -z -u "$HOTP_SEALED"
|
||||
shred -n 10 -z -u "$HOTP_SEALED" 2> /dev/null
|
||||
secret="`cat $HOTP_SECRET`"
|
||||
shred -n 10 -z -u "$HOTP_SECRET"
|
||||
shred -n 10 -z -u "$HOTP_SECRET" 2> /dev/null
|
||||
|
||||
# Store counter in file instead of TPM for now, as it conflicts with Heads
|
||||
# config TPM counter as TPM 1.2 can only increment one counter between reboots
|
||||
|
@ -43,7 +43,7 @@ if ! tpm sealfile2 \
|
||||
-ix 4 0000000000000000000000000000000000000000 \
|
||||
-ix 7 X \
|
||||
; then
|
||||
shred -n 10 -z -u "$TOTP_SECRET"
|
||||
shred -n 10 -z -u "$TOTP_SECRET" 2> /dev/null
|
||||
die "Unable to seal secret"
|
||||
fi
|
||||
|
||||
@ -79,7 +79,7 @@ if ! tpm nv_writevalue \
|
||||
|| die "Unable to write sealed secret to NVRAM"
|
||||
fi
|
||||
|
||||
shred -n 10 -z -u "$TOTP_SEALED"
|
||||
shred -n 10 -z -u "$TOTP_SEALED" 2> /dev/null
|
||||
|
||||
url="otpauth://totp/$HOST?secret=$secret"
|
||||
secret=""
|
||||
|
@ -28,7 +28,7 @@ tpm unsealfile \
|
||||
-of "$HOTP_SECRET" \
|
||||
|| die "Unable to unseal HOTP secret"
|
||||
|
||||
shred -n 10 -z -u "$HOTP_SEALED"
|
||||
shred -n 10 -z -u "$HOTP_SEALED" 2> /dev/null
|
||||
|
||||
# Store counter in file instead of TPM for now, as it conflicts with Heads
|
||||
# config TPM counter as TPM 1.2 can only increment one counter between reboots
|
||||
@ -51,11 +51,11 @@ fi
|
||||
#counter_value=$(printf "%d" 0x${counter_value})
|
||||
|
||||
if ! hotp $counter_value < "$HOTP_SECRET"; then
|
||||
shred -n 10 -z -u "$HOTP_SECRET"
|
||||
shred -n 10 -z -u "$HOTP_SECRET" 2> /dev/null
|
||||
die 'Unable to compute HOTP hash?'
|
||||
fi
|
||||
|
||||
shred -n 10 -z -u "$HOTP_SECRET"
|
||||
shred -n 10 -z -u "$HOTP_SECRET" 2> /dev/null
|
||||
|
||||
#increment_tpm_counter $counter > /dev/null \
|
||||
#|| die "Unable to increment tpm counter"
|
||||
|
@ -18,12 +18,12 @@ tpm unsealfile \
|
||||
-of "$TOTP_SECRET" \
|
||||
|| die "Unable to unseal totp secret"
|
||||
|
||||
shred -n 10 -z -u "$TOTP_SEALED"
|
||||
shred -n 10 -z -u "$TOTP_SEALED" 2> /dev/null
|
||||
|
||||
if ! totp -q < "$TOTP_SECRET"; then
|
||||
shred -n 10 -z -u "$TOTP_SECRET"
|
||||
shred -n 10 -z -u "$TOTP_SECRET" 2> /dev/null
|
||||
die 'Unable to compute TOTP hash?'
|
||||
fi
|
||||
|
||||
shred -n 10 -z -u "$TOTP_SECRET"
|
||||
shred -n 10 -z -u "$TOTP_SECRET" 2> /dev/null
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user