summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/monkeysphere-host22
-rwxr-xr-xsrc/subcommands/mh/gen-key6
-rwxr-xr-xsrc/subcommands/mh/import-key7
3 files changed, 7 insertions, 28 deletions
diff --git a/src/monkeysphere-host b/src/monkeysphere-host
index 5c97aa6..19ab5fc 100755
--- a/src/monkeysphere-host
+++ b/src/monkeysphere-host
@@ -53,12 +53,10 @@ subcommands:
publish-key (p) publish server host key to keyserver
expert
- import-key (i) import existing ssh key to gpg
- --hostname (-h) NAME[:PORT] hostname for key user ID
+ import-key (i) NAME[:PORT] import existing ssh key to gpg
--keyfile (-f) FILE key file to import
--expire (-e) EXPIRE date to expire
- gen-key (g) generate gpg key for the host
- --hostname (-h) NAME[:PORT] hostname for key user ID
+ gen-key (g) NAME[:PORT] generate gpg key for the host
--length (-l) BITS key length in bits (2048)
--expire (-e) EXPIRE date to expire
--revoker (-r) FINGERPRINT add a revoker
@@ -105,16 +103,6 @@ gpg_host() {
return "$returnCode"
}
-# check if user is root
-is_root() {
- [ $(id -u 2>/dev/null) = '0' ]
-}
-
-# check that user is root, for functions that require root access
-check_user() {
- is_root || failure "You must be root to run this command."
-}
-
# output just key fingerprint
fingerprint_server_key() {
# set the pipefail option so functions fails if can't read sec key
@@ -181,37 +169,31 @@ case $COMMAND in
;;
'extend-key'|'e')
- check_user
check_host_keyring
extend_key "$@"
;;
'add-hostname'|'add-name'|'n+')
- check_user
check_host_keyring
add_hostname "$@"
;;
'revoke-hostname'|'revoke-name'|'n-')
- check_user
check_host_keyring
revoke_hostname "$@"
;;
'add-revoker'|'o')
- check_user
check_host_keyring
add_revoker "$@"
;;
'revoke-key'|'r')
- check_user
check_host_keyring
revoke_key "$@"
;;
'publish-key'|'publish'|'p')
- check_user
check_host_keyring
publish_server_key
;;
diff --git a/src/subcommands/mh/gen-key b/src/subcommands/mh/gen-key
index 37469c7..554c04c 100755
--- a/src/subcommands/mh/gen-key
+++ b/src/subcommands/mh/gen-key
@@ -28,10 +28,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
@@ -49,6 +45,8 @@ while true ; do
failure "Unknown option '$1'.
Type '$PGRM help' for usage."
fi
+ hostName="$1"
+ shift;
break
;;
esac
diff --git a/src/subcommands/mh/import-key b/src/subcommands/mh/import-key
index c33550b..bbeb37f 100755
--- a/src/subcommands/mh/import-key
+++ b/src/subcommands/mh/import-key
@@ -23,10 +23,6 @@ fingerprint_server_key >/dev/null \
# get options
while true ; do
case "$1" in
- -h|--hostname)
- hostName="$2"
- shift 2
- ;;
-f|--keyfile)
keyFile="$2"
shift 2
@@ -40,6 +36,9 @@ while true ; do
failure "Unknown option '$1'.
Type '$PGRM help' for usage."
fi
+ hostName="$1"
+ shift
+ ;;
break
;;
esac