remove executable bit, remove shebang line, update copyright on subcommands.
[monkeysphere.git] / src / subcommands / mh / gen-key
old mode 100755 (executable)
new mode 100644 (file)
index 37469c7..aad213a
@@ -1,20 +1,22 @@
-#!/usr/bin/env bash
+# -*-shell-script-*-
+# This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
 
 # Monkeysphere host gen-key subcommand
 #
 # The monkeysphere scripts are written by:
-# Jameson Rollins <jrollins@fifthhorseman.net>
+# Jameson Rollins <jrollins@finestructure.net>
 # Jamie McClelland <jm@mayfirst.org>
 # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
 #
-# They are Copyright 2008, and are all released under the GPL, version 3
-# or later.
+# They are Copyright 2008-2009, and are all released under the GPL,
+# version 3 or later.
+
+gen_key() {
 
 local keyType="RSA"
 local keyLength="2048"
 local keyUsage="auth"
 local keyExpire
-local revoker
 local hostName=$(hostname -f)
 local userID
 local keyParameters
@@ -28,10 +30,6 @@ fingerprint_server_key >/dev/null \
 # get options
 while true ; do
        case "$1" in
-           -h|--hostname)
-               hostName="$2"
-               shift 2
-               ;;
            -l|--length)
                keyLength="$2"
                shift 2
@@ -40,15 +38,13 @@ while true ; do
                keyExpire="$2"
                shift 2
                ;;
-           -r|--revoker)
-               revoker="$2"
-               shift 2
-               ;;
            *)
                if [ "$(echo "$1" | cut -c 1)" = '-' ] ; then
                    failure "Unknown option '$1'.
 Type '$PGRM help' for usage."
                fi
+               hostName="$1"
+               shift;
                break
                ;;
        esac
@@ -67,15 +63,6 @@ Key-Usage: $keyUsage
 Name-Real: $userID
 Expire-Date: $keyExpire"
 
-# add the revoker field if specified
-# FIXME: the "1:" below assumes that $REVOKER's key is an RSA key.
-# FIXME: key is marked "sensitive"?  is this appropriate?
-if [ "$revoker" ] ; then
-       keyParameters=\
-"${keyParameters}
-Revoker: 1:${revoker} sensitive"
-fi
-
 echo "The following key parameters will be used for the host private key:"
 echo "$keyParameters"
 
@@ -115,4 +102,6 @@ gpg_authentication "--export-options export-minimal --armor --export 0x${fingerp
 log info "SSH host public key in OpenPGP form: ${SYSDATADIR}/ssh_host_rsa_key.pub.gpg"
 
 # show info about new key
-show_server_key
+show_key
+
+}