diff options
| author | tslil clingman <> | 2019-04-09 22:16:57 -0400 |
|---|---|---|
| committer | tslil clingman <> | 2019-04-09 22:16:57 -0400 |
| commit | 1e32cf0116d816dc64f744ed8812aa5a2a850f1e (patch) | |
| tree | 9ab4805e52054a601c2bd2bc6c901072f4add22c | |
| parent | d3c79596d15feb7d3c435636535fa6911df0f96e (diff) | |
tweaks + "docs"
| -rwxr-xr-x | badpass | 19 | ||||
| -rwxr-xr-x | unlock_keys | 1 |
2 files changed, 10 insertions, 10 deletions
@@ -1,9 +1,13 @@ #!/bin/sh -# Requires expect +# A bad password derivation scheme, hopefully portable. +# Requires `expect' to enable `keychain' key unlocking. +# Read source for detail. -PREFIX="THIS IS TOTALLY SUPER SECRET" -PHRASE="THIS IS TOTALLY SUPER SECRET" +PREFIX="Prepended to every password, usually special chars + uppercase" +MIDFIX="A not-necessarily-secret string to prevent pre-baked rainbow tables" + +echo -n "Master password: " # Supress echo, and trap exit for correct restoration stty -echo @@ -16,10 +20,7 @@ read -r MASTER # Restore state stty echo trap - EXIT - -USEECHO () { - echo $1 $2 -} +echo USEKEYCHAIN () { expect - <<EOF @@ -30,13 +31,13 @@ expect { EOF } -CALL=USEECHO +CALL=echo if [ "$1" = "-k" ]; then CALL=USEKEYCHAIN shift fi; for NAME in "$@"; do - PREPASS=$(echo $NAME$PHRASE$MASTER | sha256sum | cut -b -24) + PREPASS=$(echo $NAME$MIDFIX$MASTER | sha256sum | cut -b -24) $CALL $NAME $PREFIX$PREPASS done diff --git a/unlock_keys b/unlock_keys index a88674f..a6bc45f 100755 --- a/unlock_keys +++ b/unlock_keys @@ -3,6 +3,5 @@ eval $(keychain --eval -q --systemd) KEY_FILES=$(ls $HOME/.ssh | grep -v '\(pub$\|^config$\|^known_hosts$\|^autohrized_keys$\)') -echo -n "Master password: " badpass -k $KEY_FILES echo Done! |
