forked from keepassxreboot/keepassxc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multiple database with --pw-stdin (keepassxreboot#2916)
* Updated utilities to unlock KDBX with OS password manager on macOS and Linux * Use a static stream on stdin for --pw-stdin otherwise buffer loss eliminates subsequent passwords * Update INSTALL requirements
- Loading branch information
1 parent
ba4d68c
commit 1cbd395
Showing
5 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
# fetch KeePass database passwords from keychain | ||
|
||
### change the path to suit your installation or set KDBX_SEARCH before calling ### | ||
: ${KDBX_SEARCH:=~/.KeePass/*.kdbx} | ||
|
||
PROG="$(basename $0)" | ||
KeePassXC=$(ls -f {/usr/local,/Applications}/KeePassXC.app/Contents/MacOS/KeePassXC 2>/dev/null | head -1) | ||
|
||
function daemon_main { | ||
declare -A DBs | ||
for DBPATH in $KDBX_SEARCH; do | ||
DBs[$(python -c "import os; print os.path.realpath('$DBPATH')")]=$(security find-generic-password -a $USER -s "${DBPATH##*/}" -w) | ||
done | ||
|
||
# launch keepassxc | ||
IFS=$'\n\n\n' | ||
$KeePassXC --pw-stdin "${!DBs[@]}" <<<"${DBs[*]}" & | ||
} | ||
|
||
if [[ '-d' = "$1" ]]; then | ||
exec >&~/tmp/$PROG.log | ||
set -vx | ||
daemon_main | ||
else | ||
cd / | ||
daemon_main </dev/null >&/dev/null & | ||
disown | ||
fi |