2 # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
4 # Monkeysphere host import-key subcommand
6 # The monkeysphere scripts are written by:
7 # Jameson Rollins <jrollins@finestructure.net>
8 # Jamie McClelland <jm@mayfirst.org>
9 # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
11 # They are Copyright 2008-2009 and are all released under the GPL,
23 hostName=${2:-$(hostname -f)}
24 userID="ssh://${hostName}"
27 mkdir -p "${MHDATADIR}"
28 mkdir -p "${MHTMPDIR}"
29 mkdir -p "${GNUPGHOME_HOST}"
30 chmod 700 "${GNUPGHOME_HOST}"
32 log verbose "importing ssh key..."
33 # translate ssh key to a private key
34 PEM2OPENPGP_USAGE_FLAGS=authenticate pem2openpgp "$userID" <"$keyFile" \
37 # load the new host fpr into the fpr variable
38 load_fingerprint_secret
40 # export the host public key to the monkeysphere ssh pub key file
41 log debug "creating ssh public key file..."
42 ssh-keygen -y -f "$keyFile" > "$HOST_KEY_PUB"
43 log info "SSH host public key file: $HOST_KEY_PUB"
45 # export to gpg public key to file
48 # show info about new key