Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: provide password via environment variable #3934

Closed
NautiluX opened this issue Nov 26, 2019 · 7 comments
Closed

CLI: provide password via environment variable #3934

NautiluX opened this issue Nov 26, 2019 · 7 comments

Comments

@NautiluX
Copy link

Use environment variable to unlock database

Summary

Currently, when using keepassxc-cli in scripts multiple times, I have to enter the password each time. I see that a cache as mentioned in this issue would mean a huge refactoring.

As a first easier step, I would like to be able to provide the password in an environment variable, so I can read it once at the beginning of my script and keepassxc-cli automatically uses it if the variable is set (guess that would be somewhere here).
I thought about implementing it right away, but I'd like to open a discussion around naming and usefulness.

Desired Behavior

Possible Solution

read environment variable (proposal: KEEPASS_DB_PASSWORD) here and use it to unlock database if set. If not, ask as before

Context

I want to execute multiple keepassxc-cli commands in one script without entering the password multiple times.

@droidmonkey
Copy link
Member

droidmonkey commented Nov 26, 2019

That seems extraordinarily insecure. Just cache the password in a local variable

@NautiluX
Copy link
Author

It's up to the user of it to use it in a secure or unsecure way I'd say. I don't see an issue in reading the password from CLI and use it in a script, it will only be stored in memory for the runtime of the script.

@droidmonkey
Copy link
Member

We also have a open mode now in 2.5 that keeps the database open

@NautiluX
Copy link
Author

NautiluX commented Nov 26, 2019

sounds nice, can you point me to how to use it? Was looking for something like that, but didn't find anything in the help.

@droidmonkey
Copy link
Member

droidmonkey commented Nov 26, 2019

man keepassxc-cli or add an -h after the command

@dverbeek84
Copy link

For people reading this issue:

echo "passsword" | keepassxc-cli ls vault.kdbx

@dzintars
Copy link

^ Just make sure to clean up the trails. echo is not the safest method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants