passphrase

This commit is contained in:
Marc Beninca 2024-11-12 09:28:08 +01:00
parent 671beb4b0e
commit fe5c75b142
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
3 changed files with 26 additions and 8 deletions

View file

@ -9,8 +9,7 @@ rescue_wipe_0_init_hetzner_8_8() {
local passphrase
local unit='mib'
# read passphrase
echo -n 'PassPhrase: '
read -r -s passphrase
passphrase="$(read_passphrase)"
#
lsblk
echo -n 'WIPE' "${devices[@]}" '/?\ OR CANCEL /!\'
@ -149,6 +148,8 @@ rescue_wipe_0_init_hetzner_8_8() {
# open
echo "${passphrase}" |
cryptsetup luksOpen '/dev/md/crypt' 'crypt'
# passphrase
unset passphrase
}
rescue_wipe_2_make_hetzner_8_8() {
@ -156,8 +157,7 @@ rescue_wipe_2_make_hetzner_8_8() {
# close
cryptsetup luksClose 'crypt'
# read passphrase
echo -n 'PassPhrase: '
read -r -s passphrase
passphrase="$(read_passphrase)"
# encrypt
echo "${passphrase}" |
cryptsetup \
@ -175,6 +175,8 @@ rescue_wipe_2_make_hetzner_8_8() {
# open
echo "${passphrase}" |
cryptsetup luksOpen '/dev/md/crypt' 'crypt'
# passphrase
unset passphrase
# format crypt
mkfs.btrfs --force \
--checksum 'sha256' \

View file

@ -3,8 +3,7 @@ rescue_wipe_0_init_ovh_vle2() {
local passphrase
local unit="mib"
# read passphrase
printf "PassPhrase: "
read -r -s passphrase
passphrase="$(read_passphrase)"
# warn
lsblk
printf "%s" "WIPE ${device} /?\\ OR CANCEL /!\\"
@ -78,6 +77,8 @@ rescue_wipe_0_init_ovh_vle2() {
# crypt / open
echo "${passphrase}" |
cryptsetup luksOpen "${device}1" "crypt"
# passphrase
unset passphrase
}
rescue_wipe_2_make_ovh_vle2() {
@ -86,8 +87,7 @@ rescue_wipe_2_make_ovh_vle2() {
# crypt / close
cryptsetup luksClose "crypt"
# read passphrase
printf "PassPhrase: "
read -r -s passphrase
passphrase="$(read_passphrase)"
# crypt / encrypt
echo "${passphrase}" |
cryptsetup \
@ -105,6 +105,8 @@ rescue_wipe_2_make_ovh_vle2() {
# crypt / open
echo "${passphrase}" |
cryptsetup luksOpen "${device}1" "crypt"
# passphrase
unset passphrase
# crypt / format
mkfs.btrfs --force \
--checksum "sha256" \

View file

@ -5,3 +5,17 @@ not() {
*) ;;
esac
}
read_passphrase() {
read_secret "PassPhrase: "
}
read_secret() {
local prompt="${1}"
local secret
printf "${prompt}" 1>&2
read -r -s secret
echo >&2
echo "${secret}"
unset secret
}