Skip to content

Using Browser Integration to connect keepassxc-cli to gui #5069

@bendem

Description

@bendem

Summary

When using the cli, instead of specifying a path and entering your password every single time you interact with a database, connect to the running keepassxc using the browser integration.

Examples

keepassxc-cli show --from-open-databases -a Password 'Production/devops/gitea-production'

# we use ansible-vault to store secrets, passwords are in keepass
ansible-vault show --vault-id gitea-production@kpxc-prod-client some/file.vault
ansible-playbook -l prod \
  --vault-id gitea-production@kpxc-prod-client \
  --vault-id postgres-production@kpxc-prod-client \
  playbooks/gitea/setup.yml
#!/bin/bash

set -euo pipefail
set -x

readonly KP_CLI=${KP_CLI:-"$USERPROFILE/scoop/apps/keepassxc/current/keepassxc-cli.exe"}
readonly KP_ROOT=${KP_ROOT:-'Production/devops/gitea-production'}

"$KP_CLI" show --from-open-databases -a Password "$KP_DATABASE" "$KP_ROOT/$2"

Context

We use ansible and ansible-vaults to encrypt secrets, to unlock those secrets we have a script we give to ansible that fetches passwords from the keepass database. Since the cli touches the database file directly, we have to unlock the database every single time.

I saw the open feature, but this is unusable for vaults since the script is run once per password and even if it worked, it would still require the user to enter their password at least once per run.

Bonus

If all commands support the new option, the complexity of having to maintain a REPL can be entirely removed from the code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions