password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

commit 3b16d1d3fbd221724378475085a1170997d732b5
parent ec5eeec7445fe3d662ddd8e1df573931b9bb312c
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Sun, 30 Sep 2012 18:26:48 +0200

Explicitly use gpg2 rather than relying on symlink.

Diffstat:
Mcontrib/pass.bash-completion | 2+-
Mcontrib/pass.fish-completion | 2+-
Mcontrib/pass.zsh-completion | 2+-
Mman/pass.1 | 4++--
Msrc/password-store.sh | 19+++++++++----------
Msrc/platform/darwin.sh | 1-
Msrc/platform/freebsd.sh | 1-
7 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion @@ -40,7 +40,7 @@ _pass_complete_entries () { _pass_complete_keys () { local IFS=$'\n' # Extract names and email addresses from gpg --list-keys - local keys="$(gpg --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')" + local keys="$(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')" COMPREPLY+=($(compgen -W "${keys}" -- ${cur})) } diff --git a/contrib/pass.fish-completion b/contrib/pass.fish-completion @@ -31,7 +31,7 @@ function __fish_pass_uses_command end function __fish_pass_print_gpg_keys - gpg --list-keys | grep uid | sed 's/.*<\(.*\)>/\1/' + gpg2 --list-keys | grep uid | sed 's/.*<\(.*\)>/\1/' end function __fish_pass_print_entry_dirs set -l prefix (__fish_pass_get_prefix) diff --git a/contrib/pass.zsh-completion b/contrib/pass.zsh-completion @@ -112,5 +112,5 @@ _pass_complete_entries () { _pass_complete_keys () { local IFS=$'\n' # Extract names and email addresses from gpg --list-keys - _values 'gpg keys' $(gpg --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d') + _values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d') } diff --git a/man/pass.1 b/man/pass.1 @@ -17,7 +17,7 @@ pass - stores, retrieves, generates, and synchronizes passwords securely .B pass is a very simple password store that keeps passwords inside -.BR gpg (1) +.BR gpg2 (1) encrypted files inside a simple directory tree residing at .IR ~/.password-store . The @@ -342,7 +342,7 @@ password store. The location of the text editor used by \fBedit\fP. .SH SEE ALSO -.BR gpg (1), +.BR gpg22 (1), .BR pwgen (1), .BR git (1), .BR xclip (1). diff --git a/src/password-store.sh b/src/password-store.sh @@ -119,7 +119,6 @@ tmpdir() { fi } -GPG="gpg" GETOPT="getopt" # source /path/to/platform-defined-functions @@ -160,7 +159,7 @@ case "$command" in if [[ $reencrypt -eq 1 ]]; then find "$PREFIX" -iname '*.gpg' | while read passfile; do - $GPG -d $GPG_OPTS "$passfile" | $GPG -e -r "$gpg_id" -o "$passfile.new" $GPG_OPTS && + gpg2 -d $GPG_OPTS "$passfile" | gpg2 -e -r "$gpg_id" -o "$passfile.new" $GPG_OPTS && mv -v "$passfile.new" "$passfile" done git_add_file "$PREFIX" "Reencrypted entire store using new GPG id $gpg_id." @@ -222,9 +221,9 @@ case "$command" in exit 1 fi if [[ $clip -eq 0 ]]; then - exec $GPG -d $GPG_OPTS "$passfile" + exec gpg2 -d $GPG_OPTS "$passfile" else - clip "$($GPG -d $GPG_OPTS "$passfile" | head -n 1)" "$path" + clip "$(gpg2 -d $GPG_OPTS "$passfile" | head -n 1)" "$path" fi fi ;; @@ -257,7 +256,7 @@ case "$command" in if [[ $multiline -eq 1 ]]; then echo "Enter contents of $path and press Ctrl+D when finished:" echo - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS elif [[ $noecho -eq 1 ]]; then while true; do read -p "Enter password for $path: " -s password @@ -265,7 +264,7 @@ case "$command" in read -p "Retype password for $path: " -s password_again echo if [[ $password == $password_again ]]; then - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" break else echo "Error: the entered passwords do not match." @@ -273,7 +272,7 @@ case "$command" in done else read -p "Enter password for $path: " -e password - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password" fi git_add_file "$passfile" "Added given password for $path to store." ;; @@ -295,11 +294,11 @@ case "$command" in action="Added" if [[ -f $passfile ]]; then - $GPG -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1 + gpg2 -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1 action="Edited" fi ${EDITOR:-vi} "$tmp_file" - while ! $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do + while ! gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do echo "GPG encryption failed. Retrying." sleep 1 done @@ -337,7 +336,7 @@ case "$command" in pass="$(pwgen -s $symbols $length 1)" [[ -n $pass ]] || exit 1 - $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass" + gpg2 -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass" git_add_file "$passfile" "Added generated password for $path to store." if [[ $clip -eq 0 ]]; then diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh @@ -31,5 +31,4 @@ tmpdir() { mount -t hfs -o noatime -o nobrowse "$ramdisk_dev" "$tmp_dir" || exit 1 } -GPG="gpg2" GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || echo /usr/local)/bin/getopt" diff --git a/src/platform/freebsd.sh b/src/platform/freebsd.sh @@ -15,5 +15,4 @@ tmpdir() { fi } -GPG="gpg2" GETOPT="/usr/local/bin/getopt"