diff options
author | Jameson Graef Rollins <jrollins@finestructure.net> | 2009-02-21 15:37:30 -0500 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@finestructure.net> | 2009-02-21 15:37:30 -0500 |
commit | bb8f498db80efcfffdf60ef317254d7355ea54ef (patch) | |
tree | ac8cafd6ac23f1f0a69fa5bb667a40e900681c4d /src/share/mh/import_key | |
parent | dbb8acd9a45eb2b9f3f412b98d6a777d39b368ac (diff) |
import-key now requires a hostname be specified, and no longer does
any hostname guessing. this is so that we don't have to worry about
prompting the user when guessing the hostname. also updated
documentation.
Diffstat (limited to 'src/share/mh/import_key')
-rw-r--r-- | src/share/mh/import_key | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/src/share/mh/import_key b/src/share/mh/import_key index c545388..f7c69c3 100644 --- a/src/share/mh/import_key +++ b/src/share/mh/import_key @@ -26,39 +26,13 @@ if [ -z "$sshKeyFile" ] ; then failure "Must specify ssh key file to import, or specify '-' for stdin." fi -# use the default hostname if not specified +# fail if hostname not specified if [ -z "$hostName" ] ; then - hostName=$(hostname -f) || failure "Could not determine hostname." - # test that the domain is not obviously illegitimate - domain=${foo##*.} - case $domain in - 'local'|'localdomain') - failure "Host domain '$domain' is not legitimate. Aborting key import." - ;; - esac - # test that there are at least two parts - if (( $(echo "$hostName" | tr . ' ' | wc -w) < 2 )) ; then - failure "Host name '$hostName' is not legitimate. Aborting key import." - fi + failure "You must specify a fully-qualified domain name for use in the host certificate user ID." fi userID="ssh://${hostName}" -if [ "$PROMPT" = "true" ] ; then - cat <<EOF -The ssh key will be imported and an OpenPGP certificate for this host -will be generated with the following user ID: - $userID -EOF - read -p "Are you sure you would like to create certificate? [Y/n] " OK; OK=${OK:-Y} - if [ "${OK/y/Y}" != 'Y' ] ; then - failure "ssh key not imported." - fi -else - log debug "importing key without prompting." -fi - - # create host home mkdir -p "${MHDATADIR}" mkdir -p "${GNUPGHOME_HOST}" |