mirror of
https://github.com/linuxboot/heads.git
synced 2025-04-15 06:56:39 +00:00
Add more input validation
Based on tlaurion's work done here
ff148e4daf/initrd/bin/factory-reset-libremkey.sh (L53)
This commit is contained in:
parent
f0f6e80e95
commit
a16b97b6ea
@ -89,6 +89,7 @@ gpg_key_reset()
|
||||
whiptail_error_die "GPG Key automatic keygen failed!\n\n$ERROR"
|
||||
fi
|
||||
}
|
||||
|
||||
gpg_key_change_pin()
|
||||
{
|
||||
# 1 = user PIN, 3 = admin PIN
|
||||
@ -271,15 +272,33 @@ echo
|
||||
if [ "$prompt_output" == "y" \
|
||||
-o "$prompt_output" == "Y" ] \
|
||||
; then
|
||||
echo -e "\nPlease enter the following information...\n"
|
||||
echo
|
||||
echo -e -n "Real name: "
|
||||
read GPG_USER_NAME
|
||||
echo -e -n "Email address: "
|
||||
read GPG_USER_MAIL
|
||||
echo -e -n "Comment: "
|
||||
read GPG_USER_COMMENT
|
||||
echo
|
||||
echo -e "\n\n"
|
||||
echo -e "We will generate a GnuPG (PGP) keypair identifiable with the following text form:"
|
||||
echo -e "Real Name (Comment) email@address.org"
|
||||
|
||||
echo -e "\nEnter your Real Name (At least 5 characters long):"
|
||||
read -r GPG_USER_NAME
|
||||
while [[ ${#GPG_USER_NAME} -lt 5 ]]; do
|
||||
{
|
||||
echo -e "\nEnter your Real Name (At least 5 characters long):"
|
||||
read -r GPG_USER_NAME
|
||||
};done
|
||||
|
||||
echo -e "\nEnter your email@adress.org:"
|
||||
read -r GPG_USER_MAIL
|
||||
while ! $(expr "$GPG_USER_MAIL" : '.*@' >/dev/null); do
|
||||
{
|
||||
echo -e "\nEnter your email@address.org:"
|
||||
read -r GPG_USER_MAIL
|
||||
};done
|
||||
|
||||
echo -e "\nEnter Comment (Optional, to distinguish this key from others with same previous attributes. Must be smaller then 60 characters):"
|
||||
read -r GPG_USER_MAIL
|
||||
while [[ ${#gpgcard_comment} -gt 60 ]]; do
|
||||
{
|
||||
echo -e "\nEnter Comment (Optional, to distinguish this key from others with same previous attributes. Must be smaller then 60 characters):"
|
||||
read -r GPG_USER_MAIL
|
||||
};done
|
||||
fi
|
||||
|
||||
## sanity check the USB, GPG key, and boot device before proceeding further
|
||||
|
Loading…
x
Reference in New Issue
Block a user