3 ms·
I have a plain-text file storing various important information, amongst it passwords, on an encrypted LUKS volume at a server running in my basement that I can
by c0l0 9y ago
I have a plain-text file storing various important information, amongst it passwords, on an encrypted LUKS volume at a server running in my basement that I can access via SSH from anywhere in the world. The "password manager" for that is a simple bash wrapper around an awk one-liner that's called `secret` and placed in my $PATH.
#!/bin/bash
secrets_source='/home/colo/.path_to_secrets_file'
[[ -z ${1} ]] && {
echo "Missing subject."
exit 1
}
[[ ${1} = -e ]] && exec /usr/bin/vim "${secrets_source}"
exec /usr/bin/awk 'tolower($0) ~ /^= .*'"${1}"'/,/^$/' "${secrets_source}"
The ad-hoc format for records stored in the secrets_source is:
= some identifier
free text
more free text
blah blah foobar
= another identifier
more free text
fizzbuzz
An empty line (or EOF) concludes a record.
`secret <some-regexe>` performs a regex search over all identifiers and prints all matching records found. `secret -e` invokes my editor to add new records/view all records in vim.
If someone were to extend this with GPG, they could have encrypted data at rest while the host is up with the LUKS volume's contained fs mounted. I don't feel a pressing need for that, however.