mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-02 01:20:54 +00:00
- Update to 1.4
- Patches updated PR: ports/171905 Submitted by: milki <milki@rescomp.berkeley.edu> (maintainer)
This commit is contained in:
parent
e85851d3bf
commit
e9b9700f2c
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=304778
@ -1,7 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= password-store
|
||||
PORTVERSION= 1.3.1
|
||||
PORTVERSION= 1.4
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= http://git.zx2c4.com/password-store/snapshot/
|
||||
EXTRACT_SUFX= .tar.xz
|
||||
@ -17,7 +17,7 @@ RUN_DEPENDS= gnupg>=2:${PORTSDIR}/security/gnupg \
|
||||
|
||||
OPTIONS_DEFINE= GIT XCLIP
|
||||
|
||||
GIT_DESC= Enable git backend
|
||||
GIT_DESC= Enable git storage
|
||||
XCLIP_DESC= Enable xclip feature
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
@ -52,6 +52,7 @@ do-install:
|
||||
@${MKDIR} ${DATADIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/contrib/pass.bash-completion ${DATADIR}/
|
||||
${INSTALL_DATA} ${WRKSRC}/contrib/pass.zsh-completion ${DATADIR}/
|
||||
${INSTALL_DATA} ${WRKSRC}/contrib/pass.fish-completion ${DATADIR}/
|
||||
${INSTALL_DATA} ${WRKSRC}/man/pass.1 ${MANPREFIX}/man/man1/pass.1
|
||||
|
||||
MAN1= pass.1
|
||||
@ -60,7 +61,8 @@ MANCOMPRESSED= no
|
||||
PLIST_FILES= bin/pass \
|
||||
libexec/pass \
|
||||
share/password-store/pass.bash-completion \
|
||||
share/password-store/pass.zsh-completion
|
||||
share/password-store/pass.zsh-completion \
|
||||
share/password-store/pass.fish-completion
|
||||
PLIST_DIRS= share/password-store
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (password-store-1.3.1.tar.xz) = 351c0e2eb3315ca317026e73f7654a6351f2674000d9476b18c1525cbc5d732d
|
||||
SIZE (password-store-1.3.1.tar.xz) = 14864
|
||||
SHA256 (password-store-1.4.tar.xz) = 2e94b0078abdf4673f3c22bde048776a3c12776b1bc98c22e8fb6e684b0b4a9e
|
||||
SIZE (password-store-1.4.tar.xz) = 17968
|
||||
|
@ -1,73 +1,162 @@
|
||||
diff --git a/README b/README
|
||||
index 52e23af..f24107f 100644
|
||||
index 47ed64b..6ebfd68 100644
|
||||
--- README
|
||||
+++ README
|
||||
@@ -14,8 +14,6 @@ Please see the man page for documentation and examples.
|
||||
|
||||
Depends on:
|
||||
- gpg2
|
||||
@@ -17,10 +17,6 @@ Depends on:
|
||||
http://www.gnu.org/software/bash/
|
||||
- GnuPG2
|
||||
http://www.gnupg.org/
|
||||
-- git
|
||||
- http://www.git-scm.com/
|
||||
-- xclip
|
||||
- http://sourceforge.net/projects/xclip/
|
||||
- pwgen
|
||||
http://sourceforge.net/projects/pwgen/
|
||||
- tree
|
||||
- GNU getopt
|
||||
diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion
|
||||
index ccffbfa..b9f86e4 100644
|
||||
--- contrib/pass.bash-completion
|
||||
+++ contrib/pass.bash-completion
|
||||
@@ -48,7 +48,7 @@ _pass()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
- local commands="init ls show insert generate edit rm git help version"
|
||||
+ local commands="init ls show insert generate edit rm help version"
|
||||
if [[ $COMP_CWORD -gt 1 ]]; then
|
||||
case "${COMP_WORDS[1]}" in
|
||||
init)
|
||||
@@ -59,7 +59,6 @@ _pass()
|
||||
_pass_complete_entries
|
||||
;;
|
||||
show|-*)
|
||||
- COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))
|
||||
_pass_complete_entries 1
|
||||
;;
|
||||
insert)
|
||||
@@ -67,16 +66,13 @@ _pass()
|
||||
_pass_complete_entries
|
||||
;;
|
||||
generate)
|
||||
- COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force" -- ${cur}))
|
||||
+ COMPREPLY+=($(compgen -W "-n --no-symbols -f --force" -- ${cur}))
|
||||
_pass_complete_entries
|
||||
;;
|
||||
rm|remove|delete)
|
||||
COMPREPLY+=($(compgen -W "-r --recursive -f --force" -- ${cur}))
|
||||
_pass_complete_entries
|
||||
;;
|
||||
- git)
|
||||
- COMPREPLY+=($(compgen -W "init push pull config log reflog" -- ${cur}))
|
||||
- ;;
|
||||
esac
|
||||
else
|
||||
COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
|
||||
diff --git a/contrib/pass.fish-completion b/contrib/pass.fish-completion
|
||||
index 7652d56..7d470b8 100644
|
||||
--- contrib/pass.fish-completion
|
||||
+++ contrib/pass.fish-completion
|
||||
@@ -76,7 +76,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' -a "(__fish_pass_print_entry_dirs)"
|
||||
|
||||
@@ -89,16 +88,7 @@ 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'
|
||||
-complete -c $PROG -f -A -n '__fish_pass_uses_command git' -a 'push' -d 'Push changes to remote repo'
|
||||
-complete -c $PROG -f -A -n '__fish_pass_uses_command git' -a 'pull' -d 'Pull changes from remote repo'
|
||||
-complete -c $PROG -f -A -n '__fish_pass_uses_command git' -a 'log' -d 'View changelog'
|
||||
diff --git a/contrib/pass.zsh-completion b/contrib/pass.zsh-completion
|
||||
index 5cf8808..f589b5e 100644
|
||||
index c6fe678..4783a60 100644
|
||||
--- contrib/pass.zsh-completion
|
||||
+++ contrib/pass.zsh-completion
|
||||
@@ -27,9 +27,6 @@ _pass () {
|
||||
"generate[Generate a new password using pwgen]" \
|
||||
"edit[Edit a password with \$EDITOR]" \
|
||||
"rm[Remove the password]" \
|
||||
- "push[push the latest changes using git-push(1)]" \
|
||||
- "pull[pull the latest changes using git-pull(1)]" \
|
||||
- "git[Call git]" \
|
||||
"help[Help]"
|
||||
_pass_cmd_show
|
||||
fi
|
||||
@@ -45,7 +42,6 @@ _pass_cmd_ls () {
|
||||
@@ -39,8 +39,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]"
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
rm)
|
||||
@@ -51,18 +49,6 @@ _pass () {
|
||||
"--recursive[recursively delete]"
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
- git)
|
||||
- local -a subcommands
|
||||
- subcommands=(
|
||||
- "init:Initialize git repository"
|
||||
- "push:Push to remote repository"
|
||||
- "pull:Pull from remote repository"
|
||||
- "config:Show git config"
|
||||
- "log:Show git log"
|
||||
- "reflog:Show git reflog"
|
||||
- )
|
||||
- _describe -t commands 'pass git' subcommands
|
||||
- ;;
|
||||
show|*)
|
||||
_pass_cmd_show
|
||||
;;
|
||||
@@ -77,7 +63,6 @@ _pass () {
|
||||
"generate:Generate a new password using pwgen"
|
||||
"edit:Edit a password with \$EDITOR"
|
||||
"rm:Remove the password"
|
||||
- "git:Call git on the password store"
|
||||
"version:Output version information"
|
||||
"help:Output help message"
|
||||
)
|
||||
@@ -90,15 +75,12 @@ _pass () {
|
||||
}
|
||||
|
||||
_pass_cmd_show () {
|
||||
_arguments : \
|
||||
- "-c[put it on the clipboard]" \
|
||||
'*::show:_get_stored_pwd'
|
||||
#'::pass id:_files -W ~/.password-store -g "*.gpg(|.*)(-.)"'
|
||||
- _arguments : \
|
||||
- "-c[put it on the clipboard]" \
|
||||
- "--clip[put it on the clipboard]"
|
||||
_pass_complete_entries
|
||||
}
|
||||
@@ -65,7 +61,6 @@ _pass_cmd_insert () {
|
||||
_pass_cmd_generate () {
|
||||
_arguments : \
|
||||
"-n[no symbols]" \
|
||||
- "-c[put password on the clipboard]" \
|
||||
'::show:_get_stored_pwd'
|
||||
_pass_complete_entries_helper () {
|
||||
local IFS=$'\n'
|
||||
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
- _values -C 'passwords' $(find "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
|
||||
+ _values -C 'passwords' $(find "$prefix" -name .gpg-id -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
|
||||
}
|
||||
|
||||
@@ -75,6 +70,6 @@ _pass_cmd_rm () {
|
||||
}
|
||||
|
||||
_get_stored_pwd () {
|
||||
- compadd `find ~/.password-store \( -name .git -o -name .gpg-id \) -prune -o -type f -print | sed 's#.*\.password-store*.##'| sed 's#\.gpg##' | sort`
|
||||
+ compadd `find ~/.password-store \( -name .gpg-id \) -prune -o -type f -print | sed 's#.*\.password-store*.##'| sed 's#\.gpg##' | sort`
|
||||
|
||||
}
|
||||
_pass_complete_entries_with_subdirs () {
|
||||
diff --git a/man/pass.1 b/man/pass.1
|
||||
index a124c32..8eeb49b 100644
|
||||
index 3ccfa67..2f16727 100644
|
||||
--- man/pass.1
|
||||
+++ man/pass.1
|
||||
@@ -34,13 +34,6 @@ or
|
||||
@@ -33,13 +33,6 @@ or
|
||||
depending on the type of specifier in ARGS. Otherwise COMMAND must be one of
|
||||
the valid commands listed below.
|
||||
|
||||
-Several of the commands below rely on or provide additional functionality if
|
||||
-the password store directory is also a git repository. If the password store
|
||||
-directory is a git repository, all password store modification commands will
|
||||
-cause a corresponding git commit. See the \fIEXAMPLES\fP section for an
|
||||
-extended description using \fBinit\fP and
|
||||
-cause a corresponding git commit. See the \fIEXTENDED GIT EXAMPLE\fP section
|
||||
-for a detailed description using \fBinit\fP and
|
||||
-.BR git (1).
|
||||
-
|
||||
The \fBinit\fP command must be run before other commands in order to initialize
|
||||
the password store with the correct gpg key id.
|
||||
|
||||
@@ -64,12 +57,8 @@ by using the
|
||||
the password store with the correct gpg key id. Passwords are encrypting using
|
||||
the gpg key set with \fBinit\fP.
|
||||
@@ -68,12 +61,8 @@ by using the
|
||||
.BR tree (1)
|
||||
program. This command is alternatively named \fBlist\fP.
|
||||
.TP
|
||||
@ -80,14 +169,14 @@ index a124c32..8eeb49b 100644
|
||||
+\fBshow\fP \fIpass-name\fP
|
||||
+Decrypt and print a password named \fIpass-name\fP.
|
||||
.TP
|
||||
\fBinsert\fP [ \fI--no-echo\fP, \fI-n\fP | \fI--multiline\fP, \fI-m\fP ] [ \fI--force\fP, \fI-f\fP ]\fIpass-name\fP
|
||||
\fBinsert\fP [ \fI--no-echo\fP, \fI-n\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
|
||||
@@ -88,33 +77,16 @@ ensure that temporary files are created in \fI/dev/shm\fP in order to avoid writ
|
||||
@@ -92,15 +81,12 @@ 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 \fBTMPDIR\fP location, and print a warning.
|
||||
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 ] \fIpass-name pass-length\fP
|
||||
+\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\fP ] \fIpass-name pass-length\fP
|
||||
-\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\fP ] [ \fI--clip\fP, \fI-c\fP ] [ \fI--force\fP, \fI-f\fP ] \fIpass-name pass-length\fP
|
||||
+\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\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
|
||||
@ -95,29 +184,26 @@ index a124c32..8eeb49b 100644
|
||||
-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 seconds.
|
||||
-and then restore the clipboard after 45 seconds. Prompt before overwriting an existing password,
|
||||
+Prompt before overwriting an existing password,
|
||||
unless \fI--force\fP or \fI-f\fP is specified.
|
||||
.TP
|
||||
\fBrm\fP \fIpass-name\fP
|
||||
Remove the password named \fIpass-name\fP from the password store. This command is
|
||||
alternatively named \fBremove\fP.
|
||||
\fBrm\fP [ \fI--recursive\fP, \fI-r\fP ] [ \fI--force\fP, \fI-f\fP ] \fIpass-name\fP
|
||||
@@ -109,13 +95,6 @@ alternatively named \fBremove\fP or \fBdelete\fP. If \fI--recursive\fP or \fI-r\
|
||||
is specified, delete pass-name recursively if it is a directory. If \fI--force\fP
|
||||
or \fI-f\fP is specified, do not interactively prompt before removal.
|
||||
.TP
|
||||
-\fBpush\fP
|
||||
-If the password store is a git repository, push the latest changes using
|
||||
-.BR git-push (1).
|
||||
-.TP
|
||||
-\fBpull\fP
|
||||
-If the password store is a git repository, pull the latest changes using
|
||||
-.BR git-pull (1).
|
||||
-.TP
|
||||
-\fBgit\fP \fIgit-command-args\fP...
|
||||
-If the password store is a git repository, pass \fIgit-command-args\fP as arguments to
|
||||
-.BR git (1)
|
||||
-using the password store as the git repository.
|
||||
-using the password store as the git repository. If \fIgit-command-args\fP is \fBinit\fP,
|
||||
-in addition to initializing the git repository, add the current contents of the password
|
||||
-store to the repository in an initial commit.
|
||||
-.TP
|
||||
\fBhelp\fP
|
||||
Show usage message.
|
||||
.TP
|
||||
@@ -165,11 +137,6 @@ Show existing password
|
||||
@@ -166,11 +145,6 @@ Show existing password
|
||||
.br
|
||||
sup3rh4x3rizmynam3
|
||||
.TP
|
||||
@ -129,7 +215,7 @@ index a124c32..8eeb49b 100644
|
||||
Add password to store
|
||||
.B zx2c4@laptop ~ $ pass insert Business/cheese-whiz-factory
|
||||
.br
|
||||
@@ -208,11 +175,6 @@ The generated password to Email/jasondonenfeld.com is:
|
||||
@@ -209,10 +183,8 @@ The generated password to Email/jasondonenfeld.com is:
|
||||
.br
|
||||
YqFsMkBeO6di
|
||||
.TP
|
||||
@ -137,41 +223,53 @@ index a124c32..8eeb49b 100644
|
||||
-.B zx2c4@laptop ~ $ pass -c generate Email/jasondonenfeld.com 19
|
||||
-.br
|
||||
-Copied Email/jasondonenfeld.com to clipboard. Will clear in 45 seconds.
|
||||
-.TP
|
||||
+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
|
||||
.br
|
||||
@@ -220,10 +182,8 @@ rm: remove regular file \[u2018]/home/zx2c4/.password-store/Business/cheese-whiz
|
||||
@@ -221,99 +193,6 @@ rm: remove regular file \[u2018]/home/zx2c4/.password-store/Business/cheese-whiz
|
||||
.br
|
||||
removed \[u2018]/home/zx2c4/.password-store/Business/cheese-whiz-factory.gpg\[u2019]
|
||||
|
||||
-.SH EXTENDED GIT EXAMPLE
|
||||
-Here, we initialize new password store, create a git repository, and then manipulate and sync passwords. Make note of the arguments to the first call of \fBpass push\fP; consult
|
||||
-Here, we initialize new password store, create a git repository, and then manipulate and sync passwords. Make note of the arguments to the first call of \fBpass git push\fP; consult
|
||||
-.BR git-push (1)
|
||||
-for more information.
|
||||
+.SH EXTENDED EXAMPLE
|
||||
+Here, we initialize new password store, and then manipulate and sync passwords.
|
||||
|
||||
.B zx2c4@laptop ~ $ pass init Jason@zx2c4.com
|
||||
.br
|
||||
@@ -231,12 +191,6 @@ mkdir: created directory \[u2018]/home/zx2c4/.password-store\[u2019]
|
||||
.br
|
||||
Password store initialized for Jason@zx2c4.com.
|
||||
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass init Jason@zx2c4.com
|
||||
-.br
|
||||
-mkdir: created directory \[u2018]/home/zx2c4/.password-store\[u2019]
|
||||
-.br
|
||||
-Password store initialized for Jason@zx2c4.com.
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git init
|
||||
-.br
|
||||
-Initialized empty Git repository in /home/zx2c4/.password-store/.git/
|
||||
-Initialized empty Git repository in /home/zx2c4/.password-store/.git/
|
||||
-.br
|
||||
-[master (root-commit) 998c8fd] Added current contents of password store.
|
||||
-.br
|
||||
- 1 file changed, 1 insertion(+)
|
||||
-.br
|
||||
- create mode 100644 .gpg-id
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git remote add origin kexec.com:pass-store
|
||||
-
|
||||
.B zx2c4@laptop ~ $ pass generate Amazon/amazonemail@email.com 21
|
||||
.br
|
||||
mkdir: created directory \[u2018]/home/zx2c4/.password-store/Amazon\[u2019]
|
||||
@@ -251,24 +205,6 @@ The generated password to Amazon/amazonemail@email.com is:
|
||||
.br
|
||||
<5m,_BrZY`antNDxKN<0A
|
||||
|
||||
-.B zx2c4@laptop ~ $ pass push -u --all
|
||||
-.B zx2c4@laptop ~ $ pass generate Amazon/amazonemail@email.com 21
|
||||
-.br
|
||||
-mkdir: created directory \[u2018]/home/zx2c4/.password-store/Amazon\[u2019]
|
||||
-.br
|
||||
-[master 30fdc1e] Added generated password for Amazon/amazonemail@email.com to store.
|
||||
-.br
|
||||
-1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
-.br
|
||||
-create mode 100644 Amazon/amazonemail@email.com.gpg
|
||||
-.br
|
||||
-The generated password to Amazon/amazonemail@email.com is:
|
||||
-.br
|
||||
-<5m,_BrZY`antNDxKN<0A
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git push -u --all
|
||||
-.br
|
||||
-Counting objects: 4, done.
|
||||
-.br
|
||||
@ -189,14 +287,31 @@ index a124c32..8eeb49b 100644
|
||||
-.br
|
||||
-Branch master set up to track remote branch master from origin.
|
||||
-
|
||||
.B zx2c4@laptop ~ $ pass insert Amazon/otheraccount@email.com
|
||||
.br
|
||||
Enter password for Amazon/otheraccount@email.com: som3r3a11yb1gp4ssw0rd!!88**
|
||||
@@ -293,20 +229,6 @@ rm 'Amazon/amazonemail@email.com.gpg'
|
||||
.br
|
||||
delete mode 100644 Amazon/amazonemail@email.com.gpg
|
||||
|
||||
-.B zx2c4@laptop ~ $ pass push
|
||||
-.B zx2c4@laptop ~ $ pass insert Amazon/otheraccount@email.com
|
||||
-.br
|
||||
-Enter password for Amazon/otheraccount@email.com: som3r3a11yb1gp4ssw0rd!!88**
|
||||
-.br
|
||||
-[master b9b6746] Added given password for Amazon/otheraccount@email.com to store.
|
||||
-.br
|
||||
-1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
-.br
|
||||
-create mode 100644 Amazon/otheraccount@email.com.gpg
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass rm Amazon/amazonemail@email.com
|
||||
-.br
|
||||
-rm: remove regular file \[u2018]/home/zx2c4/.password-store/Amazon/amazonemail@email.com.gpg\[u2019]? y
|
||||
-.br
|
||||
-removed \[u2018]/home/zx2c4/.password-store/Amazon/amazonemail@email.com.gpg\[u2019]
|
||||
-.br
|
||||
-rm 'Amazon/amazonemail@email.com.gpg'
|
||||
-.br
|
||||
-[master 288b379] Removed Amazon/amazonemail@email.com from store.
|
||||
-.br
|
||||
-1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
-.br
|
||||
-delete mode 100644 Amazon/amazonemail@email.com.gpg
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git push
|
||||
-.br
|
||||
-Counting objects: 9, done.
|
||||
-.br
|
||||
@ -213,7 +328,18 @@ index a124c32..8eeb49b 100644
|
||||
.SH FILES
|
||||
|
||||
.TP
|
||||
@@ -320,8 +242,6 @@ be set using the \fBinit\fP command.
|
||||
@@ -333,19 +212,12 @@ Overrides the default password storage directory.
|
||||
.I PASSWORD_STORE_KEY
|
||||
Overrides the default gpg key identification set by \fBinit\fP.
|
||||
.TP
|
||||
-.I PASSWORD_STORE_GIT
|
||||
-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 EDITOR
|
||||
The location of the text editor used by \fBedit\fP.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR gpg (1),
|
||||
.BR pwgen (1),
|
||||
@ -223,31 +349,30 @@ index a124c32..8eeb49b 100644
|
||||
.SH AUTHOR
|
||||
.B pass
|
||||
diff --git a/src/password-store.sh b/src/password-store.sh
|
||||
index 1553e5b..103dfd1 100755
|
||||
index 503bac4..ecc4665 100755
|
||||
--- src/password-store.sh
|
||||
+++ src/password-store.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/usr/local/bin/bash
|
||||
|
||||
# (C) Copyright 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This is released under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -7,11 +7,9 @@ umask 077
|
||||
# Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -7,12 +7,8 @@ umask 077
|
||||
|
||||
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
ID="$PREFIX/.gpg-id"
|
||||
-GIT="$PREFIX/.git"
|
||||
-GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
|
||||
GPG_OPTS="--quiet --yes --batch"
|
||||
-
|
||||
-export GIT_DIR="$GIT"
|
||||
-export GIT_WORK_TREE="$PREFIX"
|
||||
+GETOPT=/usr/local/bin/getopt
|
||||
+GPG=gpg2
|
||||
|
||||
-export GIT_DIR
|
||||
-export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
|
||||
-
|
||||
version() {
|
||||
cat <<_EOF
|
||||
@@ -34,27 +32,18 @@ Usage:
|
||||
Initialize new password storage and use gpg-id for encryption.
|
||||
|-----------------------|
|
||||
@@ -35,24 +31,19 @@ Usage:
|
||||
Optionally reencrypt existing passwords using new gpg-id.
|
||||
$program [ls] [subfolder]
|
||||
List passwords.
|
||||
- $program [show] [--clip,-c] pass-name
|
||||
@ -261,31 +386,41 @@ index 1553e5b..103dfd1 100755
|
||||
before 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] pass-name pass-length
|
||||
+ $program generate [--no-symbols,-n] pass-name pass-length
|
||||
- $program generate [--no-symbols,-n] [--clip,-c] [--force,-f] pass-name pass-length
|
||||
+ $program generate [--no-symbols,-n] [--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.
|
||||
$program rm pass-name
|
||||
Remove existing password.
|
||||
- $program push
|
||||
- If the password store is a git repository, push the latest changes.
|
||||
- $program pull
|
||||
- If the password store is a git repository, pull the latest changes.
|
||||
Prompt before overwriting existing password unless forced.
|
||||
$program rm [--recursive,-r] [--force,-f] pass-name
|
||||
Remove existing password or directory, optionally forcefully.
|
||||
- $program git git-command-args...
|
||||
- If the password store is a git repository, execute a git command
|
||||
- specified by git-command-args.
|
||||
$program help
|
||||
Show this text.
|
||||
$program version
|
||||
@@ -63,32 +52,10 @@ _EOF
|
||||
@@ -63,16 +54,10 @@ _EOF
|
||||
}
|
||||
isCommand() {
|
||||
is_command() {
|
||||
case "$1" in
|
||||
- init|ls|list|show|insert|edit|generate|remove|rm|delete|push|pull|git|help|--help|version|--version) return 0 ;;
|
||||
- init|ls|list|show|insert|edit|generate|remove|rm|delete|git|help|--help|version|--version) return 0 ;;
|
||||
+ init|ls|list|show|insert|edit|generate|remove|rm|delete|help|--help|version|--version) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
-git_add_file() {
|
||||
- [[ -d $GIT_DIR ]] || return
|
||||
- git add "$1" || return
|
||||
- [[ -n $(git status --porcelain "$1") ]] || return
|
||||
- git commit -m "$2"
|
||||
-}
|
||||
yesno() {
|
||||
read -p "$1 [y/N] " response
|
||||
[[ $response == "y" || $response == "Y" ]] || exit 1
|
||||
@@ -80,49 +65,24 @@ yesno() {
|
||||
#
|
||||
# BEGIN Platform definable
|
||||
#
|
||||
-clip() {
|
||||
- # This base64 business is a disgusting hack to deal with newline inconsistancies
|
||||
- # in shell. There must be a better way to deal with this, but because I'm a dolt,
|
||||
@ -299,172 +434,165 @@ index 1553e5b..103dfd1 100755
|
||||
- if [[ $now != $(echo -n "$1" | base64) ]]; then
|
||||
- before="$now"
|
||||
- fi
|
||||
|
||||
- # 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. 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 2>&1
|
||||
- # 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 clipboard
|
||||
- ) & disown
|
||||
- echo "Copied $2 to clipboard. Will clear in 45 seconds."
|
||||
-}
|
||||
program="$(basename "$0")"
|
||||
command="$1"
|
||||
if isCommand "$command"; then
|
||||
@@ -132,18 +99,10 @@ fi
|
||||
tmpdir() {
|
||||
- if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then
|
||||
- tmp_dir="$(TMPDIR=/dev/shm mktemp -t "$template" -d)"
|
||||
+ ramdisk="/var/tmp/password-store.ramdisk"
|
||||
+ if [[ -d $ramdisk && -w $ramdisk && -x $ramdisk ]]; then
|
||||
+ tmp_dir="$(TMPDIR=$ramdisk mktemp -t "$template" -d)"
|
||||
else
|
||||
- yesno "$(echo "Your system does not have /dev/shm, which means that it may"
|
||||
- echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
- echo "password file after editing. Are you sure you would like to"
|
||||
- echo -n "continue?")"
|
||||
+ yesno "$(echo "A ramdisk does not exist at $ramdisk, which means that it may"
|
||||
+ echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
+ echo "password file after editing. Are you sure you would like to"
|
||||
+ echo -n "continue?")"
|
||||
+
|
||||
tmp_dir="$(mktemp -t "$template" -d)"
|
||||
fi
|
||||
-
|
||||
}
|
||||
-GPG="gpg"
|
||||
-GETOPT="getopt"
|
||||
|
||||
-# source /path/to/platform-defined-functions
|
||||
+GPG="gpg2"
|
||||
+GETOPT="/usr/local/bin/getopt"
|
||||
+
|
||||
#
|
||||
# END Platform definable
|
||||
#
|
||||
@@ -156,14 +116,12 @@ case "$command" in
|
||||
mkdir -v -p "$PREFIX"
|
||||
echo "$gpg_id" > "$ID"
|
||||
echo "Password store initialized for $gpg_id."
|
||||
- git_add_file "$ID" "Set GPG id to $gpg_id."
|
||||
|
||||
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 &&
|
||||
mv -v "$passfile.new" "$passfile"
|
||||
done
|
||||
- git_add_file "$PREFIX" "Reencrypted entire store using new GPG id $gpg_id."
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
@@ -192,18 +150,8 @@ fi
|
||||
|
||||
case "$command" in
|
||||
show|ls|list)
|
||||
- clip=0
|
||||
-
|
||||
- opts="$(getopt -o c -l clip -n $program -- "$@")"
|
||||
err=$?
|
||||
- opts="$($GETOPT -o c -l clip -n "$program" -- "$@")"
|
||||
- err=$?
|
||||
- eval set -- "$opts"
|
||||
- while true; do case $1 in
|
||||
- -c|--clip) clip=1; shift ;;
|
||||
- --) shift; break ;;
|
||||
- esac done
|
||||
|
||||
-
|
||||
if [[ $err -ne 0 ]]; then
|
||||
- echo "Usage: $program $command [--clip,-c] [pass-name]"
|
||||
+ echo "Usage: $program $command [pass-name]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -161,11 +120,7 @@ case "$command" in
|
||||
@@ -221,11 +169,7 @@ case "$command" in
|
||||
echo "$path is not in the password store."
|
||||
exit 1
|
||||
fi
|
||||
- if [ $clip -eq 0 ]; then
|
||||
- exec gpg -q -d --yes --batch "$passfile"
|
||||
- if [[ $clip -eq 0 ]]; then
|
||||
- exec $GPG -d $GPG_OPTS "$passfile"
|
||||
- else
|
||||
- clip "$(gpg -q -d --yes --batch "$passfile" | head -n 1)" "$path"
|
||||
- clip "$($GPG -d $GPG_OPTS "$passfile" | head -n 1)" "$path"
|
||||
- fi
|
||||
+ exec $GPG -q -d --yes --batch "$passfile"
|
||||
+ exec $GPG -d $GPG_OPTS "$passfile"
|
||||
fi
|
||||
;;
|
||||
insert)
|
||||
@@ -173,7 +128,7 @@ case "$command" in
|
||||
noecho=0
|
||||
force=0
|
||||
|
||||
- opts="$(getopt -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -201,7 +156,7 @@ case "$command" in
|
||||
if [[ $ml -eq 1 ]]; then
|
||||
echo "Enter contents of $path and press Ctrl+D when finished:"
|
||||
echo
|
||||
- cat | gpg -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
+ cat | $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
elif [[ $noecho -eq 1 ]]; then
|
||||
while true; do
|
||||
read -p "Enter password for $path: " -s password
|
||||
@@ -209,7 +164,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"
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
break
|
||||
else
|
||||
echo "Error: the entered passwords do not match."
|
||||
@@ -217,11 +172,7 @@ case "$command" in
|
||||
done
|
||||
else
|
||||
@@ -275,7 +219,6 @@ case "$command" in
|
||||
read -p "Enter password for $path: " -e password
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
- fi
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added given password for $path to store."
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
$GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
fi
|
||||
- git_add_file "$passfile" "Added given password for $path to store."
|
||||
;;
|
||||
edit)
|
||||
@@ -252,35 +203,28 @@ case "$command" in
|
||||
|
||||
action="Added"
|
||||
if [[ -f $passfile ]]; then
|
||||
- gpg -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1
|
||||
+ $GPG -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 ! $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do
|
||||
if [[ $# -ne 1 ]]; then
|
||||
@@ -303,25 +246,22 @@ case "$command" in
|
||||
echo "GPG encryption failed. Retrying."
|
||||
sleep 1
|
||||
done
|
||||
-
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "$action password for $path using ${EDITOR:-vi}."
|
||||
- fi
|
||||
- git_add_file "$passfile" "$action password for $path using ${EDITOR:-vi}."
|
||||
;;
|
||||
generate)
|
||||
- clip=0
|
||||
force=0
|
||||
symbols="-y"
|
||||
|
||||
- opts="$(getopt -o nc -l no-symbols,clip -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o nc -l no-symbols -n $program -- "$@")"
|
||||
- opts="$($GETOPT -o ncf -l no-symbols,clip,force -n "$program" -- "$@")"
|
||||
+ opts="$($GETOPT -o ncf -l no-symbols,force -n "$program" -- "$@")"
|
||||
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 ;;
|
||||
--) shift; break ;;
|
||||
esac done
|
||||
|
||||
if [[ $err -ne 0 || $# -ne 2 ]]; then
|
||||
- echo "Usage: $program $command [--no-symbols,-n] [--clip,-c] pass-name pass-length"
|
||||
+ echo "Usage: $program $command [--no-symbols,-n] pass-name pass-length"
|
||||
- echo "Usage: $program $command [--no-symbols,-n] [--clip,-c] [--force,-f] pass-name pass-length"
|
||||
+ echo "Usage: $program $command [--no-symbols,-n] [--force,-f] pass-name pass-length"
|
||||
exit 1
|
||||
fi
|
||||
path="$1"
|
||||
@@ -292,18 +236,9 @@ case "$command" in
|
||||
mkdir -p -v "$PREFIX/$(dirname "$path")"
|
||||
@@ -338,14 +278,9 @@ case "$command" in
|
||||
pass="$(pwgen -s $symbols $length 1)"
|
||||
passfile="$PREFIX/$path.gpg"
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added generated password for $path to store."
|
||||
- fi
|
||||
-
|
||||
- if [ $clip -eq 0 ]; then
|
||||
[[ -n $pass ]] || exit 1
|
||||
$GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
- git_add_file "$passfile" "Added generated password for $path to store."
|
||||
|
||||
- if [[ $clip -eq 0 ]]; then
|
||||
- echo "The generated password to $path is:"
|
||||
- echo "$pass"
|
||||
- else
|
||||
- clip "$pass" "$path"
|
||||
- fi
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
+ echo "The generated password to $path is:"
|
||||
+ echo "$pass"
|
||||
;;
|
||||
delete|rm|remove)
|
||||
if [[ $# -ne 1 ]]; then
|
||||
@@ -317,26 +252,6 @@ case "$command" in
|
||||
exit 1
|
||||
fi
|
||||
rm -i -v "$passfile"
|
||||
- if [[ -d $GIT ]] && ! [[ -f $passfile ]]; then
|
||||
- git rm -f "$passfile"
|
||||
recursive=""
|
||||
@@ -377,21 +312,6 @@ case "$command" in
|
||||
[[ $force -eq 1 ]] || yesno "Are you sure you would like to delete $path?"
|
||||
|
||||
rm $recursive -f -v "$passfile"
|
||||
- if [[ -d $GIT_DIR && ! -e $passfile ]]; then
|
||||
- git rm -qr "$passfile"
|
||||
- git commit -m "Removed $path from store."
|
||||
- fi
|
||||
- ;;
|
||||
- push|pull)
|
||||
- if [[ -d $GIT ]]; then
|
||||
- exec git $command "$@"
|
||||
- else
|
||||
- echo "Error: the password store is not a git repository."
|
||||
- exit 1
|
||||
- fi
|
||||
- ;;
|
||||
- git)
|
||||
- if [[ $1 == "init" ]] || [[ -d $GIT ]]; then
|
||||
- if [[ $1 == "init" ]]; then
|
||||
- git "$@" || exit 1
|
||||
- git_add_file "$PREFIX" "Added current contents of password store."
|
||||
- elif [[ -d $GIT_DIR ]]; then
|
||||
- exec git "$@"
|
||||
- else
|
||||
- echo "Error: the password store is not a git repository."
|
||||
|
@ -1,106 +1,167 @@
|
||||
diff --git a/README b/README
|
||||
index 52e23af..273aa27 100644
|
||||
index 47ed64b..65a041e 100644
|
||||
--- README
|
||||
+++ README
|
||||
@@ -14,7 +14,6 @@ Please see the man page for documentation and examples.
|
||||
|
||||
Depends on:
|
||||
- gpg2
|
||||
@@ -17,8 +17,6 @@ Depends on:
|
||||
http://www.gnu.org/software/bash/
|
||||
- GnuPG2
|
||||
http://www.gnupg.org/
|
||||
-- git
|
||||
- http://www.git-scm.com/
|
||||
- xclip
|
||||
http://sourceforge.net/projects/xclip/
|
||||
- pwgen
|
||||
- tree
|
||||
diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion
|
||||
index ccffbfa..aa7e7d8 100644
|
||||
--- contrib/pass.bash-completion
|
||||
+++ contrib/pass.bash-completion
|
||||
@@ -48,7 +48,7 @@ _pass()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
- local commands="init ls show insert generate edit rm git help version"
|
||||
+ local commands="init ls show insert generate edit rm help version"
|
||||
if [[ $COMP_CWORD -gt 1 ]]; then
|
||||
case "${COMP_WORDS[1]}" in
|
||||
init)
|
||||
@@ -74,9 +74,6 @@ _pass()
|
||||
COMPREPLY+=($(compgen -W "-r --recursive -f --force" -- ${cur}))
|
||||
_pass_complete_entries
|
||||
;;
|
||||
- git)
|
||||
- COMPREPLY+=($(compgen -W "init push pull config log reflog" -- ${cur}))
|
||||
- ;;
|
||||
esac
|
||||
else
|
||||
COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
|
||||
diff --git a/contrib/pass.fish-completion b/contrib/pass.fish-completion
|
||||
index 7652d56..086e7ee 100644
|
||||
--- contrib/pass.fish-completion
|
||||
+++ contrib/pass.fish-completion
|
||||
@@ -96,9 +96,3 @@ complete -c $PROG -f -A -n '__fish_pass_needs_command' -s c -l clip -d 'Put pass
|
||||
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'
|
||||
-complete -c $PROG -f -A -n '__fish_pass_uses_command git' -a 'push' -d 'Push changes to remote repo'
|
||||
-complete -c $PROG -f -A -n '__fish_pass_uses_command git' -a 'pull' -d 'Pull changes from remote repo'
|
||||
-complete -c $PROG -f -A -n '__fish_pass_uses_command git' -a 'log' -d 'View changelog'
|
||||
diff --git a/contrib/pass.zsh-completion b/contrib/pass.zsh-completion
|
||||
index 5cf8808..cab22e0 100644
|
||||
index c6fe678..9fe974d 100644
|
||||
--- contrib/pass.zsh-completion
|
||||
+++ contrib/pass.zsh-completion
|
||||
@@ -27,9 +27,6 @@ _pass () {
|
||||
"generate[Generate a new password using pwgen]" \
|
||||
"edit[Edit a password with \$EDITOR]" \
|
||||
"rm[Remove the password]" \
|
||||
- "push[push the latest changes using git-push(1)]" \
|
||||
- "pull[pull the latest changes using git-pull(1)]" \
|
||||
- "git[Call git]" \
|
||||
"help[Help]"
|
||||
_pass_cmd_show
|
||||
fi
|
||||
@@ -75,6 +72,6 @@ _pass_cmd_rm () {
|
||||
@@ -51,18 +51,6 @@ _pass () {
|
||||
"--recursive[recursively delete]"
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
- git)
|
||||
- local -a subcommands
|
||||
- subcommands=(
|
||||
- "init:Initialize git repository"
|
||||
- "push:Push to remote repository"
|
||||
- "pull:Pull from remote repository"
|
||||
- "config:Show git config"
|
||||
- "log:Show git log"
|
||||
- "reflog:Show git reflog"
|
||||
- )
|
||||
- _describe -t commands 'pass git' subcommands
|
||||
- ;;
|
||||
show|*)
|
||||
_pass_cmd_show
|
||||
;;
|
||||
@@ -77,7 +65,6 @@ _pass () {
|
||||
"generate:Generate a new password using pwgen"
|
||||
"edit:Edit a password with \$EDITOR"
|
||||
"rm:Remove the password"
|
||||
- "git:Call git on the password store"
|
||||
"version:Output version information"
|
||||
"help:Output help message"
|
||||
)
|
||||
@@ -98,7 +85,7 @@ _pass_cmd_show () {
|
||||
_pass_complete_entries_helper () {
|
||||
local IFS=$'\n'
|
||||
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
- _values -C 'passwords' $(find "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
|
||||
+ _values -C 'passwords' $(find "$prefix" -name .gpg-id -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
|
||||
}
|
||||
|
||||
_get_stored_pwd () {
|
||||
- compadd `find ~/.password-store \( -name .git -o -name .gpg-id \) -prune -o -type f -print | sed 's#.*\.password-store*.##'| sed 's#\.gpg##' | sort`
|
||||
+ compadd `find ~/.password-store \( -name .gpg-id \) -prune -o -type f -print | sed 's#.*\.password-store*.##'| sed 's#\.gpg##' | sort`
|
||||
|
||||
}
|
||||
_pass_complete_entries_with_subdirs () {
|
||||
diff --git a/man/pass.1 b/man/pass.1
|
||||
index a124c32..c2ff884 100644
|
||||
index 3ccfa67..2ea765b 100644
|
||||
--- man/pass.1
|
||||
+++ man/pass.1
|
||||
@@ -34,13 +34,6 @@ or
|
||||
@@ -33,13 +33,6 @@ or
|
||||
depending on the type of specifier in ARGS. Otherwise COMMAND must be one of
|
||||
the valid commands listed below.
|
||||
|
||||
-Several of the commands below rely on or provide additional functionality if
|
||||
-the password store directory is also a git repository. If the password store
|
||||
-directory is a git repository, all password store modification commands will
|
||||
-cause a corresponding git commit. See the \fIEXAMPLES\fP section for an
|
||||
-extended description using \fBinit\fP and
|
||||
-cause a corresponding git commit. See the \fIEXTENDED GIT EXAMPLE\fP section
|
||||
-for a detailed description using \fBinit\fP and
|
||||
-.BR git (1).
|
||||
-
|
||||
The \fBinit\fP command must be run before other commands in order to initialize
|
||||
the password store with the correct gpg key id.
|
||||
|
||||
@@ -102,19 +95,6 @@ and then restore the clipboard after 45 seconds.
|
||||
Remove the password named \fIpass-name\fP from the password store. This command is
|
||||
alternatively named \fBremove\fP.
|
||||
the password store with the correct gpg key id. Passwords are encrypting using
|
||||
the gpg key set with \fBinit\fP.
|
||||
@@ -109,13 +102,6 @@ alternatively named \fBremove\fP or \fBdelete\fP. If \fI--recursive\fP or \fI-r\
|
||||
is specified, delete pass-name recursively if it is a directory. If \fI--force\fP
|
||||
or \fI-f\fP is specified, do not interactively prompt before removal.
|
||||
.TP
|
||||
-\fBpush\fP
|
||||
-If the password store is a git repository, push the latest changes using
|
||||
-.BR git-push (1).
|
||||
-.TP
|
||||
-\fBpull\fP
|
||||
-If the password store is a git repository, pull the latest changes using
|
||||
-.BR git-pull (1).
|
||||
-.TP
|
||||
-\fBgit\fP \fIgit-command-args\fP...
|
||||
-If the password store is a git repository, pass \fIgit-command-args\fP as arguments to
|
||||
-.BR git (1)
|
||||
-using the password store as the git repository.
|
||||
-using the password store as the git repository. If \fIgit-command-args\fP is \fBinit\fP,
|
||||
-in addition to initializing the git repository, add the current contents of the password
|
||||
-store to the repository in an initial commit.
|
||||
-.TP
|
||||
\fBhelp\fP
|
||||
Show usage message.
|
||||
.TP
|
||||
@@ -220,10 +200,8 @@ rm: remove regular file \[u2018]/home/zx2c4/.password-store/Business/cheese-whiz
|
||||
@@ -221,99 +207,6 @@ rm: remove regular file \[u2018]/home/zx2c4/.password-store/Business/cheese-whiz
|
||||
.br
|
||||
removed \[u2018]/home/zx2c4/.password-store/Business/cheese-whiz-factory.gpg\[u2019]
|
||||
|
||||
-.SH EXTENDED GIT EXAMPLE
|
||||
-Here, we initialize new password store, create a git repository, and then manipulate and sync passwords. Make note of the arguments to the first call of \fBpass push\fP; consult
|
||||
-Here, we initialize new password store, create a git repository, and then manipulate and sync passwords. Make note of the arguments to the first call of \fBpass git push\fP; consult
|
||||
-.BR git-push (1)
|
||||
-for more information.
|
||||
+.SH EXTENDED EXAMPLE
|
||||
+Here, we initialize new password store, and then manipulate and sync passwords.
|
||||
|
||||
.B zx2c4@laptop ~ $ pass init Jason@zx2c4.com
|
||||
.br
|
||||
@@ -231,12 +209,6 @@ mkdir: created directory \[u2018]/home/zx2c4/.password-store\[u2019]
|
||||
.br
|
||||
Password store initialized for Jason@zx2c4.com.
|
||||
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass init Jason@zx2c4.com
|
||||
-.br
|
||||
-mkdir: created directory \[u2018]/home/zx2c4/.password-store\[u2019]
|
||||
-.br
|
||||
-Password store initialized for Jason@zx2c4.com.
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git init
|
||||
-.br
|
||||
-Initialized empty Git repository in /home/zx2c4/.password-store/.git/
|
||||
-Initialized empty Git repository in /home/zx2c4/.password-store/.git/
|
||||
-.br
|
||||
-[master (root-commit) 998c8fd] Added current contents of password store.
|
||||
-.br
|
||||
- 1 file changed, 1 insertion(+)
|
||||
-.br
|
||||
- create mode 100644 .gpg-id
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git remote add origin kexec.com:pass-store
|
||||
-
|
||||
.B zx2c4@laptop ~ $ pass generate Amazon/amazonemail@email.com 21
|
||||
.br
|
||||
mkdir: created directory \[u2018]/home/zx2c4/.password-store/Amazon\[u2019]
|
||||
@@ -251,24 +223,6 @@ The generated password to Amazon/amazonemail@email.com is:
|
||||
.br
|
||||
<5m,_BrZY`antNDxKN<0A
|
||||
|
||||
-.B zx2c4@laptop ~ $ pass push -u --all
|
||||
-.B zx2c4@laptop ~ $ pass generate Amazon/amazonemail@email.com 21
|
||||
-.br
|
||||
-mkdir: created directory \[u2018]/home/zx2c4/.password-store/Amazon\[u2019]
|
||||
-.br
|
||||
-[master 30fdc1e] Added generated password for Amazon/amazonemail@email.com to store.
|
||||
-.br
|
||||
-1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
-.br
|
||||
-create mode 100644 Amazon/amazonemail@email.com.gpg
|
||||
-.br
|
||||
-The generated password to Amazon/amazonemail@email.com is:
|
||||
-.br
|
||||
-<5m,_BrZY`antNDxKN<0A
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git push -u --all
|
||||
-.br
|
||||
-Counting objects: 4, done.
|
||||
-.br
|
||||
@ -118,14 +179,31 @@ index a124c32..c2ff884 100644
|
||||
-.br
|
||||
-Branch master set up to track remote branch master from origin.
|
||||
-
|
||||
.B zx2c4@laptop ~ $ pass insert Amazon/otheraccount@email.com
|
||||
.br
|
||||
Enter password for Amazon/otheraccount@email.com: som3r3a11yb1gp4ssw0rd!!88**
|
||||
@@ -293,20 +247,6 @@ rm 'Amazon/amazonemail@email.com.gpg'
|
||||
.br
|
||||
delete mode 100644 Amazon/amazonemail@email.com.gpg
|
||||
|
||||
-.B zx2c4@laptop ~ $ pass push
|
||||
-.B zx2c4@laptop ~ $ pass insert Amazon/otheraccount@email.com
|
||||
-.br
|
||||
-Enter password for Amazon/otheraccount@email.com: som3r3a11yb1gp4ssw0rd!!88**
|
||||
-.br
|
||||
-[master b9b6746] Added given password for Amazon/otheraccount@email.com to store.
|
||||
-.br
|
||||
-1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
-.br
|
||||
-create mode 100644 Amazon/otheraccount@email.com.gpg
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass rm Amazon/amazonemail@email.com
|
||||
-.br
|
||||
-rm: remove regular file \[u2018]/home/zx2c4/.password-store/Amazon/amazonemail@email.com.gpg\[u2019]? y
|
||||
-.br
|
||||
-removed \[u2018]/home/zx2c4/.password-store/Amazon/amazonemail@email.com.gpg\[u2019]
|
||||
-.br
|
||||
-rm 'Amazon/amazonemail@email.com.gpg'
|
||||
-.br
|
||||
-[master 288b379] Removed Amazon/amazonemail@email.com from store.
|
||||
-.br
|
||||
-1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
-.br
|
||||
-delete mode 100644 Amazon/amazonemail@email.com.gpg
|
||||
-
|
||||
-.B zx2c4@laptop ~ $ pass git push
|
||||
-.br
|
||||
-Counting objects: 9, done.
|
||||
-.br
|
||||
@ -142,7 +220,18 @@ index a124c32..c2ff884 100644
|
||||
.SH FILES
|
||||
|
||||
.TP
|
||||
@@ -320,7 +260,6 @@ be set using the \fBinit\fP command.
|
||||
@@ -333,18 +226,12 @@ Overrides the default password storage directory.
|
||||
.I PASSWORD_STORE_KEY
|
||||
Overrides the default gpg key identification set by \fBinit\fP.
|
||||
.TP
|
||||
-.I PASSWORD_STORE_GIT
|
||||
-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 EDITOR
|
||||
The location of the text editor used by \fBedit\fP.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR gpg (1),
|
||||
.BR pwgen (1),
|
||||
@ -151,203 +240,144 @@ index a124c32..c2ff884 100644
|
||||
|
||||
.SH AUTHOR
|
||||
diff --git a/src/password-store.sh b/src/password-store.sh
|
||||
index 1553e5b..6844dc4 100755
|
||||
index 503bac4..3c4ad4b 100755
|
||||
--- src/password-store.sh
|
||||
+++ src/password-store.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/usr/local/bin/bash
|
||||
|
||||
# (C) Copyright 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This is released under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -7,11 +7,11 @@ umask 077
|
||||
# Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -7,12 +7,8 @@ umask 077
|
||||
|
||||
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
ID="$PREFIX/.gpg-id"
|
||||
-GIT="$PREFIX/.git"
|
||||
-GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
|
||||
GPG_OPTS="--quiet --yes --batch"
|
||||
-
|
||||
-export GIT_DIR="$GIT"
|
||||
-export GIT_WORK_TREE="$PREFIX"
|
||||
+GETOPT=/usr/local/bin/getopt
|
||||
+GPG=gpg2
|
||||
+XCLIP=xclip
|
||||
+BASE64=base64
|
||||
|
||||
-export GIT_DIR
|
||||
-export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
|
||||
-
|
||||
version() {
|
||||
cat <<_EOF
|
||||
@@ -48,13 +48,6 @@ Usage:
|
||||
Optionally put it on the clipboard and clear board after 45 seconds.
|
||||
$program rm pass-name
|
||||
Remove existing password.
|
||||
- $program push
|
||||
- If the password store is a git repository, push the latest changes.
|
||||
- $program pull
|
||||
- If the password store is a git repository, pull the latest changes.
|
||||
|-----------------------|
|
||||
@@ -50,9 +46,6 @@ Usage:
|
||||
Prompt before overwriting existing password unless forced.
|
||||
$program rm [--recursive,-r] [--force,-f] pass-name
|
||||
Remove existing password or directory, optionally forcefully.
|
||||
- $program git git-command-args...
|
||||
- If the password store is a git repository, execute a git command
|
||||
- specified by git-command-args.
|
||||
$program help
|
||||
Show this text.
|
||||
$program version
|
||||
@@ -63,7 +56,7 @@ _EOF
|
||||
@@ -63,16 +56,10 @@ _EOF
|
||||
}
|
||||
isCommand() {
|
||||
is_command() {
|
||||
case "$1" in
|
||||
- init|ls|list|show|insert|edit|generate|remove|rm|delete|push|pull|git|help|--help|version|--version) return 0 ;;
|
||||
- init|ls|list|show|insert|edit|generate|remove|rm|delete|git|help|--help|version|--version) return 0 ;;
|
||||
+ init|ls|list|show|insert|edit|generate|remove|rm|delete|help|--help|version|--version) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
@@ -72,12 +65,12 @@ clip() {
|
||||
# in shell. There must be a better way to deal with this, but because I'm a dolt,
|
||||
# we're going with this for now.
|
||||
|
||||
- before="$(xclip -o -selection clipboard | base64)"
|
||||
- echo -n "$1" | xclip -selection clipboard
|
||||
+ before="$($XCLIP -o -selection clipboard | $BASE64)"
|
||||
+ echo -n "$1" | $XCLIP -selection clipboard
|
||||
(
|
||||
sleep 45
|
||||
- now="$(xclip -o -selection clipboard | base64)"
|
||||
- if [[ $now != $(echo -n "$1" | base64) ]]; then
|
||||
+ now="$($XCLIP -o -selection clipboard | $BASE64)"
|
||||
+ if [[ $now != $(echo -n "$1" | $BASE64) ]]; then
|
||||
before="$now"
|
||||
fi
|
||||
# It might be nice to programatically check to see if klipper exists,
|
||||
@@ -85,7 +78,7 @@ clip() {
|
||||
# this works fine. 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 2>&1
|
||||
- echo "$before" | base64 -d | xclip -selection clipboard
|
||||
+ echo "$before" | $BASE64 -d | $XCLIP -selection clipboard
|
||||
-git_add_file() {
|
||||
- [[ -d $GIT_DIR ]] || return
|
||||
- git add "$1" || return
|
||||
- [[ -n $(git status --porcelain "$1") ]] || return
|
||||
- git commit -m "$2"
|
||||
-}
|
||||
yesno() {
|
||||
read -p "$1 [y/N] " response
|
||||
[[ $response == "y" || $response == "Y" ]] || exit 1
|
||||
@@ -107,22 +94,24 @@ clip() {
|
||||
) & disown
|
||||
echo "Copied $2 to clipboard. Will clear in 45 seconds."
|
||||
}
|
||||
@@ -134,7 +127,7 @@ case "$command" in
|
||||
show|ls|list)
|
||||
clip=0
|
||||
+
|
||||
tmpdir() {
|
||||
- if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then
|
||||
- tmp_dir="$(TMPDIR=/dev/shm mktemp -t "$template" -d)"
|
||||
+ ramdisk="/var/tmp/password-store.ramdisk"
|
||||
+ if [[ -d $ramdisk && -w $ramdisk && -x $ramdisk ]]; then
|
||||
+ tmp_dir="$(TMPDIR=$ramdisk mktemp -t "$template" -d)"
|
||||
else
|
||||
- yesno "$(echo "Your system does not have /dev/shm, which means that it may"
|
||||
- echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
- echo "password file after editing. Are you sure you would like to"
|
||||
- echo -n "continue?")"
|
||||
+ yesno "$(echo "A ramdisk does not exist at $ramdisk, which means that it may"
|
||||
+ echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
+ echo "password file after editing. Are you sure you would like to"
|
||||
+ echo -n "continue?")"
|
||||
+
|
||||
tmp_dir="$(mktemp -t "$template" -d)"
|
||||
fi
|
||||
-
|
||||
}
|
||||
-GPG="gpg"
|
||||
-GETOPT="getopt"
|
||||
|
||||
- opts="$(getopt -o c -l clip -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o c -l clip -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -162,9 +155,9 @@ case "$command" in
|
||||
exit 1
|
||||
fi
|
||||
if [ $clip -eq 0 ]; then
|
||||
- exec gpg -q -d --yes --batch "$passfile"
|
||||
+ exec $GPG -q -d --yes --batch "$passfile"
|
||||
else
|
||||
- clip "$(gpg -q -d --yes --batch "$passfile" | head -n 1)" "$path"
|
||||
+ clip "$($GPG -q -d --yes --batch "$passfile" | head -n 1)" "$path"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
@@ -173,7 +166,7 @@ case "$command" in
|
||||
noecho=0
|
||||
force=0
|
||||
-# source /path/to/platform-defined-functions
|
||||
+GPG="gpg2"
|
||||
+GETOPT="/usr/local/bin/getopt"
|
||||
+
|
||||
#
|
||||
# END Platform definable
|
||||
#
|
||||
@@ -156,14 +145,12 @@ case "$command" in
|
||||
mkdir -v -p "$PREFIX"
|
||||
echo "$gpg_id" > "$ID"
|
||||
echo "Password store initialized for $gpg_id."
|
||||
- git_add_file "$ID" "Set GPG id to $gpg_id."
|
||||
|
||||
- opts="$(getopt -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -201,7 +194,7 @@ case "$command" in
|
||||
if [[ $ml -eq 1 ]]; then
|
||||
echo "Enter contents of $path and press Ctrl+D when finished:"
|
||||
echo
|
||||
- cat | gpg -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
+ cat | $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
elif [[ $noecho -eq 1 ]]; then
|
||||
while true; do
|
||||
read -p "Enter password for $path: " -s password
|
||||
@@ -209,7 +202,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"
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
break
|
||||
else
|
||||
echo "Error: the entered passwords do not match."
|
||||
@@ -217,11 +210,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 &&
|
||||
mv -v "$passfile.new" "$passfile"
|
||||
done
|
||||
else
|
||||
read -p "Enter password for $path: " -e password
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
- fi
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added given password for $path to store."
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
- git_add_file "$PREFIX" "Reencrypted entire store using new GPG id $gpg_id."
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
@@ -275,7 +262,6 @@ case "$command" in
|
||||
read -p "Enter password for $path: " -e password
|
||||
$GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
fi
|
||||
- git_add_file "$passfile" "Added given password for $path to store."
|
||||
;;
|
||||
edit)
|
||||
@@ -252,25 +241,20 @@ case "$command" in
|
||||
|
||||
action="Added"
|
||||
if [[ -f $passfile ]]; then
|
||||
- gpg -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1
|
||||
+ $GPG -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 ! $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do
|
||||
if [[ $# -ne 1 ]]; then
|
||||
@@ -303,7 +289,6 @@ case "$command" in
|
||||
echo "GPG encryption failed. Retrying."
|
||||
sleep 1
|
||||
done
|
||||
-
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "$action password for $path using ${EDITOR:-vi}."
|
||||
- fi
|
||||
- git_add_file "$passfile" "$action password for $path using ${EDITOR:-vi}."
|
||||
;;
|
||||
generate)
|
||||
clip=0
|
||||
symbols="-y"
|
||||
|
||||
- opts="$(getopt -o nc -l no-symbols,clip -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o nc -l no-symbols,clip -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -292,12 +276,7 @@ case "$command" in
|
||||
mkdir -p -v "$PREFIX/$(dirname "$path")"
|
||||
@@ -338,7 +323,6 @@ case "$command" in
|
||||
pass="$(pwgen -s $symbols $length 1)"
|
||||
passfile="$PREFIX/$path.gpg"
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added generated password for $path to store."
|
||||
- fi
|
||||
-
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
if [ $clip -eq 0 ]; then
|
||||
[[ -n $pass ]] || exit 1
|
||||
$GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
- git_add_file "$passfile" "Added generated password for $path to store."
|
||||
|
||||
if [[ $clip -eq 0 ]]; then
|
||||
echo "The generated password to $path is:"
|
||||
echo "$pass"
|
||||
@@ -317,26 +296,6 @@ case "$command" in
|
||||
exit 1
|
||||
fi
|
||||
rm -i -v "$passfile"
|
||||
- if [[ -d $GIT ]] && ! [[ -f $passfile ]]; then
|
||||
- git rm -f "$passfile"
|
||||
@@ -377,21 +361,6 @@ case "$command" in
|
||||
[[ $force -eq 1 ]] || yesno "Are you sure you would like to delete $path?"
|
||||
|
||||
rm $recursive -f -v "$passfile"
|
||||
- if [[ -d $GIT_DIR && ! -e $passfile ]]; then
|
||||
- git rm -qr "$passfile"
|
||||
- git commit -m "Removed $path from store."
|
||||
- fi
|
||||
- ;;
|
||||
- push|pull)
|
||||
- if [[ -d $GIT ]]; then
|
||||
- exec git $command "$@"
|
||||
- else
|
||||
- echo "Error: the password store is not a git repository."
|
||||
- exit 1
|
||||
- fi
|
||||
- ;;
|
||||
- git)
|
||||
- if [[ $1 == "init" ]] || [[ -d $GIT ]]; then
|
||||
- if [[ $1 == "init" ]]; then
|
||||
- git "$@" || exit 1
|
||||
- git_add_file "$PREFIX" "Added current contents of password store."
|
||||
- elif [[ -d $GIT_DIR ]]; then
|
||||
- exec git "$@"
|
||||
- else
|
||||
- echo "Error: the password store is not a git repository."
|
||||
|
@ -1,40 +1,91 @@
|
||||
diff --git a/README b/README
|
||||
index 52e23af..ce7c745 100644
|
||||
index 47ed64b..496c37f 100644
|
||||
--- README
|
||||
+++ README
|
||||
@@ -15,7 +15,6 @@ Please see the man page for documentation and examples.
|
||||
Depends on:
|
||||
- gpg2
|
||||
@@ -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
|
||||
- GNU getopt
|
||||
diff --git a/contrib/pass.bash-completion b/contrib/pass.bash-completion
|
||||
index ccffbfa..2c2afc0 100644
|
||||
--- contrib/pass.bash-completion
|
||||
+++ contrib/pass.bash-completion
|
||||
@@ -59,7 +59,6 @@ _pass()
|
||||
_pass_complete_entries
|
||||
;;
|
||||
show|-*)
|
||||
- COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))
|
||||
_pass_complete_entries 1
|
||||
;;
|
||||
insert)
|
||||
@@ -67,7 +66,7 @@ _pass()
|
||||
_pass_complete_entries
|
||||
;;
|
||||
generate)
|
||||
- COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force" -- ${cur}))
|
||||
+ COMPREPLY+=($(compgen -W "-n --no-symbols -f --force" -- ${cur}))
|
||||
_pass_complete_entries
|
||||
;;
|
||||
rm|remove|delete)
|
||||
diff --git a/contrib/pass.fish-completion b/contrib/pass.fish-completion
|
||||
index 7652d56..5c180e2 100644
|
||||
--- contrib/pass.fish-completion
|
||||
+++ contrib/pass.fish-completion
|
||||
@@ -76,7 +76,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' -a "(__fish_pass_print_entry_dirs)"
|
||||
|
||||
@@ -89,13 +88,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/contrib/pass.zsh-completion b/contrib/pass.zsh-completion
|
||||
index 5cf8808..5e1c3ac 100644
|
||||
index c6fe678..a01bb2b 100644
|
||||
--- contrib/pass.zsh-completion
|
||||
+++ contrib/pass.zsh-completion
|
||||
@@ -45,7 +45,6 @@ _pass_cmd_ls () {
|
||||
@@ -39,8 +39,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]"
|
||||
_pass_complete_entries_with_subdirs
|
||||
;;
|
||||
rm)
|
||||
@@ -90,9 +88,6 @@ _pass () {
|
||||
}
|
||||
|
||||
_pass_cmd_show () {
|
||||
_arguments : \
|
||||
- "-c[put it on the clipboard]" \
|
||||
'*::show:_get_stored_pwd'
|
||||
#'::pass id:_files -W ~/.password-store -g "*.gpg(|.*)(-.)"'
|
||||
- _arguments : \
|
||||
- "-c[put it on the clipboard]" \
|
||||
- "--clip[put it on the clipboard]"
|
||||
_pass_complete_entries
|
||||
}
|
||||
@@ -65,7 +64,6 @@ _pass_cmd_insert () {
|
||||
_pass_cmd_generate () {
|
||||
_arguments : \
|
||||
"-n[no symbols]" \
|
||||
- "-c[put password on the clipboard]" \
|
||||
'::show:_get_stored_pwd'
|
||||
}
|
||||
|
||||
_pass_complete_entries_helper () {
|
||||
diff --git a/man/pass.1 b/man/pass.1
|
||||
index a124c32..7df6551 100644
|
||||
index 3ccfa67..c0aa018 100644
|
||||
--- man/pass.1
|
||||
+++ man/pass.1
|
||||
@@ -64,12 +64,8 @@ by using the
|
||||
@@ -68,12 +68,8 @@ by using the
|
||||
.BR tree (1)
|
||||
program. This command is alternatively named \fBlist\fP.
|
||||
.TP
|
||||
@ -47,14 +98,14 @@ index a124c32..7df6551 100644
|
||||
+\fBshow\fP \fIpass-name\fP
|
||||
+Decrypt and print a password named \fIpass-name\fP.
|
||||
.TP
|
||||
\fBinsert\fP [ \fI--no-echo\fP, \fI-n\fP | \fI--multiline\fP, \fI-m\fP ] [ \fI--force\fP, \fI-f\fP ]\fIpass-name\fP
|
||||
\fBinsert\fP [ \fI--no-echo\fP, \fI-n\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
|
||||
@@ -88,15 +84,11 @@ ensure that temporary files are created in \fI/dev/shm\fP in order to avoid writ
|
||||
@@ -92,15 +88,12 @@ 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 \fBTMPDIR\fP location, and print a warning.
|
||||
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 ] \fIpass-name pass-length\fP
|
||||
+\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\fP ] \fIpass-name pass-length\fP
|
||||
-\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\fP ] [ \fI--clip\fP, \fI-c\fP ] [ \fI--force\fP, \fI-f\fP ] \fIpass-name pass-length\fP
|
||||
+\fBgenerate\fP [ \fI--no-symbols\fP, \fI-n\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
|
||||
@ -62,11 +113,12 @@ index a124c32..7df6551 100644
|
||||
-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 seconds.
|
||||
-and then restore the clipboard after 45 seconds. Prompt before overwriting an existing password,
|
||||
+Prompt before overwriting an existing password,
|
||||
unless \fI--force\fP or \fI-f\fP is specified.
|
||||
.TP
|
||||
\fBrm\fP \fIpass-name\fP
|
||||
Remove the password named \fIpass-name\fP from the password store. This command is
|
||||
@@ -165,11 +157,6 @@ Show existing password
|
||||
\fBrm\fP [ \fI--recursive\fP, \fI-r\fP ] [ \fI--force\fP, \fI-f\fP ] \fIpass-name\fP
|
||||
@@ -166,11 +159,6 @@ Show existing password
|
||||
.br
|
||||
sup3rh4x3rizmynam3
|
||||
.TP
|
||||
@ -78,7 +130,7 @@ index a124c32..7df6551 100644
|
||||
Add password to store
|
||||
.B zx2c4@laptop ~ $ pass insert Business/cheese-whiz-factory
|
||||
.br
|
||||
@@ -208,11 +195,6 @@ The generated password to Email/jasondonenfeld.com is:
|
||||
@@ -209,10 +197,8 @@ The generated password to Email/jasondonenfeld.com is:
|
||||
.br
|
||||
YqFsMkBeO6di
|
||||
.TP
|
||||
@ -86,11 +138,12 @@ index a124c32..7df6551 100644
|
||||
-.B zx2c4@laptop ~ $ pass -c generate Email/jasondonenfeld.com 19
|
||||
-.br
|
||||
-Copied Email/jasondonenfeld.com to clipboard. Will clear in 45 seconds.
|
||||
-.TP
|
||||
+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
|
||||
.br
|
||||
@@ -321,7 +303,6 @@ be set using the \fBinit\fP command.
|
||||
@@ -345,7 +331,6 @@ The location of the text editor used by \fBedit\fP.
|
||||
.BR gpg (1),
|
||||
.BR pwgen (1),
|
||||
.BR git (1),
|
||||
@ -99,33 +152,17 @@ index a124c32..7df6551 100644
|
||||
.SH AUTHOR
|
||||
.B pass
|
||||
diff --git a/src/password-store.sh b/src/password-store.sh
|
||||
index 1553e5b..43e095e 100755
|
||||
index 503bac4..5264fb4 100755
|
||||
--- src/password-store.sh
|
||||
+++ src/password-store.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/usr/local/bin/bash
|
||||
|
||||
# (C) Copyright 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This is released under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -7,10 +7,13 @@ umask 077
|
||||
|
||||
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
ID="$PREFIX/.gpg-id"
|
||||
-GIT="$PREFIX/.git"
|
||||
+GITDIR="$PREFIX/.git"
|
||||
GPG_OPTS="--quiet --yes --batch"
|
||||
+GETOPT=/usr/local/bin/getopt
|
||||
+GPG=gpg2
|
||||
+GIT=git
|
||||
|
||||
-export GIT_DIR="$GIT"
|
||||
+export GIT_DIR="$GITDIR"
|
||||
export GIT_WORK_TREE="$PREFIX"
|
||||
|
||||
version() {
|
||||
@@ -34,18 +37,16 @@ Usage:
|
||||
Initialize new password storage and use gpg-id for encryption.
|
||||
# Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -35,18 +35,16 @@ Usage:
|
||||
Optionally reencrypt existing passwords using new gpg-id.
|
||||
$program [ls] [subfolder]
|
||||
List passwords.
|
||||
- $program [show] [--clip,-c] pass-name
|
||||
@ -139,17 +176,17 @@ index 1553e5b..43e095e 100755
|
||||
before 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] pass-name pass-length
|
||||
+ $program generate [--no-symbols,-n] pass-name pass-length
|
||||
- $program generate [--no-symbols,-n] [--clip,-c] [--force,-f] pass-name pass-length
|
||||
+ $program generate [--no-symbols,-n] [--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.
|
||||
$program rm pass-name
|
||||
Remove existing password.
|
||||
$program push
|
||||
@@ -67,28 +68,6 @@ isCommand() {
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
Prompt before overwriting existing password unless forced.
|
||||
$program rm [--recursive,-r] [--force,-f] pass-name
|
||||
Remove existing password or directory, optionally forcefully.
|
||||
@@ -80,49 +78,24 @@ yesno() {
|
||||
#
|
||||
# BEGIN Platform definable
|
||||
#
|
||||
-clip() {
|
||||
- # This base64 business is a disgusting hack to deal with newline inconsistancies
|
||||
- # in shell. There must be a better way to deal with this, but because I'm a dolt,
|
||||
@ -163,212 +200,120 @@ index 1553e5b..43e095e 100755
|
||||
- if [[ $now != $(echo -n "$1" | base64) ]]; then
|
||||
- before="$now"
|
||||
- fi
|
||||
|
||||
- # 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. 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 2>&1
|
||||
- # 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 clipboard
|
||||
- ) & disown
|
||||
- echo "Copied $2 to clipboard. Will clear in 45 seconds."
|
||||
-}
|
||||
program="$(basename "$0")"
|
||||
command="$1"
|
||||
if isCommand "$command"; then
|
||||
@@ -132,18 +111,10 @@ fi
|
||||
tmpdir() {
|
||||
- if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then
|
||||
- tmp_dir="$(TMPDIR=/dev/shm mktemp -t "$template" -d)"
|
||||
+ ramdisk="/var/tmp/password-store.ramdisk"
|
||||
+ if [[ -d $ramdisk && -w $ramdisk && -x $ramdisk ]]; then
|
||||
+ tmp_dir="$(TMPDIR=$ramdisk mktemp -t "$template" -d)"
|
||||
else
|
||||
- yesno "$(echo "Your system does not have /dev/shm, which means that it may"
|
||||
- echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
- echo "password file after editing. Are you sure you would like to"
|
||||
- echo -n "continue?")"
|
||||
+ yesno "$(echo "A ramdisk does not exist at $ramdisk, which means that it may"
|
||||
+ echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
+ echo "password file after editing. Are you sure you would like to"
|
||||
+ echo -n "continue?")"
|
||||
+
|
||||
tmp_dir="$(mktemp -t "$template" -d)"
|
||||
fi
|
||||
-
|
||||
}
|
||||
-GPG="gpg"
|
||||
-GETOPT="getopt"
|
||||
|
||||
-# source /path/to/platform-defined-functions
|
||||
+GPG="gpg2"
|
||||
+GETOPT="/usr/local/bin/getopt"
|
||||
+
|
||||
#
|
||||
# END Platform definable
|
||||
#
|
||||
@@ -192,18 +165,8 @@ fi
|
||||
|
||||
case "$command" in
|
||||
show|ls|list)
|
||||
- clip=0
|
||||
-
|
||||
- opts="$(getopt -o c -l clip -n $program -- "$@")"
|
||||
err=$?
|
||||
- opts="$($GETOPT -o c -l clip -n "$program" -- "$@")"
|
||||
- err=$?
|
||||
- eval set -- "$opts"
|
||||
- while true; do case $1 in
|
||||
- -c|--clip) clip=1; shift ;;
|
||||
- --) shift; break ;;
|
||||
- esac done
|
||||
|
||||
-
|
||||
if [[ $err -ne 0 ]]; then
|
||||
- echo "Usage: $program $command [--clip,-c] [pass-name]"
|
||||
+ echo "Usage: $program $command [pass-name]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -161,11 +132,7 @@ case "$command" in
|
||||
@@ -221,11 +184,7 @@ case "$command" in
|
||||
echo "$path is not in the password store."
|
||||
exit 1
|
||||
fi
|
||||
- if [ $clip -eq 0 ]; then
|
||||
- exec gpg -q -d --yes --batch "$passfile"
|
||||
- if [[ $clip -eq 0 ]]; then
|
||||
- exec $GPG -d $GPG_OPTS "$passfile"
|
||||
- else
|
||||
- clip "$(gpg -q -d --yes --batch "$passfile" | head -n 1)" "$path"
|
||||
- clip "$($GPG -d $GPG_OPTS "$passfile" | head -n 1)" "$path"
|
||||
- fi
|
||||
+ exec $GPG -q -d --yes --batch "$passfile"
|
||||
+ exec $GPG -d $GPG_OPTS "$passfile"
|
||||
fi
|
||||
;;
|
||||
insert)
|
||||
@@ -173,7 +140,7 @@ case "$command" in
|
||||
noecho=0
|
||||
force=0
|
||||
|
||||
- opts="$(getopt -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -201,7 +168,7 @@ case "$command" in
|
||||
if [[ $ml -eq 1 ]]; then
|
||||
echo "Enter contents of $path and press Ctrl+D when finished:"
|
||||
echo
|
||||
- cat | gpg -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
+ cat | $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
elif [[ $noecho -eq 1 ]]; then
|
||||
while true; do
|
||||
read -p "Enter password for $path: " -s password
|
||||
@@ -209,7 +176,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"
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
break
|
||||
else
|
||||
echo "Error: the entered passwords do not match."
|
||||
@@ -217,11 +184,11 @@ case "$command" in
|
||||
done
|
||||
else
|
||||
read -p "Enter password for $path: " -e password
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
fi
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added given password for $path to store."
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ $GIT add "$passfile"
|
||||
+ $GIT commit -m "Added given password for $path to store."
|
||||
fi
|
||||
;;
|
||||
edit)
|
||||
@@ -252,35 +219,33 @@ case "$command" in
|
||||
|
||||
action="Added"
|
||||
if [[ -f $passfile ]]; then
|
||||
- gpg -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1
|
||||
+ $GPG -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 ! $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do
|
||||
echo "GPG encryption failed. Retrying."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "$action password for $path using ${EDITOR:-vi}."
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ $GIT add "$passfile"
|
||||
+ $GIT commit -m "$action password for $path using ${EDITOR:-vi}."
|
||||
fi
|
||||
@@ -306,22 +265,20 @@ case "$command" in
|
||||
git_add_file "$passfile" "$action password for $path using ${EDITOR:-vi}."
|
||||
;;
|
||||
generate)
|
||||
- clip=0
|
||||
force=0
|
||||
symbols="-y"
|
||||
|
||||
- opts="$(getopt -o nc -l no-symbols,clip -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o nc -l no-symbols -n $program -- "$@")"
|
||||
- opts="$($GETOPT -o ncf -l no-symbols,clip,force -n "$program" -- "$@")"
|
||||
+ opts="$($GETOPT -o ncf -l no-symbols,force -n "$program" -- "$@")"
|
||||
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 ;;
|
||||
--) shift; break ;;
|
||||
esac done
|
||||
|
||||
if [[ $err -ne 0 || $# -ne 2 ]]; then
|
||||
- echo "Usage: $program $command [--no-symbols,-n] [--clip,-c] pass-name pass-length"
|
||||
+ echo "Usage: $program $command [--no-symbols,-n] pass-name pass-length"
|
||||
- echo "Usage: $program $command [--no-symbols,-n] [--clip,-c] [--force,-f] pass-name pass-length"
|
||||
+ echo "Usage: $program $command [--no-symbols,-n] [--force,-f] pass-name pass-length"
|
||||
exit 1
|
||||
fi
|
||||
path="$1"
|
||||
@@ -292,18 +257,13 @@ case "$command" in
|
||||
mkdir -p -v "$PREFIX/$(dirname "$path")"
|
||||
pass="$(pwgen -s $symbols $length 1)"
|
||||
passfile="$PREFIX/$path.gpg"
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added generated password for $path to store."
|
||||
- fi
|
||||
-
|
||||
- if [ $clip -eq 0 ]; then
|
||||
@@ -340,12 +297,8 @@ case "$command" in
|
||||
$GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
git_add_file "$passfile" "Added generated password for $path to store."
|
||||
|
||||
- if [[ $clip -eq 0 ]]; then
|
||||
- echo "The generated password to $path is:"
|
||||
- echo "$pass"
|
||||
- else
|
||||
- clip "$pass" "$path"
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ $GIT add "$passfile"
|
||||
+ $GIT commit -m "Added generated password for $path to store."
|
||||
fi
|
||||
- fi
|
||||
+ echo "The generated password to $path is:"
|
||||
+ echo "$pass"
|
||||
;;
|
||||
delete|rm|remove)
|
||||
if [[ $# -ne 1 ]]; then
|
||||
@@ -317,22 +277,45 @@ case "$command" in
|
||||
exit 1
|
||||
fi
|
||||
rm -i -v "$passfile"
|
||||
- if [[ -d $GIT ]] && ! [[ -f $passfile ]]; then
|
||||
- git rm -f "$passfile"
|
||||
- git commit -m "Removed $path from store."
|
||||
+ if [[ -d $GITDIR ]] && ! [[ -f $passfile ]]; then
|
||||
+ $GIT rm -f "$passfile"
|
||||
+ $GIT commit -m "Removed $path from store."
|
||||
fi
|
||||
;;
|
||||
push|pull)
|
||||
- if [[ -d $GIT ]]; then
|
||||
- exec git $command "$@"
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ exec $GIT $command "$@"
|
||||
else
|
||||
echo "Error: the password store is not a git repository."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
git)
|
||||
- if [[ $1 == "init" ]] || [[ -d $GIT ]]; then
|
||||
- exec git "$@"
|
||||
+ if [[ $1 == "init" ]]; then
|
||||
+ username=$2
|
||||
+ useremail=$3
|
||||
+
|
||||
+ $GIT init
|
||||
+
|
||||
+ if [ -z "$username" ]; then
|
||||
+ current=$($GIT config user.name)
|
||||
+ prompt="Set your git user.name: "
|
||||
+ read -e -i "$current" -p "$prompt" username
|
||||
+ username="${username:-$username}"
|
||||
+ fi
|
||||
+ if [ -z "$useremail" ]; then
|
||||
+ current=$($GIT config user.email)
|
||||
+ prompt="Set your git user.email: "
|
||||
+ read -e -i "$current" -p "$prompt" useremail
|
||||
+ useremail="${useremail:-$useremail}"
|
||||
+ fi
|
||||
+ $GIT config user.name "$username"
|
||||
+ $GIT config user.email "$useremail"
|
||||
+ echo .gpg-id > $PREFIX/.gitignore
|
||||
+ $GIT add .
|
||||
+ $GIT commit -m "Adding existing passwords to the store."
|
||||
+ elif [[ -d $GITDIR ]]; then
|
||||
+ exec $GIT "$@"
|
||||
else
|
||||
echo "Error: the password store is not a git repository."
|
||||
exit 1
|
||||
recursive=""
|
||||
|
@ -1,218 +1,45 @@
|
||||
diff --git a/src/password-store.sh b/src/password-store.sh
|
||||
index 1553e5b..78c45b8 100755
|
||||
index 503bac4..6fcf2cc 100755
|
||||
--- src/password-store.sh
|
||||
+++ src/password-store.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/bash
|
||||
+#!/usr/local/bin/bash
|
||||
|
||||
# (C) Copyright 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This is released under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -7,10 +7,15 @@ umask 077
|
||||
|
||||
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
ID="$PREFIX/.gpg-id"
|
||||
-GIT="$PREFIX/.git"
|
||||
+GITDIR="$PREFIX/.git"
|
||||
GPG_OPTS="--quiet --yes --batch"
|
||||
+GETOPT=/usr/local/bin/getopt
|
||||
+GPG=gpg2
|
||||
+GIT=git
|
||||
+XCLIP=xclip
|
||||
+BASE64=base64
|
||||
|
||||
-export GIT_DIR="$GIT"
|
||||
+export GIT_DIR="$GITDIR"
|
||||
export GIT_WORK_TREE="$PREFIX"
|
||||
|
||||
version() {
|
||||
@@ -72,12 +77,12 @@ clip() {
|
||||
# in shell. There must be a better way to deal with this, but because I'm a dolt,
|
||||
# we're going with this for now.
|
||||
|
||||
- before="$(xclip -o -selection clipboard | base64)"
|
||||
- echo -n "$1" | xclip -selection clipboard
|
||||
+ before="$($XCLIP -o -selection clipboard | $BASE64)"
|
||||
+ echo -n "$1" | $XCLIP -selection clipboard
|
||||
(
|
||||
sleep 45
|
||||
- now="$(xclip -o -selection clipboard | base64)"
|
||||
- if [[ $now != $(echo -n "$1" | base64) ]]; then
|
||||
+ now="$($XCLIP -o -selection clipboard | $BASE64)"
|
||||
+ if [[ $now != $(echo -n "$1" | $BASE64) ]]; then
|
||||
before="$now"
|
||||
fi
|
||||
# It might be nice to programatically check to see if klipper exists,
|
||||
@@ -85,7 +90,7 @@ clip() {
|
||||
# this works fine. 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 2>&1
|
||||
- echo "$before" | base64 -d | xclip -selection clipboard
|
||||
+ echo "$before" | $BASE64 -d | $XCLIP -selection clipboard
|
||||
# Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
||||
@@ -107,22 +107,24 @@ clip() {
|
||||
) & disown
|
||||
echo "Copied $2 to clipboard. Will clear in 45 seconds."
|
||||
}
|
||||
@@ -134,7 +139,7 @@ case "$command" in
|
||||
show|ls|list)
|
||||
clip=0
|
||||
|
||||
- opts="$(getopt -o c -l clip -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o c -l clip -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -162,9 +167,9 @@ case "$command" in
|
||||
exit 1
|
||||
fi
|
||||
if [ $clip -eq 0 ]; then
|
||||
- exec gpg -q -d --yes --batch "$passfile"
|
||||
+ exec $GPG -q -d --yes --batch "$passfile"
|
||||
else
|
||||
- clip "$(gpg -q -d --yes --batch "$passfile" | head -n 1)" "$path"
|
||||
+ clip "$($GPG -q -d --yes --batch "$passfile" | head -n 1)" "$path"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
@@ -173,7 +178,7 @@ case "$command" in
|
||||
noecho=0
|
||||
force=0
|
||||
|
||||
- opts="$(getopt -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o mnf -l multiline,no-echo,force -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -201,7 +206,7 @@ case "$command" in
|
||||
if [[ $ml -eq 1 ]]; then
|
||||
echo "Enter contents of $path and press Ctrl+D when finished:"
|
||||
echo
|
||||
- cat | gpg -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
+ cat | $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS
|
||||
elif [[ $noecho -eq 1 ]]; then
|
||||
while true; do
|
||||
read -p "Enter password for $path: " -s password
|
||||
@@ -209,7 +214,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"
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
break
|
||||
else
|
||||
echo "Error: the entered passwords do not match."
|
||||
@@ -217,11 +222,11 @@ case "$command" in
|
||||
done
|
||||
else
|
||||
read -p "Enter password for $path: " -e password
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$password"
|
||||
fi
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added given password for $path to store."
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ $GIT add "$passfile"
|
||||
+ $GIT commit -m "Added given password for $path to store."
|
||||
fi
|
||||
;;
|
||||
edit)
|
||||
@@ -252,25 +257,25 @@ case "$command" in
|
||||
|
||||
action="Added"
|
||||
if [[ -f $passfile ]]; then
|
||||
- gpg -d -o "$tmp_file" $GPG_OPTS "$passfile" || exit 1
|
||||
+ $GPG -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 ! $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS "$tmp_file"; do
|
||||
echo "GPG encryption failed. Retrying."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "$action password for $path using ${EDITOR:-vi}."
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ $GIT add "$passfile"
|
||||
+ $GIT commit -m "$action password for $path using ${EDITOR:-vi}."
|
||||
fi
|
||||
;;
|
||||
generate)
|
||||
clip=0
|
||||
symbols="-y"
|
||||
|
||||
- opts="$(getopt -o nc -l no-symbols,clip -n $program -- "$@")"
|
||||
+ opts="$($GETOPT -o nc -l no-symbols,clip -n $program -- "$@")"
|
||||
err=$?
|
||||
eval set -- "$opts"
|
||||
while true; do case $1 in
|
||||
@@ -292,10 +297,10 @@ case "$command" in
|
||||
mkdir -p -v "$PREFIX/$(dirname "$path")"
|
||||
pass="$(pwgen -s $symbols $length 1)"
|
||||
passfile="$PREFIX/$path.gpg"
|
||||
- gpg -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
- if [[ -d $GIT ]]; then
|
||||
- git add "$passfile"
|
||||
- git commit -m "Added generated password for $path to store."
|
||||
+ $GPG -e -r "$ID" -o "$passfile" $GPG_OPTS <<<"$pass"
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ $GIT add "$passfile"
|
||||
+ $GIT commit -m "Added generated password for $path to store."
|
||||
fi
|
||||
|
||||
if [ $clip -eq 0 ]; then
|
||||
@@ -317,22 +322,45 @@ case "$command" in
|
||||
exit 1
|
||||
fi
|
||||
rm -i -v "$passfile"
|
||||
- if [[ -d $GIT ]] && ! [[ -f $passfile ]]; then
|
||||
- git rm -f "$passfile"
|
||||
- git commit -m "Removed $path from store."
|
||||
+ if [[ -d $GITDIR ]] && ! [[ -f $passfile ]]; then
|
||||
+ $GIT rm -f "$passfile"
|
||||
+ $GIT commit -m "Removed $path from store."
|
||||
fi
|
||||
;;
|
||||
push|pull)
|
||||
- if [[ -d $GIT ]]; then
|
||||
- exec git $command "$@"
|
||||
+ if [[ -d $GITDIR ]]; then
|
||||
+ exec $GIT $command "$@"
|
||||
else
|
||||
echo "Error: the password store is not a git repository."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
git)
|
||||
- if [[ $1 == "init" ]] || [[ -d $GIT ]]; then
|
||||
- exec git "$@"
|
||||
+ if [[ $1 == "init" ]]; then
|
||||
+ username=$2
|
||||
+ useremail=$3
|
||||
+
|
||||
+ $GIT init
|
||||
tmpdir() {
|
||||
- if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then
|
||||
- tmp_dir="$(TMPDIR=/dev/shm mktemp -t "$template" -d)"
|
||||
+ ramdisk="/var/tmp/password-store.ramdisk"
|
||||
+ if [[ -d $ramdisk && -w $ramdisk && -x $ramdisk ]]; then
|
||||
+ tmp_dir="$(TMPDIR=$ramdisk mktemp -t "$template" -d)"
|
||||
else
|
||||
- yesno "$(echo "Your system does not have /dev/shm, which means that it may"
|
||||
- echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
- echo "password file after editing. Are you sure you would like to"
|
||||
- echo -n "continue?")"
|
||||
+ yesno "$(echo "A ramdisk does not exist at $ramdisk, which means that it may"
|
||||
+ echo "be difficult to entirely erase the temporary non-encrypted"
|
||||
+ echo "password file after editing. Are you sure you would like to"
|
||||
+ echo -n "continue?")"
|
||||
+
|
||||
+ if [ -z "$username" ]; then
|
||||
+ current=$($GIT config user.name)
|
||||
+ prompt="Set your git user.name: "
|
||||
+ read -e -i "$current" -p "$prompt" username
|
||||
+ username="${username:-$username}"
|
||||
+ fi
|
||||
+ if [ -z "$useremail" ]; then
|
||||
+ current=$($GIT config user.email)
|
||||
+ prompt="Set your git user.email: "
|
||||
+ read -e -i "$current" -p "$prompt" useremail
|
||||
+ useremail="${useremail:-$useremail}"
|
||||
+ fi
|
||||
+ $GIT config user.name "$username"
|
||||
+ $GIT config user.email "$useremail"
|
||||
+ echo .gpg-id > $PREFIX/.gitignore
|
||||
+ $GIT add .
|
||||
+ $GIT commit -m "Adding existing passwords to the store."
|
||||
+ elif [[ -d $GITDIR ]]; then
|
||||
+ exec $GIT "$@"
|
||||
else
|
||||
echo "Error: the password store is not a git repository."
|
||||
exit 1
|
||||
tmp_dir="$(mktemp -t "$template" -d)"
|
||||
fi
|
||||
-
|
||||
}
|
||||
-GPG="gpg"
|
||||
-GETOPT="getopt"
|
||||
|
||||
-# source /path/to/platform-defined-functions
|
||||
+GPG="gpg2"
|
||||
+GETOPT="/usr/local/bin/getopt"
|
||||
+
|
||||
#
|
||||
# END Platform definable
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user