PGP mail filtering/syncing
My PGP key resides on one single machine, which runs no
services and is mostly offline. Mail is delivered to
another well-connected box. The mailbox format is Maildir.
To decrypt mails I need to transfer the stuff to the
machine with the key.
My .procmailrc
on the connected box:
:0:
* Content-Type: multipart/encrypted;
pgp/
:0 B:
* -----BEGIN PGP MESSAGE-----
pgp/
To sync the files to the secure box, I use
rsync.
The problem is that my mail reader renames the
files in the maildir to store flags like read
,
replied
, so rsync
pulls too
many files. The following script helps:
tmpfile=`mktemp /tmp/mailsync.XXXXXXXX` || exit 1
for i in `find pgp -type f| sed -e 's/:[RSF,0-9]*$//'`; do
echo -n "new/" >> $tmpfile
basename $i >> $tmpfile
done
rsync -zvaubr --exclude-from=$tmpfile mailhost:~/Mail/pgp/ pgp/
rm $tmpfile
[/projects]
permanent link