X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fmonkeysphere-server;h=6798fab185da534060695843f09efbe12a676c3e;hb=531e08b2394fb7935fdd128f52445e5191c8ca6b;hp=e590f3cdd3469ab0104ce231ff054bed45542d20;hpb=5c3ec72ee2c2f5a0d6d942b0998ba8cc3369f608;p=monkeysphere.git diff --git a/src/monkeysphere-server b/src/monkeysphere-server index e590f3c..6798fab 100755 --- a/src/monkeysphere-server +++ b/src/monkeysphere-server @@ -67,7 +67,7 @@ EOF } su_monkeysphere_user() { - su --preserve-environment "$MONKEYSPHERE_USER" -- -c "$@" + su -m "$MONKEYSPHERE_USER" -c "$@" } # function to interact with the host gnupg keyring @@ -267,7 +267,7 @@ gen_key() { revoker= # get options - TEMP=$(getopt -o e:l:r -l expire:,length:,revoker: -n "$PGRM" -- "$@") + TEMP=$(PATH="/usr/local/bin:$PATH" getopt -o e:l:r -l expire:,length:,revoker: -n "$PGRM" -- "$@") || failure "getopt failed! Does your getopt support GNU-style long options?" if [ $? != 0 ] ; then exit 1 @@ -299,7 +299,7 @@ gen_key() { esac done - hostName=${1:-$(hostname --fqdn)} + hostName=${1:-$(hostname -f)} userID="ssh://${hostName}" # check for presense of key with user ID @@ -545,6 +545,7 @@ publish_server_key() { gpg_authentication "--keyserver $KEYSERVER --send-keys '0x${fingerprint}!'" } + diagnostics() { # * check on the status and validity of the key and public certificates local seckey @@ -566,7 +567,7 @@ diagnostics() { curdate=$(date +%s) # warn when anything is 2 months away from expiration warnwindow='2 months' - warndate=$(date +%s -d "$warnwindow") + warndate=$(advance_date $warnwindow +%s) if ! id monkeysphere >/dev/null ; then echo "! No monkeysphere user found! Please create a monkeysphere system user." @@ -593,7 +594,7 @@ diagnostics() { echo "! Host key is expired." echo " - Recommendation: extend lifetime of key with 'monkeysphere-server extend-key'" elif (( "$expire" < "$warndate" )); then - echo "! Host key expires in less than $warnwindow:" $(date -d "$(( $expire - $curdate )) seconds" +%F) + echo "! Host key expires in less than $warnwindow:" $(advance_date $(( $expire - $curdate )) seconds +%F) echo " - Recommendation: extend lifetime of key with 'monkeysphere-server extend-key'" fi fi @@ -619,7 +620,7 @@ diagnostics() { echo "! User ID '$uid' is expired." # FIXME: recommend a way to resolve this elif (( "$expire" < "$warndate" )); then - echo "! User ID '$uid' expires in less than $warnwindow:" $(date -d "$(( $expire - $curdate )) seconds" +%F) + echo "! User ID '$uid' expires in less than $warnwindow:" $(advance_date $(( $expire - $curdate )) seconds +%F) # FIXME: recommend a way to resolve this fi fi @@ -641,7 +642,7 @@ diagnostics() { if [ ! -s "${VARLIB}/ssh_host_rsa_key" ] ; then echo "! The host key as prepared for SSH (${VARLIB}/ssh_host_rsa_key) is missing or empty." else - if [ $(stat -c '%a' "${VARLIB}/ssh_host_rsa_key") != 600 ] ; then + if [ $(ls -l "${VARLIB}/ssh_host_rsa_key" | cut -f1 -d\ ) != '-rw-------' ] ; then echo "! Permissions seem wrong for ${VARLIB}/ssh_host_rsa_key -- should be 0600." fi @@ -698,7 +699,7 @@ add_certifier() { depth=1 # get options - TEMP=$(getopt -o n:t:d: -l domain:,trust:,depth: -n "$PGRM" -- "$@") + TEMP=$(PATH="/usr/local/bin:$PATH" getopt -o n:t:d: -l domain:,trust:,depth: -n "$PGRM" -- "$@") || failure "getopt failed! Does your getopt support GNU-style long options?" if [ $? != 0 ] ; then exit 1