From: Jameson Graef Rollins Date: Sun, 25 May 2008 18:49:26 +0000 (-0400) Subject: add new component "howler": small script to generate and publish a gpg X-Git-Tag: monkeysphere_0.1-1~17^2~9 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=03f7058885d83592f3fe4faefc2d3fb148615ec4;p=monkeysphere.git add new component "howler": small script to generate and publish a gpg key for a server --- diff --git a/howler/howler b/howler/howler new file mode 100755 index 0000000..7e33471 --- /dev/null +++ b/howler/howler @@ -0,0 +1,78 @@ +#!/bin/sh + +# howler: server gpg key generator/publisher +# +# Written by +# Jameson Rollins +# +# Copyright 2008, released under the GPL, version 3 or later + +CMD=$(basename $0) + +######################################################################## +# FUNCTIONS +######################################################################## + +failure() { + echo "$1" >&2 + exit ${2:-'1'} +} + +######################################################################## +# MAIN +######################################################################## + +MS_HOME=${MS_HOME:-/etc/monkeysphere} + +. "$MS_HOME"/monkeysphere.conf + +export GNUPGHOME + +KEY_TYPE=${KEY_TYPE:-RSA} +KEY_LENGTH=${KEY_LENGTH:-2048} +KEY_USAGE=${KEY_USAGE:-encrypt,auth} +SERVICE=${SERVICE:-ssh} +HOSTNAME=${HOSTNAME:-$(hostname -f)} + +USERID=${USERID:-"$SERVICE"://"$HOSTNAME"} + +echo "key parameters:" +cat < /dev/null 2>&1 ; then + failure "key for '$USERID' already exists" +fi + +echo "generating server key..." +gpg --batch --gen-key < /dev/null | grep '^pub:' | cut -d: -f5) + +# dummy command so as not to publish fakes keys during testing +# eventually: +#gpg --send-keys --keyserver "$KEYSERVER" "$keyID" +echo "gpg --send-keys --keyserver $KEYSERVER $keyID" + +echo "done."