and i *think* getSecret is done. had to work around some argparse weirdness.
This commit is contained in:
parent
b3058348f1
commit
861a73ea93
@ -445,6 +445,20 @@ configuration can be either specified in the <<configuration,configuration file>
|
|||||||
flags/switches to subcommands. **Some** configuration directives/behaviour may be overridden by environment variables
|
flags/switches to subcommands. **Some** configuration directives/behaviour may be overridden by environment variables
|
||||||
where supported by Vault/Pass upstream configuration.
|
where supported by Vault/Pass upstream configuration.
|
||||||
|
|
||||||
|
=== Vault Paths Don't Match VaultPass' Paths
|
||||||
|
=== Issue Description
|
||||||
|
Pass and Vault have fundamentally different storage ideas. Pass secrets/passwords are, once decrypted, just plaintext
|
||||||
|
blobs. Vault, on the other hand, uses a key/value type of storage. As a result, this means two things:
|
||||||
|
|
||||||
|
* The last item in a path in VaultPass is the key name (e.g. the path `foo/bar/baz` in VaultPass would be a Vault path
|
||||||
|
of `foo/bar`, which would then have a **key** named `baz`), and
|
||||||
|
* The **`line-number`** sub-argument is completely irrelevant for things like copying to the clipboard and generating a
|
||||||
|
QR code (e.g. as in `pass show --clip`**`=line-number`**).
|
||||||
|
|
||||||
|
==== Workaround(s)
|
||||||
|
None, aside from not using the `line-number` sub-argument since it's no longer relevant. (You'll get an error if you
|
||||||
|
do.)
|
||||||
|
|
||||||
|
|
||||||
== Submitting a Bug Report/Feature Request
|
== Submitting a Bug Report/Feature Request
|
||||||
Please use https://bugs.square-r00t.net/index.php?do=newtask&project=13[my bugtracker^].
|
Please use https://bugs.square-r00t.net/index.php?do=newtask&project=13[my bugtracker^].
|
||||||
|
@ -246,15 +246,18 @@ class VaultPass(object):
|
|||||||
'seconds': seconds,
|
'seconds': seconds,
|
||||||
'printme': printme}
|
'printme': printme}
|
||||||
data = self.getSecret(**args)
|
data = self.getSecret(**args)
|
||||||
if qr is not None:
|
if qr not in (False, None):
|
||||||
data, has_x = QR.genQr(data, image = True)
|
qrdata, has_x = QR.genQr(data, image = True)
|
||||||
if has_x:
|
if has_x:
|
||||||
fpath = tempfile.mkstemp(prefix = '.vaultpass.qr.', suffix = '.svg', dir = '/dev/shm')[1]
|
fpath = tempfile.mkstemp(prefix = '.vaultpass.qr.', suffix = '.svg', dir = '/dev/shm')[1]
|
||||||
_logger.debug('Writing to {0} so it can be displayed'.format(fpath))
|
_logger.debug('Writing to {0} so it can be displayed'.format(fpath))
|
||||||
with open(fpath, 'wb') as fh:
|
with open(fpath, 'wb') as fh:
|
||||||
fh.write(data.read())
|
fh.write(qrdata.read())
|
||||||
if printme:
|
if printme:
|
||||||
_logger.debug('Opening {0} in the default image viwer application'.format(fpath))
|
_logger.debug('Opening {0} in the default image viwer application'.format(fpath))
|
||||||
|
# We intentionally want this to block, as most image viewers will
|
||||||
|
# unload the image once the file is deleted and we can probably
|
||||||
|
# elete it before the user can save it elsewhere or scan it with their phone.
|
||||||
cmd = subprocess.run(['xdg-open', fpath], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
cmd = subprocess.run(['xdg-open', fpath], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||||
if cmd.returncode != 0:
|
if cmd.returncode != 0:
|
||||||
_logger.error('xdg-open returned non-zero status code')
|
_logger.error('xdg-open returned non-zero status code')
|
||||||
@ -267,10 +270,10 @@ class VaultPass(object):
|
|||||||
_logger.debug('{0}: {1}'.format(x.upper(), o))
|
_logger.debug('{0}: {1}'.format(x.upper(), o))
|
||||||
os.remove(fpath)
|
os.remove(fpath)
|
||||||
elif printme:
|
elif printme:
|
||||||
print(data.read())
|
print(qrdata.read())
|
||||||
data.seek(0, 0)
|
qrdata.seek(0, 0)
|
||||||
# TODO: clip, etc.
|
if clip not in (False, None):
|
||||||
clipboard.pasteClipboard(printme = printme)
|
clipboard.pasteClipboard(data, seconds = seconds, clipboard = clipboard, printme = printme)
|
||||||
return(data)
|
return(data)
|
||||||
|
|
||||||
def initVault(self, *args, **kwargs):
|
def initVault(self, *args, **kwargs):
|
||||||
|
@ -337,7 +337,7 @@ def parseArgs():
|
|||||||
dest = 'path',
|
dest = 'path',
|
||||||
help = ('(Dummy option; kept for compatibility reasons)'))
|
help = ('(Dummy option; kept for compatibility reasons)'))
|
||||||
initvault.add_argument('gpg_id',
|
initvault.add_argument('gpg_id',
|
||||||
dest = 'gpg_id',
|
metavar = 'GPG_KEY_ID',
|
||||||
help = ('(Dummy option; kept for compatibility reasons)'))
|
help = ('(Dummy option; kept for compatibility reasons)'))
|
||||||
# INSERT
|
# INSERT
|
||||||
# vp.insertSecret()
|
# vp.insertSecret()
|
||||||
@ -411,22 +411,14 @@ def parseArgs():
|
|||||||
# vp.getSecret(printme = True)
|
# vp.getSecret(printme = True)
|
||||||
# TODO: does the default overwrite the None if not specified?
|
# TODO: does the default overwrite the None if not specified?
|
||||||
show.add_argument('-c', '--clip',
|
show.add_argument('-c', '--clip',
|
||||||
nargs = '?',
|
action = 'store_true',
|
||||||
type = int,
|
|
||||||
default = None,
|
|
||||||
metavar = 'LINE_NUMBER',
|
|
||||||
dest = 'clip',
|
dest = 'clip',
|
||||||
help = ('If specified, do not print the secret but instead copy it to the clipboard. '
|
help = ('If specified, do not print the secret but instead copy it to the clipboard'))
|
||||||
'LINE_NUMBER has no effect and is kept for compatibility reasons'))
|
|
||||||
show.add_argument('-q', '--qrcode',
|
show.add_argument('-q', '--qrcode',
|
||||||
dest = 'qr',
|
dest = 'qr',
|
||||||
nargs = '?',
|
action = 'store_true',
|
||||||
type = int,
|
|
||||||
metavar = 'LINE_NUMBER',
|
|
||||||
default = None,
|
|
||||||
help = ('If specified, do not print the secret but instead generate a QR code of it (either '
|
help = ('If specified, do not print the secret but instead generate a QR code of it (either '
|
||||||
'graphically or in-terminal depending on environment). '
|
'graphically or in-terminal depending on environment)'))
|
||||||
'LINE_NUMBER has no effect and is kept for compatibility reasons'))
|
|
||||||
show.add_argument('-s', '--seconds',
|
show.add_argument('-s', '--seconds',
|
||||||
dest = 'seconds',
|
dest = 'seconds',
|
||||||
type = int,
|
type = int,
|
||||||
|
Reference in New Issue
Block a user