[ale] How do you store your passwords?

George Allen glallen01 at gmail.com
Sat Nov 10 12:15:12 EST 2007


On Friday 09 November 2007 15:11:14 Paul Cartwright wrote:
>
> this is like building a new Fort Knox to store my local passwords...
> but seriously is this all command-line STUFF to encrypt/decrypt a file with
> passwords, using your private gpg key?? man gpg doesn't give my much of a
> hint on this..

once you've generated a key and set things up, it's simple...
gpg -e foo.txt
yields foo.txt.gpg
run wipe on foo.txt

and since VIM can support GPG - 
to use/edit - 'vi foo.txt.gpg'

VIM loads it from the encrypted file - decrypts in memory, but only writes to 
the disk encrypted. Here's my setup:

.vimrc: 

" Transparent editing of gpg encrypted files.
" By Wouter Hanegraaff <wouter at blub.net>
augroup encrypted
    au!

    " First make sure nothing is written to ~/.viminfo while editing
    " an encrypted file.
    autocmd BufReadPre,FileReadPre      *.gpg set viminfo=
    " We don't want a swap file, as it writes unencrypted data to disk
    autocmd BufReadPre,FileReadPre      *.gpg set noswapfile
    " Switch to binary mode to read the encrypted file
    autocmd BufReadPre,FileReadPre      *.gpg set bin
    autocmd BufReadPre,FileReadPre      *.gpg let ch_save = &ch|set ch=2
    autocmd BufReadPost,FileReadPost    *.gpg '[,']!gpg --decrypt 2> /dev/null
    " Switch to normal mode for editing
    autocmd BufReadPost,FileReadPost    *.gpg set nobin
    autocmd BufReadPost,FileReadPost    *.gpg let &ch = ch_save|unlet ch_save
    autocmd BufReadPost,FileReadPost    *.gpg execute ":doautocmd 
BufReadPost " . expand("%:r")

    " Convert all text to encrypted text before writing
    autocmd BufWritePre,FileWritePre    
*.gpg   '[,']!gpg --default-recipient-self -ae 2>/dev/null
    " Undo the encryption so we are back in the normal text, directly
    " after the file has been written.
    autocmd BufWritePost,FileWritePost    *.gpg   u
augroup END


.bashrc: 

alias sitelogins='/path/to/sitelogins.txt.gpg'

(sitenote) Although I use kmail for fetching/reading everything - I keep mutt 
around just for ALE and also have:

alias lugmutt='mutt -f ~/Mail/LUG'

which is quite handy.
:)

--George



More information about the Ale mailing list