= Features = - passmenu now takes --type as its first argument, which will type the password instead of copying it to the clipboard. = Bug Fixes = - OSX now properly unmounts temporary mounts and ejects ramdisks. - All BSDs now have cleaner temporary files. - Temporary files for pass edit now end in .txt so vim does the right Thing. - When edit fails, prompt for retrying instead of going into crazy loop. - Keepassx2pass conversion script now handles empty strings. Approved by: swills (mentor)
303 lines
13 KiB
Diff
303 lines
13 KiB
Diff
diff --git a/README b/README
|
|
index 1cc01b9..10f841d 100644
|
|
--- a/README
|
|
+++ b/README
|
|
@@ -19,8 +19,6 @@ Depends on:
|
|
http://www.gnupg.org/
|
|
- git
|
|
http://www.git-scm.com/
|
|
-- xclip
|
|
- http://sourceforge.net/projects/xclip/
|
|
- pwgen
|
|
http://sourceforge.net/projects/pwgen/
|
|
- tree >= 1.7.0
|
|
diff --git a/man/pass.1 b/man/pass.1
|
|
index 8ac8ecf..9301122 100644
|
|
--- a/man/pass.1
|
|
+++ b/man/pass.1
|
|
@@ -86,12 +86,8 @@ List names of passwords inside the tree that match \fIpass-names\fP by using the
|
|
.BR tree (1)
|
|
program. This command is alternatively named \fBsearch\fP.
|
|
.TP
|
|
-\fBshow\fP [ \fI--clip\fP, \fI-c\fP ] \fIpass-name\fP
|
|
-Decrypt and print a password named \fIpass-name\fP. If \fI--clip\fP or \fI-c\fP
|
|
-is specified, do not print the password but instead copy the first line to the
|
|
-clipboard using
|
|
-.BR xclip (1)
|
|
-and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds.
|
|
+\fBshow\fP \fIpass-name\fP
|
|
+Decrypt and print a password named \fIpass-name\fP.
|
|
.TP
|
|
\fBinsert\fP [ \fI--echo\fP, \fI-e\fP | \fI--multiline\fP, \fI-m\fP ] [ \fI--force\fP, \fI-f\fP ] \fIpass-name\fP
|
|
Insert a new password into the password store called \fIpass-name\fP. This will
|
|
@@ -110,15 +106,11 @@ ensure that temporary files are created in \fI/dev/shm\fP in order to avoid writ
|
|
difficult-to-erase disk sectors. If \fI/dev/shm\fP is not accessible, fallback to
|
|
the ordinary \fITMPDIR\fP location, and print a warning.
|
|
.TP
|
|
-\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\fP ] [ \fI--clip\fP, \fI-c\fP ] [ \fI--in-place\fP, \fI-i\fP | \fI--force\fP, \fI-f\fP ] \fIpass-name pass-length\fP
|
|
+\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\fP ] [ \fI--in-place\fP, \fI-i\fP | \fI--force\fP, \fI-f\fP ] \fIpass-name pass-length\fP
|
|
Generate a new password using
|
|
.BR pwgen (1)
|
|
of length \fIpass-length\fP and insert into \fIpass-name\fP. If \fI--no-symbols\fP or \fI-n\fP
|
|
is specified, do not use any non-alphanumeric characters in the generated password.
|
|
-If \fI--clip\fP or \fI-c\fP is specified, do not print the password but instead copy
|
|
-it to the clipboard using
|
|
-.BR xclip (1)
|
|
-and then restore the clipboard after 45 (or \fIPASSWORD_STORE_CLIP_TIME\fP) seconds.
|
|
Prompt before overwriting an existing password,
|
|
unless \fI--force\fP or \fI-f\fP is specified. If \fI--in-place\fP or \fI-i\fP is
|
|
specified, do not interactively prompt, and only replace the first line of the password
|
|
@@ -223,11 +215,6 @@ Show existing password
|
|
.br
|
|
sup3rh4x3rizmynam3
|
|
.TP
|
|
-Copy existing password to clipboard
|
|
-.B zx2c4@laptop ~ $ pass -c Email/zx2c4.com
|
|
-.br
|
|
-Copied Email/jason@zx2c4.com to clipboard. Will clear in 45 seconds.
|
|
-.TP
|
|
Add password to store
|
|
.B zx2c4@laptop ~ $ pass insert Business/cheese-whiz-factory
|
|
.br
|
|
@@ -266,10 +253,8 @@ The generated password to Email/jasondonenfeld.com is:
|
|
.br
|
|
YqFsMkBeO6di
|
|
.TP
|
|
-Generate new password and copy it to the clipboard
|
|
-.B zx2c4@laptop ~ $ pass generate -c Email/jasondonenfeld.com 19
|
|
-.br
|
|
-Copied Email/jasondonenfeld.com to clipboard. Will clear in 45 seconds.
|
|
+Generate new password
|
|
+.B zx2c4@laptop ~ $ pass generate Email/jasondonenfeld.com 19
|
|
.TP
|
|
Remove password from store
|
|
.B zx2c4@laptop ~ $ pass remove Business/cheese-whiz-factory
|
|
@@ -399,15 +384,6 @@ Overrides the default root of the git repository, which is helpful if
|
|
\fIPASSWORD_STORE_DIR\fP is temporarily set to a sub-directory of the default
|
|
password store.
|
|
.TP
|
|
-.I PASSWORD_STORE_X_SELECTION
|
|
-Overrides the selection passed to \fBxclip\fP, by default \fIclipboard\fP. See
|
|
-.BR xclip (1)
|
|
-for more info.
|
|
-.TP
|
|
-.I PASSWORD_STORE_CLIP_TIME
|
|
-Specifies the number of seconds to wait before restoring the clipboard, by default
|
|
-\fI45\fP seconds.
|
|
-.TP
|
|
.I PASSWORD_STORE_UMASK
|
|
Sets the umask of all files modified by pass, by default \fI077\fP.
|
|
.TP
|
|
@@ -417,7 +393,6 @@ The location of the text editor used by \fBedit\fP.
|
|
.BR gpg2 (1),
|
|
.BR pwgen (1),
|
|
.BR git (1),
|
|
-.BR xclip (1).
|
|
|
|
.SH AUTHOR
|
|
.B pass
|
|
diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion
|
|
index ea31fbf..86860cb 100644
|
|
--- a/src/completion/pass.bash-completion
|
|
+++ b/src/completion/pass.bash-completion
|
|
@@ -78,7 +78,6 @@ _pass()
|
|
_pass_complete_entries
|
|
;;
|
|
show|-*)
|
|
- COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))
|
|
_pass_complete_entries 1
|
|
;;
|
|
insert)
|
|
@@ -86,7 +85,7 @@ _pass()
|
|
_pass_complete_entries
|
|
;;
|
|
generate)
|
|
- COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force -i --in-place" -- ${cur}))
|
|
+ COMPREPLY+=($(compgen -W "-n --no-symbols -f --force -i --in-place" -- ${cur}))
|
|
_pass_complete_entries
|
|
;;
|
|
cp|copy|mv|rename)
|
|
diff --git a/src/completion/pass.fish-completion b/src/completion/pass.fish-completion
|
|
index c32a42c..abcff4d 100644
|
|
--- a/src/completion/pass.fish-completion
|
|
+++ b/src/completion/pass.fish-completion
|
|
@@ -75,7 +75,6 @@ complete -c $PROG -f -A -n '__fish_pass_uses_command insert' -a "(__fish_pass_pr
|
|
|
|
complete -c $PROG -f -A -n '__fish_pass_needs_command' -a generate -d 'Command: generate new password'
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command generate' -s n -l no-symbols -d 'Do not use special symbols'
|
|
-complete -c $PROG -f -A -n '__fish_pass_uses_command generate' -s c -l clip -d 'Put the password in clipboard'
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command generate' -s f -l force -d 'Do not prompt before overwritting'
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command generate' -s i -l in-place -d 'Replace only the first line with the generated password'
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command generate' -a "(__fish_pass_print_entry_dirs)"
|
|
@@ -97,13 +96,10 @@ complete -c $PROG -f -A -n '__fish_pass_needs_command' -a edit -d 'Command: edit
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command edit' -a "(__fish_pass_print_entries)"
|
|
|
|
complete -c $PROG -f -A -n '__fish_pass_needs_command' -a show -d 'Command: show existing password'
|
|
-complete -c $PROG -f -A -n '__fish_pass_uses_command show' -s c -l clip -d 'Put password in clipboard'
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command show' -a "(__fish_pass_print_entries)"
|
|
# When no command is given, `show` is defaulted.
|
|
-complete -c $PROG -f -A -n '__fish_pass_needs_command' -s c -l clip -d 'Put password in clipboard'
|
|
complete -c $PROG -f -A -n '__fish_pass_needs_command' -a "(__fish_pass_print_entries)"
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command -c' -a "(__fish_pass_print_entries)"
|
|
-complete -c $PROG -f -A -n '__fish_pass_uses_command --clip' -a "(__fish_pass_print_entries)"
|
|
|
|
complete -c $PROG -f -A -n '__fish_pass_needs_command' -a git -d 'Command: execute a git command'
|
|
complete -c $PROG -f -A -n '__fish_pass_uses_command git' -a 'init' -d 'Initialize git repository'
|
|
diff --git a/src/completion/pass.zsh-completion b/src/completion/pass.zsh-completion
|
|
index b658398..0ab3e43 100644
|
|
--- a/src/completion/pass.zsh-completion
|
|
+++ b/src/completion/pass.zsh-completion
|
|
@@ -41,8 +41,6 @@ _pass () {
|
|
_arguments : \
|
|
"-n[don't include symbols in password]" \
|
|
"--no-symbols[don't include symbols in password]" \
|
|
- "-c[copy password to the clipboard]" \
|
|
- "--clip[copy password to the clipboard]" \
|
|
"-f[force overwrite]" \
|
|
"--force[force overwrite]" \
|
|
"-i[replace first line]" \
|
|
@@ -106,9 +104,6 @@ _pass () {
|
|
}
|
|
|
|
_pass_cmd_show () {
|
|
- _arguments : \
|
|
- "-c[put it on the clipboard]" \
|
|
- "--clip[put it on the clipboard]"
|
|
_pass_complete_entries
|
|
}
|
|
_pass_complete_entries_helper () {
|
|
diff --git a/src/password-store.sh b/src/password-store.sh
|
|
index cfc25cc..06ddeb2 100755
|
|
--- a/src/password-store.sh
|
|
+++ b/src/password-store.sh
|
|
@@ -12,8 +12,6 @@ which gpg2 &>/dev/null && GPG="gpg2"
|
|
[[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" "--use-agent" )
|
|
|
|
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
|
-X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}"
|
|
-CLIP_TIME="${PASSWORD_STORE_CLIP_TIME:-45}"
|
|
|
|
export GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
|
|
export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
|
|
@@ -135,33 +133,6 @@ check_sneaky_paths() {
|
|
# BEGIN platform definable
|
|
#
|
|
|
|
-clip() {
|
|
- # This base64 business is because bash cannot store binary data in a shell
|
|
- # variable. Specifically, it cannot store nulls nor (non-trivally) store
|
|
- # trailing new lines.
|
|
-
|
|
- local sleep_argv0="password store sleep on display $DISPLAY"
|
|
- pkill -f "^$sleep_argv0" 2>/dev/null && sleep 0.5
|
|
- local before="$(xclip -o -selection "$X_SELECTION" | base64)"
|
|
- echo -n "$1" | xclip -selection "$X_SELECTION"
|
|
- (
|
|
- ( exec -a "$sleep_argv0" sleep "$CLIP_TIME" )
|
|
- local now="$(xclip -o -selection "$X_SELECTION" | base64)"
|
|
- [[ $now != $(echo -n "$1" | base64) ]] && before="$now"
|
|
-
|
|
- # It might be nice to programatically check to see if klipper exists,
|
|
- # as well as checking for other common clipboard managers. But for now,
|
|
- # this works fine -- if qdbus isn't there or if klipper isn't running,
|
|
- # this essentially becomes a no-op.
|
|
- #
|
|
- # Clipboard managers frequently write their history out in plaintext,
|
|
- # so we axe it here:
|
|
- qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory &>/dev/null
|
|
-
|
|
- echo "$before" | base64 -d | xclip -selection "$X_SELECTION"
|
|
- ) 2>/dev/null & disown
|
|
- echo "Copied $2 to clipboard. Will clear in $CLIP_TIME seconds."
|
|
-}
|
|
tmpdir() {
|
|
[[ -n $SECURE_TMPDIR ]] && return
|
|
local warn=1
|
|
@@ -232,9 +203,8 @@ cmd_usage() {
|
|
List passwords.
|
|
$PROGRAM find pass-names...
|
|
List passwords that match pass-names.
|
|
- $PROGRAM [show] [--clip,-c] pass-name
|
|
- Show existing password and optionally put it on the clipboard.
|
|
- If put on the clipboard, it will be cleared in $CLIP_TIME seconds.
|
|
+ $PROGRAM [show] pass-name
|
|
+ Show existing password.
|
|
$PROGRAM grep search-string
|
|
Search for password files containing search-string when decrypted.
|
|
$PROGRAM insert [--echo,-e | --multiline,-m] [--force,-f] pass-name
|
|
@@ -243,9 +213,8 @@ cmd_usage() {
|
|
overwriting existing password unless forced.
|
|
$PROGRAM edit pass-name
|
|
Insert a new password or edit an existing password using ${EDITOR:-vi}.
|
|
- $PROGRAM generate [--no-symbols,-n] [--clip,-c] [--in-place,-i | --force,-f] pass-name pass-length
|
|
+ $PROGRAM generate [--no-symbols,-n] [--in-place,-i | --force,-f] pass-name pass-length
|
|
Generate a new password of pass-length with optionally no symbols.
|
|
- Optionally put it on the clipboard and clear board after 45 seconds.
|
|
Prompt before overwriting existing password unless forced.
|
|
Optionally replace only the first line of an existing file with a new password.
|
|
$PROGRAM rm [--recursive,-r] [--force,-f] pass-name
|
|
@@ -304,28 +273,11 @@ cmd_init() {
|
|
}
|
|
|
|
cmd_show() {
|
|
- local opts clip=0
|
|
- opts="$($GETOPT -o c -l clip -n "$PROGRAM" -- "$@")"
|
|
- local err=$?
|
|
- eval set -- "$opts"
|
|
- while true; do case $1 in
|
|
- -c|--clip) clip=1; shift ;;
|
|
- --) shift; break ;;
|
|
- esac done
|
|
-
|
|
- [[ $err -ne 0 ]] && die "Usage: $PROGRAM $COMMAND [--clip,-c] [pass-name]"
|
|
-
|
|
local path="$1"
|
|
local passfile="$PREFIX/$path.gpg"
|
|
check_sneaky_paths "$path"
|
|
if [[ -f $passfile ]]; then
|
|
- if [[ $clip -eq 0 ]]; then
|
|
exec $GPG -d "${GPG_OPTS[@]}" "$passfile"
|
|
- else
|
|
- local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n 1)"
|
|
- [[ -n $pass ]] || exit 1
|
|
- clip "$pass" "$path"
|
|
- fi
|
|
elif [[ -d $PREFIX/$path ]]; then
|
|
if [[ -z $path ]]; then
|
|
echo "Password Store"
|
|
@@ -438,19 +390,18 @@ cmd_edit() {
|
|
}
|
|
|
|
cmd_generate() {
|
|
- local opts clip=0 force=0 symbols="-y" inplace=0
|
|
- opts="$($GETOPT -o ncif -l no-symbols,clip,in-place,force -n "$PROGRAM" -- "$@")"
|
|
+ local opts force=0 symbols="-y" inplace=0
|
|
+ opts="$($GETOPT -o nif -l no-symbols,in-place,force -n "$PROGRAM" -- "$@")"
|
|
local err=$?
|
|
eval set -- "$opts"
|
|
while true; do case $1 in
|
|
-n|--no-symbols) symbols=""; shift ;;
|
|
- -c|--clip) clip=1; shift ;;
|
|
-f|--force) force=1; shift ;;
|
|
-i|--in-place) inplace=1; shift ;;
|
|
--) shift; break ;;
|
|
esac done
|
|
|
|
- [[ $err -ne 0 || $# -ne 2 || ( $force -eq 1 && $inplace -eq 1 ) ]] && die "Usage: $PROGRAM $COMMAND [--no-symbols,-n] [--clip,-c] [--in-place,-i | --force,-f] pass-name pass-length"
|
|
+ [[ $err -ne 0 || $# -ne 2 || ( $force -eq 1 && $inplace -eq 1 ) ]] && die "Usage: $PROGRAM $COMMAND [--no-symbols,-n] [--in-place,-i | --force,-f] pass-name pass-length"
|
|
local path="$1"
|
|
local length="$2"
|
|
check_sneaky_paths "$path"
|
|
@@ -478,11 +429,7 @@ cmd_generate() {
|
|
[[ $inplace -eq 1 ]] && verb="Replace"
|
|
git_add_file "$passfile" "$verb generated password for ${path}."
|
|
|
|
- if [[ $clip -eq 0 ]]; then
|
|
- printf "\e[1m\e[37mThe generated password for \e[4m%s\e[24m is:\e[0m\n\e[1m\e[93m%s\e[0m\n" "$path" "$pass"
|
|
- else
|
|
- clip "$pass" "$path"
|
|
- fi
|
|
+ printf "\e[1m\e[37mThe generated password for \e[4m%s\e[24m is:\e[0m\n\e[1m\e[93m%s\e[0m\n" "$path" "$pass"
|
|
}
|
|
|
|
cmd_delete() {
|