Notes on seeking wisdom and crafting software

Bitwarden desktop setup

I migrated my ssh keys to vaultwarden↗ today. Thanks to Johanna for the reminder on not keeping ssh keys on disk↗. Sharing some notes below.

Tools in this post: rbw↗ a command line Bitwarden client, rofi-rbw↗ for autocompletion. Both are in ArchLinux extra repo.

Importing Keys

https://bitwarden.com/help/about-ssh/#import-key-to-bitwarden↗

I rotated bunch of ssh keys and created afresh. To migrate, you’d need an official Bitwarden Client, I did it using the browser extension.

We need to unlock the vault on login, pretty much similar to ssh-agent. Below configuration does ask for a vault unlock once per session.

# Add this to zshrc or equivalent
if command -v rbw &> /dev/null; then
    export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/rbw/ssh-agent-socket"
    [[ -o interactive ]] && { rbw unlocked || rbw unlock }
fi

How to Use

You don’t need to do anything more for git and other cli tools.

For the desktop, I decided to migrate off the Bitwarden extension1 in browser etc to a more streamlined flow with rbw↗. Check it out if you love terminal friendly setups.

The magic comes from rofi-rbw↗. It provides a rofi/dmenu style listing of password entries. And a shortcut to auto fill the username/password anywhere, thanks to xdotool, press Alt+1 it types in the $username<tab>$password!

# i3 keybind to show password listing
bindsym $mod+p exec --no-startup-id rofi-rbw --clear-after 10

Cheers, thanks for reading!

Footnotes

  1. Bitwarden extension contributes ~300M memory usage, almost 50% of my firefox memory usage! ↩