[pass] [PATCH] Firefox addon

Johan Venant jvenant at invicem.pro
Sat Oct 12 17:53:57 CEST 2013


Hello,

I'm working on a firefox addon using pass script to retrieve login and
password to fill websites forms.

It already works well, but I'm facing an issue about passphrase :
I can't make the gpg-agent passphrase dialogbox to work when pass is
executed from firefox.

I have this error message :
Error opening terminal: unknown.
gpg-agent[17014]: command get_passphrase failed: End of file
gpg: problem with the agent: End of file
gpg: decryption failed: No secret key

It force me to make my own Firefox dialog box to ask the passphrase and to
transmit it to the pass script.
That's why I made this little patch to add a passphrase option to the pass
script for the ls command. If you apply it, it will allow everybody to use
the addon without any particular effort.

I know it may not be the best to bypass the default gpg-agent behavior to
get the passphrase. But right now, I didn't found any other solution.
If someone have an other idee, let my know.

Thank you,
Johan.

---
 src/password-store.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index 2500253..a4de733 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -193,11 +193,12 @@ case "$command" in
  show|ls|list)
  clip=0

- opts="$($GETOPT -o c -l clip -n "$program" -- "$@")"
+ opts="$($GETOPT -o cp: -l clip,passphrase: -n "$program" -- "$@")"
  err=$?
  eval set -- "$opts"
  while true; do case $1 in
  -c|--clip) clip=1; shift ;;
+ -p|--passphrase) shift; PASS_PHRASE="$1"; shift ;;
  --) shift; break ;;
  esac done

@@ -210,7 +211,11 @@ case "$command" in
  passfile="$PREFIX/$path.gpg"
  if [[ -f $passfile ]]; then
  if [[ $clip -eq 0 ]]; then
- exec gpg2 -d $GPG_OPTS "$passfile"
+ if [[ -z "$PASS_PHRASE" ]]; then
+ exec gpg2 -d $GPG_OPTS "$passfile"
+ else
+ exec gpg2 -d $GPG_OPTS --passphrase "$PASS_PHRASE" "$passfile"
+ fi
  else
  pass="$(gpg2 -d $GPG_OPTS "$passfile" | head -n 1)"
  [[ -n $pass ]] || exit 1
-- 
1.8.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20131012/0020e133/attachment.html>


More information about the Password-Store mailing list