r/Bitwarden • • 2d ago

yabbt: open-source CLI to back up Bitwarden/Vaultwarden and sync one-way to another vault or KeePass

I wrote a small command-line tool for my own setup and just made it open source. Full disclosure: I'm the author, it's free (MIT OR Apache-2.0), and it is not affiliated with Bitwarden.

Here's what it does:

  • Backs up a Bitwarden or Vaultwarden vault, including attachments, through the official bw CLI into one archive (tar + zstd, encrypted with an age passphrase). Weak passphrases are refused.
  • Verifies archives strictly, and can inspect them without showing secrets. A small script unpacks an archive using only standard tools (age, zstd, tar), so you're not locked into yabbt.
  • Diffs a live vault against an archive (counts and IDs only).
  • Restores into Bitwarden/Vaultwarden or a KeePass (.kdbx) file. Dry run by default, and changes only happen with --apply.
  • Syncs one way, e.g. Bitwarden cloud to a self-hosted Vaultwarden, or Bitwarden to a KeePass file as an offline mirror.

Safety was the main focus:

  • Prune is opt-in. It moves items to trash by default and is blocked by a mass-delete guard.
  • An existing archive is never overwritten without --overwrite.
  • A sync only publishes its archive after reading it back and verifying it.
  • Before the first KeePass write of a run, yabbt makes a timestamped .bak. It refuses to save if another program (e.g. KeePassXC) changed the file in the meantime.
  • bw runs with a cleared environment where only allowlisted variables get through, and payloads go via stdin instead of argv.

Status: this is an early 0.x release. Treat it as experimental and keep your own exports until you trust it.

Known limits:

  • The sync source exports the personal vault only.
  • Collection-scoped items block restore for now.
  • KeePass keyfiles aren't supported.
  • The KeePass writer is experimental.

Code and docs: https://github.com/mindrunner/yabbt-rs

Install: cargo install --locked --git https://github.com/mindrunner/yabbt-rs

I'd like to hear about bugs or anything that looks wrong, especially in the restore and sync safety checks.

11 Upvotes

2 comments sorted by

1

u/korjavin 1d ago

Good idea!

1

u/Cute_Area3603 1d ago

for sure, always nice to have more automated backup options