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 "$GNUPGHOME_HOST"
28 chmod 700 "$GNUPGHOME_HOST"
30 log verbose "importing ssh key..."
31 # translate ssh key to a private key
32 PEM2OPENPGP_USAGE_FLAGS=authenticate pem2openpgp "$userID" <"$keyFile" \
35 # load the new host fpr into the fpr variable
36 load_fingerprint_secret
38 # export the host public key to the monkeysphere ssh pub key file
39 log debug "creating ssh public key file..."
40 ssh-keygen -y -f "$keyFile" > "$HOST_KEY_PUB"
41 log info "SSH host public key file: $HOST_KEY_PUB"
43 # export to gpg public key to file
46 # show info about new key