mirror of
https://github.com/gaschz/qubes-pass.git
synced 2025-03-01 14:22:31 +01:00
Qubes-pass gains the ability to specify nosymbols for password generation.
This commit is contained in:
parent
42789f3e90
commit
b6ed1339b7
@ -29,6 +29,7 @@ elif [ "$1" == "get-or-generate" ] ; then
|
|||||||
cmd=$(echo "$1" | base64 -w 0)
|
cmd=$(echo "$1" | base64 -w 0)
|
||||||
key=$(echo "$2" | base64 -w 0)
|
key=$(echo "$2" | base64 -w 0)
|
||||||
autogen=$(echo 1 | base64 -w 0)
|
autogen=$(echo 1 | base64 -w 0)
|
||||||
|
nosymbols=$(echo "$3" | base64 -w 0)
|
||||||
echo "$cmd
|
echo "$cmd
|
||||||
$key
|
$key
|
||||||
$autogen" | /usr/lib/qubes/qrexec-client-vm "$QUBES_PASS_DOMAIN" ruddo.PassManage
|
$autogen" | /usr/lib/qubes/qrexec-client-vm "$QUBES_PASS_DOMAIN" ruddo.PassManage
|
||||||
|
20
bin/qvm-pass
20
bin/qvm-pass
@ -1,9 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
TEMP=`getopt -o ?d:mfe -- "$@"`
|
TEMP=`getopt -o ?d:n:mfe -- "$@"`
|
||||||
force=0
|
force=0
|
||||||
multiline=0
|
multiline=0
|
||||||
echo=0
|
echo=0
|
||||||
|
nosymbols=
|
||||||
eval set -- "$TEMP"
|
eval set -- "$TEMP"
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -22,10 +23,12 @@ usage() {
|
|||||||
echo " If your key is not named after a subcommand, you can also"
|
echo " If your key is not named after a subcommand, you can also"
|
||||||
echo " get its contents by passing it as the first argument of"
|
echo " get its contents by passing it as the first argument of"
|
||||||
echo " this command, omitting the get subcommand."
|
echo " this command, omitting the get subcommand."
|
||||||
echo " get-or-generate <key>"
|
echo " get-or-generate [-n symbols] <key>"
|
||||||
echo " Retrieves a key from the pass store; creates the key"
|
echo " Retrieves a key from the pass store; creates the key"
|
||||||
echo " with 32 characters length if it does not exist yet,"
|
echo " with 32 characters length if it does not exist yet,"
|
||||||
echo " and returns the generated key on standard output."
|
echo " and returns the generated key on standard output."
|
||||||
|
echo " The -n option excludes symbols from being used"
|
||||||
|
echo " during password generation."
|
||||||
echo " insert [--echo,-e | --multiline,-m] [--force,-f] <key>"
|
echo " insert [--echo,-e | --multiline,-m] [--force,-f] <key>"
|
||||||
echo " Creates a key in the pass store."
|
echo " Creates a key in the pass store."
|
||||||
exit 0
|
exit 0
|
||||||
@ -38,6 +41,8 @@ while true ; do
|
|||||||
"") shift 2 ;;
|
"") shift 2 ;;
|
||||||
*) export QUBES_PASS_DOMAIN="$2" ; shift 2 ;;
|
*) export QUBES_PASS_DOMAIN="$2" ; shift 2 ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
|
-n)
|
||||||
|
nosymbols="$2" ; shift 2 ;;
|
||||||
-m)
|
-m)
|
||||||
multiline=1 ; shift ;;
|
multiline=1 ; shift ;;
|
||||||
-f)
|
-f)
|
||||||
@ -62,10 +67,10 @@ case "$1" in
|
|||||||
if [ -n "$3" ] ; then
|
if [ -n "$3" ] ; then
|
||||||
echo "the $1 subcommand only accepts one argument; run with -? for more information" >&2 ; exit 64
|
echo "the $1 subcommand only accepts one argument; run with -? for more information" >&2 ; exit 64
|
||||||
fi
|
fi
|
||||||
exec qubes-pass-client "$1" "$2"
|
exec qubes-pass-client "$1" "$2" "$nosymbols"
|
||||||
;;
|
;;
|
||||||
init)
|
init)
|
||||||
if [ "$force$multiline$echo" != "000" ] ; then
|
if [ "$force$multiline$echo$nosymbols" != "000" ] ; then
|
||||||
echo "the $1 subcommand does not accept that option; run with -? for more information" >&2 ; exit 64
|
echo "the $1 subcommand does not accept that option; run with -? for more information" >&2 ; exit 64
|
||||||
fi
|
fi
|
||||||
if [ -n "$2" ] ; then
|
if [ -n "$2" ] ; then
|
||||||
@ -74,6 +79,9 @@ case "$1" in
|
|||||||
exec qubes-pass-client "$1"
|
exec qubes-pass-client "$1"
|
||||||
;;
|
;;
|
||||||
insert)
|
insert)
|
||||||
|
if [ "$nosymbols" != "" ] ; then
|
||||||
|
echo "the $1 subcommand does not accept that option; run with -? for more information" >&2 ; exit 64
|
||||||
|
fi
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [ "$force" != "1" ] ; then
|
if [ "$force" != "1" ] ; then
|
||||||
@ -110,13 +118,13 @@ case "$1" in
|
|||||||
exec qubes-pass-client insert "$1" "$multiline" "$contents"
|
exec qubes-pass-client insert "$1" "$multiline" "$contents"
|
||||||
;;
|
;;
|
||||||
list)
|
list)
|
||||||
if [ "$force$multiline$echo" != "000" ] ; then
|
if [ "$force$multiline$echo$nosymbols" != "000" ] ; then
|
||||||
echo "the $1 subcommand does not accept that option; run with -? for more information" >&2 ; exit 64
|
echo "the $1 subcommand does not accept that option; run with -? for more information" >&2 ; exit 64
|
||||||
fi
|
fi
|
||||||
exec qubes-pass-client list
|
exec qubes-pass-client list
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$force$multiline$echo" != "000" ] ; then
|
if [ "$force$multiline$echo$nosymbols" != "000" ] ; then
|
||||||
echo "the get subcommand does not accept that option; run with -? for more information" >&2 ; exit 64
|
echo "the get subcommand does not accept that option; run with -? for more information" >&2 ; exit 64
|
||||||
fi
|
fi
|
||||||
exec qubes-pass-client get "$1"
|
exec qubes-pass-client get "$1"
|
||||||
|
@ -38,14 +38,20 @@ elif [ "$cmd" == "get-or-generate" ] ; then
|
|||||||
|
|
||||||
read -n 4096 entry
|
read -n 4096 entry
|
||||||
read -n 4096 autogen
|
read -n 4096 autogen
|
||||||
|
read -n 4096 nosymbols
|
||||||
entry=$(echo "$entry" | base64 -d)
|
entry=$(echo "$entry" | base64 -d)
|
||||||
autogen=$(echo "$autogen" | base64 -d)
|
nosymbols=$(echo "nosymbols" | base64 -d)
|
||||||
|
|
||||||
if [ "$autogen" == "1" ] ; then
|
if [ "$autogen" == "1" ] ; then
|
||||||
ret=0 ; out=$(pass -- "$entry" 2>&1) || ret=$?
|
ret=0 ; out=$(pass -- "$entry" 2>&1) || ret=$?
|
||||||
if [ "$ret" == "1" ] && echo "$out" | grep -q "not in the password store" ; then
|
if [ "$ret" == "1" ] && echo "$out" | grep -q "not in the password store" ; then
|
||||||
logger -t ruddo.PassManage "creating password entry $entry"
|
logger -t ruddo.PassManage "creating password entry $entry"
|
||||||
ret=0 ; out=$(pass generate -- "$entry" 32) || ret=$?
|
ret=0
|
||||||
|
if [ "$nosymbols" != "" ] ; then
|
||||||
|
out=$(pass generate -n "$nosymbols" -- "$entry" 32) || ret=$?
|
||||||
|
else
|
||||||
|
out=$(pass generate -- "$entry" 32) || ret=$?
|
||||||
|
fi
|
||||||
if [ "$ret" == "1" ] ; then
|
if [ "$ret" == "1" ] ; then
|
||||||
echo "Password generation failed: $out"
|
echo "Password generation failed: $out"
|
||||||
exit "$ret"
|
exit "$ret"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
%define mybuildnumber %{?build_number}%{?!build_number:1}
|
%define mybuildnumber %{?build_number}%{?!build_number:1}
|
||||||
|
|
||||||
Name: qubes-pass
|
Name: qubes-pass
|
||||||
Version: 0.0.6
|
Version: 0.0.7
|
||||||
Release: %{mybuildnumber}%{?dist}
|
Release: %{mybuildnumber}%{?dist}
|
||||||
Summary: Inter-VM pass password management for Qubes OS AppVMs and StandaloneVMs
|
Summary: Inter-VM pass password management for Qubes OS AppVMs and StandaloneVMs
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user