From: Christian Heller Date: Tue, 7 May 2019 12:08:04 +0000 (+0200) Subject: Better passphrase management. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/static/git-logo.png?a=commitdiff_plain;h=ec85942c7dda73e25ce2f0541a3f06818017a2e0;p=config Better passphrase management. --- diff --git a/all_new_2018/borg.sh b/all_new_2018/borg.sh index 2c276bf..1be74bb 100755 --- a/all_new_2018/borg.sh +++ b/all_new_2018/borg.sh @@ -19,12 +19,14 @@ read_pw() { eval $(ssh-agent) echo "ssh-add" ssh-add - stty -echo - printf "Borg passphrase: " - read password - stty echo - printf "\n" - export BORG_PASSPHRASE="${password}" + if [ "${#BORG_PASSPHRASE}" -eq 0 ]; then + stty -echo + printf "Borg passphrase: " + read password + stty echo + printf "\n" + export BORG_PASSPHRASE="${password}" + fi } if [ ! -f "${config_file}" ]; then diff --git a/buster/setup_scripts/setup_eeepc.sh b/buster/setup_scripts/setup_eeepc.sh index 9e394eb..a7add59 100755 --- a/buster/setup_scripts/setup_eeepc.sh +++ b/buster/setup_scripts/setup_eeepc.sh @@ -53,16 +53,20 @@ adduser --disabled-password --gecos "" plom usermod -a -G sudo plom passwd plom if [ "${HOME_DIR_EXISTS}" -eq 0 ]; then + echo "Put secrets drive into slot for /dev/${secrets_dev}." while [ ! -e /dev/"${secrets_dev}" ]; do - echo "Put secrets drive into slot for /dev/${secrets_dev}, then hit Return." - read ignore + sleep 1 done - pmount /dev/"${secrets_dev}" + stty -echo + printf "Secrets passphrase: " + read secrets_pass + stty echo + echo "${secrets_pass}" | pmount /dev/"${secrets_dev}" cp -a "${source_dir_secrets}" "${target_dir_secrets}" chown -R plom:plom "${target_dir_secrets}" pumount "${secrets_dev}" echo "You can remove /dev/${secrets_dev} now." cp setup_home_eeepc.sh /home/plom chown plom:plom /home/plom/setup_home_eeepc.sh - su -c "cd && ./setup_home_eeepc.sh" plom + SECRETS_PASS="${secrets_pass}" su -c "cd && ./setup_home_eeepc.sh" plom fi diff --git a/buster/setup_scripts/setup_home_eeepc.sh b/buster/setup_scripts/setup_home_eeepc.sh index 83f585f..7678bf3 100755 --- a/buster/setup_scripts/setup_home_eeepc.sh +++ b/buster/setup_scripts/setup_home_eeepc.sh @@ -53,7 +53,7 @@ cat "${borgrepos_file}" | while read line; do fi ssh-keyscan "${line}" >> "${ssh_dir}"/known_hosts done -"${path_borgscript}" orgpull +BORG_PASSPHRASE="${SECRETS_PASS}" "${path_borgscript}" orgpull # Fill ~/public_repos. cat "${repos_list_file}" | while read line; do