Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions bails/.local/bin/persistent-setup
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ prompt_passphrase() {
'SETPROMPT Passphrase:' \
'SETREPEAT Confirm passphrase:' \
'SETREPEATERROR Passphrases do not match.' \
'GETPIN' | pinentry-gnome3
'GETPIN' | pinentry-gnome3 --timeout 0
)" || return 1

passphrase="$(sed -n 's/^D //p' <<< "$response")"
Expand All @@ -64,21 +64,9 @@ pgrep -f spaced-repetition || if /usr/local/lib/tpscli is-unlocked; then
if [ -z "$existing_passphrase" ]; then
zenity --error --title="Error" --text="Existing Persistent Storage passphrase is required. Please provide the passphrase." "$ICON"
else
# Estimate passphrase entropy to see if we can proceed
entropy=$(keepassxc-cli estimate "${existing_passphrase// /}" | cut -f2 | tr -C -d '[:digit:]')
if ((entropy >= 65000)); then
break
elif ((entropy > 50000)); then
zenity --question --icon-name=dialog-warning --title='Warning: Weak Passphrase Detected' \
--text="<b>Your passphrase is too weak to protect against a state-sponsored attacker with physical access to your USB stick.</b>\n\nTails recommends choosing a long passphrase made of 5 to 7 random words.\n<a href='https://theintercept.com/2015/03/26/passphrases-can-memorize-attackers-cant-guess/'>Learn about the maths behind memorizable and secure passphrases</a>.\n\nIf a state-sponsored attacker with physical access to your device is part of your <a href='https://ssd.eff.org/module/your-security-plan'>threat model</a>, you MUST restart, delete this Persistent Storage and use a recommended passphrase.\n\nFor more information, please read the Tails security advisory on passphrase security: <a href='https://tails.net/security/argon2id/#understanding'>Understanding weak passphrases</a>\n\nBe sure to save your work before clicking 'Restart Now'." "$ICON" --ok-label='Continue' --default-cancel --cancel-label='Restart Now' && break
else
zenity --warning --title='WARNING: Weak Passphrase Detected' \
--text="<b>Your passphrase is too weak to protect against attackers with physical access to your USB stick.</b>\n\nTails recommends choosing a long passphrase made of 5 to 7 random words.\n<a href='https://theintercept.com/2015/03/26/passphrases-can-memorize-attackers-cant-guess/'>Learn about the maths behind memorizable and secure passphrases</a>.\n\nYou MUST restart, delete this Persistent Storage and use a recommended passphrase.\n\nFor more information, please read the Tails security advisory on passphrase security: <a href='https://tails.net/security/argon2id/#understanding'>Understanding weak passphrases</a>\n\nBe sure to save your work before clicking 'Restart Now'." "$ICON" --ok-label='Restart Now'
fi
systemctl reboot
break
fi
done
unset entropy
[ -f $SET_UP ] || if ((passwd_unset)); then
# Change user account password to Persistent Storage passphrase for spaced repetition practice.
printf '%s\n%s' "$existing_passphrase" "$existing_passphrase" | passwd || echo "FAILURE to change passphrase"
Expand Down
Loading