From: Vincent Le Gallic Date: Sun, 20 Oct 2013 22:30:41 +0000 (+0200) Subject: Key singing-party \o/ X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=b9f7aecc81d9483c3db2ba49559cdb441ae81e6b;p=scripts-20-100.git Key singing-party \o/ --- diff --git a/import_caff_sigs.sh b/import_caff_sigs.sh new file mode 100755 index 0000000..2028668 --- /dev/null +++ b/import_caff_sigs.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Pour récupérer toutes les signatures des mails dans le dossier +# idoine stocké sur zamok + +# NB : si tu n'as pas "cadre", bah t'es puni, remplace par echo + +# ------- + +# On lance l'agent gpg avec un pinentry commandline +cadre "Starting gpg-agent" +eval $(gpg-agent --daemon --pinentry-program /usr/bin/pinentry-curses) +echo $GPG_AGENT_INFO +agentpid=$(echo $GPG_AGENT_INFO | cut -d: -f 2) + +# On récupère les mails de signatures +where=`mktemp -d` +cadre "Storing mails copied in ${where}" + +scp zamok:~/Mail/.Signatures/cur/*:2,a ${where} + +# On traite les mails un par un +cadre "Decrypting and importing signatures" +for mail in ${where}/*; +do + gpg2 --decrypt ${mail} | gpg2 --import; +done + +# On marque (peut-être) les mails distants comme lus +cadre "Cleaning up" +echo -n "Mark distant e-mails as read ? [Y/n]" +read -r ans +[[ "${ans}" = "n" ]] || [[ "${ans}" = "N" ]] || ssh zamok rename 's/2,a$/2,Sa/' Mail/.Signatures/cur/*:2,a + +# On fait le ménage +echo -n "Remove local tempfolder ? [Y/n]" +read -r ans +[[ "${ans}" = "n" ]] || [[ "${ans}" = "N" ]] || rm -rfv ${where} + +cadre "Sending freshly-signed key to servers" +echo -n "Sure ? [Y/n]" +read -r ans +[[ "${ans}" = "n" ]] || [[ "${ans}" = "N" ]] || gpg --send-keys A94025B0