Password management with pass and a Raspberry Pi

Created at 2022-08-28 10:43
Last edited at 2024-10-06 11:51

Requirements

Create a repository on the Pi

git init --bare

First time pass setup

Generate a gpg key:

gpg --full-gen-key

Get the ID of the key:

gpg --list-keys
/home/user/.gnupg/pubring.kbx
-------------------------------------------
pub   rsa3072 2022-08-24 [SC]
      3B45F6I8F73C872F57B227F1232F1A65AC6F5044
uid           [ultimate] user <user@somedomain>
sub   rsa3072 2022-08-24 [E]

Initialize pass:

pass init 3B45F6I8F73C872F57B227F1232F1A65AC6F5044
pass git init
pass git remote add password-store user@ip_addr_of_pi:/path/to/the/repo

Push to the Pi:

pass git push -u --all

Set up pass on a new machince with an already existing repo on the Pi

For easy configuration of gnupg, copy the gnupg directory to the Pi:

scp -rp ~/path/to/gnupg user@ip_addr_of_pi:.gnupg

then it can be pulled to the new machine:

scp -rp user@ip_addr_of_pi:.gnupg ~/path/to/gnupg

clone the pass repository:

git clone user@ip_addr_of_pi:/path/to/passwordstore ~/path/to/passwordstore

Set up Password Store for Android

Export your private key:

gpg --armor --export-secret-keys 3B45F6I8F73C872F57B227F1232F1A65AC6F5044 > gpg-private-key.asc

App settings:

Copy the exported key onto the Android device and import it to OpenKeyChain. In the Password Store app provide the url of the repository on the Pi (e.g. user@ip_addr_of_pi:/path/to/the/repo) and clone with ssh.