Fully support keepassxc-cli options #1047

Closed
opened 2025-03-27 12:46:04 +00:00 by aledeg · 11 comments

What I'd like to do and why

TL;DR: Add support for --key-file and --yubikey while using keepassxc for credentials


I have my passwords stored in a keepassxc file and I want to use those directly with borgmatic. Unfortunately, I cannot retrieve them since I am using a key file on top of my master password.

I've ran the keepassxc-cli with the --key-file option to validate that I can access my keepassxc file from the command line and it's working fine.
I've ran my borgmatic script with the secret stored in my keepassxc file and it's working fine.
I've checked the keepassxc.py file and I could not find a way to add options while invoking the CLI program.

Is there something I am missing?

I also want to use a yubikey in the future. It would be nice if the --yubikey option is also supported.

Other notes / implementation ideas

No response

### What I'd like to do and why **TL;DR**: Add support for `--key-file` and `--yubikey` while using keepassxc for credentials ----- I have my passwords stored in a keepassxc file and I want to use those directly with borgmatic. Unfortunately, I cannot retrieve them since I am using a key file on top of my master password. I've ran the keepassxc-cli with the `--key-file` option to validate that I can access my keepassxc file from the command line and it's working fine. I've ran my borgmatic script with the secret stored in my keepassxc file and it's working fine. I've checked the keepassxc.py file and I could not find a way to add options while invoking the CLI program. Is there something I am missing? I also want to use a yubikey in the future. It would be nice if the `--yubikey` option is also supported. ### Other notes / implementation ideas _No response_
Owner

Thanks for filing this... These seem like reasonable additions to me! In the meantime, try something like this:

keepassxc:
    keepassxc_cli_command: keepassxc-cli --key-file /path/to/your/keyfile
Thanks for filing this... These seem like reasonable additions to me! In the meantime, try something like this: ```yaml keepassxc: keepassxc_cli_command: keepassxc-cli --key-file /path/to/your/keyfile ```
witten added the good first issue label 2025-03-28 19:51:42 +00:00
Owner

FYI it looks like your email provider is blocking emails from projects.torsion.org, so if you're not receiving ticket notifications, that's why.

FYI it looks like your email provider is blocking emails from projects.torsion.org, so if you're not receiving ticket notifications, that's why.
Author

Thanks for filing this... These seem like reasonable additions to me! In the meantime, try something like this:

keepassxc:
    keepassxc_cli_command: keepassxc-cli --key-file /path/to/your/keyfile

I'll give it a try later. Thank you for considering that.

> Thanks for filing this... These seem like reasonable additions to me! In the meantime, try something like this: > > ```yaml > keepassxc: > keepassxc_cli_command: keepassxc-cli --key-file /path/to/your/keyfile > ``` I'll give it a try later. Thank you for considering that.
Author

Thanks for filing this... These seem like reasonable additions to me! In the meantime, try something like this:

keepassxc:
    keepassxc_cli_command: keepassxc-cli --key-file /path/to/your/keyfile

I've tried that and it does not work. The order of the argument is not render in a way that is understood by the cli tool.
I have something like the following

keepassxc-cli --key-file </path/to/key> show --show-protected --attributes Password </path/to/safe> <attribute>

With this syntax, here is the error generated Invalid command </path/to/key>

> Thanks for filing this... These seem like reasonable additions to me! In the meantime, try something like this: > > ```yaml > keepassxc: > keepassxc_cli_command: keepassxc-cli --key-file /path/to/your/keyfile > ``` I've tried that and it does not work. The order of the argument is not render in a way that is understood by the cli tool. I have something like the following ``` keepassxc-cli --key-file </path/to/key> show --show-protected --attributes Password </path/to/safe> <attribute> ``` With this syntax, here is the error generated `Invalid command </path/to/key>`
Author

FYI it looks like your email provider is blocking emails from projects.torsion.org, so if you're not receiving ticket notifications, that's why.

I know, I've had hard time to validate my email when creating my account.

> FYI it looks like your email provider is blocking emails from projects.torsion.org, so if you're not receiving ticket notifications, that's why. I know, I've had hard time to validate my email when creating my account.
Owner

I've tried that and it does not work. The order of the argument is not render in a way that is understood by the cli tool.

Ah that's unfortunate! I guess this ticket really needs to be implemented for this functionality to work.

> I've tried that and it does not work. The order of the argument is not render in a way that is understood by the cli tool. Ah that's unfortunate! I guess this ticket really needs to be implemented for this functionality to work.
Contributor

I would like to work on this issue!!

I would like to work on this issue!!
Owner

Sounds good! It's hopefully pretty straightforward, but please let me know if you have any questions along the way.

Sounds good! It's hopefully pretty straightforward, but please let me know if you have any questions along the way.
Owner

This is now implemented in main by @gautamaggarwal2810 and will be part of the next release!

This is now implemented in main by @gautamaggarwal2810 and will be part of the next release!
Author

Great! Thank you for that.

Great! Thank you for that.
Owner

Released in borgmatic 2.0.0!

Released in borgmatic 2.0.0!
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#1047