Compare commits

..

2 Commits

Author SHA1 Message Date
Dustin C. Hatch 9cf514009a bwpass: Pass TTY name to pinentry
The curses-based pinentry defaults to using its standard input stream to
display the prompt, but this fails when stdin is a pipe.  It does
provide a command-line argument to specify a specific file name, though.
2019-08-29 19:50:42 -05:00
Dustin C. Hatch 1c80f5bd73 dmenu_bw: Type password instead of copying it
Auto-typing the password, instead of copying it to the clipboard, is
more secure, since any process can read the contents of the clipboard.
It is also significantly more convenient, avoiding the paste step, and
works in situations where pasting isn't possible (such as into a VM
console).
2019-08-29 19:47:55 -05:00
2 changed files with 4 additions and 6 deletions

7
dmenu_bw Normal file → Executable file
View File

@ -5,8 +5,5 @@ set -e
key="$(bwpass | dmenu)"
[ -n "${key}" ] || exit 0
password="$(bwpass show "${key}")"
[ -n "${password}" ] || exit 1
printf '%s' "${password}" | xclip -quiet -rmlastnl -sel clip 2> /dev/null &
sleep 12
kill $!
bwpass show "${key}" | tr -d '\n' | xdotool type --file -
xdotool key Return

View File

@ -65,8 +65,9 @@ class Pinentry:
def getpin(self):
codec = locale.getpreferredencoding()
tty = os.ttyname(sys.stdin.fileno())
p = subprocess.Popen(
['pinentry'],
['pinentry', '-T', tty],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)