Replies: 15 comments 3 replies
-
#3947 should address your first issue. The second issue is something I've wanted too, maybe I could take a look at doing that. I like the third idea, I'll look at that too. |
Beta Was this translation helpful? Give feedback.
-
I can toss a bounty on this one to support your efforts. |
Beta Was this translation helpful? Give feedback.
-
It seems that the Internet ate one of my bulleted points ([4]). I added that again on the description. |
Beta Was this translation helpful? Give feedback.
-
I do not agree with implementing feature 2, using escaped spaces or quotes is standard in command line. Feature 3 should allow for wildcard support: |
Beta Was this translation helpful? Give feedback.
-
@stdedos Not sure if I understand your 4th case correctly, but why not write a wrapper to have your CLI instance running in 'open' mode as a daemon? Once started that wrapper handles CLI's std{in,out} and exposes whatever interface to the rest of your environment. For instance, a UNIX socket for communicating with the wrapper and a CLI tool. Very much like ssh-agent. BTW, with this approach 2nd feature could be nicely implemented using programmable shell completion. Which is of course the proper way of doing this. Also as completing entries' names would be possible you wouldn't need globbing while using your CLI tool interactively. The downside of this approach is that for security you'd have to implement database locking on timeout and other events like the GUI version does. |
Beta Was this translation helpful? Give feedback.
-
Well, yes, technically I could do it. However, from my side, that means parsing text, and seeing all the possible problems and deciding which is which.
I am not sure if you have written CLI completion scripts. Again, it is more complicated to solve externally, than internally.
... and something else I clearly have not thought / cared about. |
Beta Was this translation helpful? Give feedback.
-
It's not that hard. You just reprint whatever comes out of keepassxc-cli's stderr. There's no way you can handle an error anyway. You just tell about it and break.
Depends on the shell. For instance, fish is not that hard. Anyway, that's how things supposed to work by design. No one actually expects a CLI program to behave the way you suggest. And I don't think working in a shell productively is possible without completion for the tools one uses frequently.
I agree, that's something I'd appreciate keepassxc-cli having out-of-box. Actually, even having a CLI way to talk to the running GUI app like the browser extension does would be nice. But it's open source and I can't expect someone do this for me so I scratch my own itch. |
Beta Was this translation helpful? Give feedback.
-
I think you are missing a point here (to be fair though, I am not explicitly mentioning): If you do redirection (e.g. the example [4]), then keepassxc's interaction is lost totally. I am guessing I also tried with wrong password, and that was lost too.
I agree with the general premise (CLI completion is necessary). However, programmable shell completion against a locked library? Or will you cache/leak credential "pathnames"? I guess we come from different schools of thought. My idea is that, after arg-parsing
Well, I made the itch disappear: I don't use keepassxc. I merely threw the idea to see if it gains traction / serve as a talking point in streamlining CLI experience. |
Beta Was this translation helpful? Give feedback.
-
@droidmonkey my resolution logic was going like that:
I understand the complexity (Implicit wildcards produces undefined results that are not desirable); you can just make it a default-off option. My argument here goes that "you cannot shell-complete" correct names to provide accurate matches (unless you make a bash-completion script to talk to a GUI-unlocked database somehow), so some flexibility counteracts that limitation. |
Beta Was this translation helpful? Give feedback.
-
Talking to a running GUI instance (like the browser extension does) is not what keepassxc-cli was designed for. It's purpose is being purely CLI frontend. IMO, what should be done is making CLI act as an agent that you start at login, unlock your database, and then other processes talk to it via UNIX socket, for instance. This is what I'm trying to implement currently, a Python wrapper that runs CLI in open mode and accepts commands via UNIX socket. |
Beta Was this translation helpful? Give feedback.
-
My first approach was checking out the browser extension protocol but it looked too complicated. |
Beta Was this translation helpful? Give feedback.
-
If you have code/artifacts that I could look/use, feel free to link them |
Beta Was this translation helpful? Give feedback.
-
It's still an early prototype but sure I'll keep you posted |
Beta Was this translation helpful? Give feedback.
-
Also apparently there's #4513 and https://github.com/Frederick888/git-credential-keepassxc |
Beta Was this translation helpful? Give feedback.
-
Summary
For the simple case of:
Desired Behavior
$@
, so as to not need to remember to escape spaces (e.g. with quotes)entry
. If my entries are:entry with spaces
,foo
,bar
, then this would workSomehow this was never added??
One reason for using the CLI would be that, somehow, a program requiring a password could be taught to use
keepassxc-cli
to obtain it without storing sensitive information in plaintext. I am not an expert, and I cannot argue with the validity / security of the current design / my solution proposal; however, currently, this user case is complicated:What happens from here on, is complicated for two reasons:
In the normal case, not echoing typed characters is okay. With the additional issue of keepassxc not producing any output, this will only confuse an unexpecting user.
My proposal here is:
/dev/tty
", then send all output there, and password-only to stdout.Assuming that
keepassxc-cli show
is the API some program would bind to ask for information, including passwords, then IMHO stdout should be "reserved" for that communication. If that means you would output non-error information on stderr (which, I cannot think of besides the db unlock password prompt), I think it's a contract worth breaking for this case.Possible Solution
Context
CLI tools from GUI should be done as ... CLI-ly as possible. While, it is true, for 3, I could do e.g.
keepassxc-cli locate
followed bykeepassxc-cli show
, it might be more user-friendly to just give me hints, and take hints yourself (i.e. the cli) tooBeta Was this translation helpful? Give feedback.
All reactions