update
authorMaximilian Wilhelm <max@rfc2324.org>
Fri, 30 Sep 2005 14:56:44 +0000 (14:56 +0000)
committerMaximilian Wilhelm <max@rfc2324.org>
Fri, 30 Sep 2005 14:56:44 +0000 (14:56 +0000)
files/client/ssh-keysync
files/client/ssh-keysync-client.conf

index ca65997..ec2d62e 100755 (executable)
@@ -15,7 +15,6 @@ TMP_DIR="/tmp"
 # 
 CONFIG_FILE="/etc/rbm/ssh-keysync-client.conf"
 
-
 # Check some things
 init()
 {
@@ -37,8 +36,8 @@ die()
 # Check if the config file exist and load options if possbile
 check_config()
 {
-       if [ -f ${CONFIG_FILE} -a -r ${CONFIG_FILE} ]; then
-               if ! source ${CONFIG_FILE}; then
+       if [ -f "${CONFIG_FILE}" -a -r "${CONFIG_FILE}" ]; then
+               if ! source "${CONFIG_FILE}"; then
                        echo "Failed to load config file \"${CONFIG_FILE}\", exiting." >&2
                        exit 1
                fi
@@ -90,29 +89,23 @@ check_server()
 }
 
 
-# Push local keys to the server.
-push()
-{
-       echo "Command not implemented for security reasons."
-       exit 0;
-}
-
-
 # Get global ssh_known_hosts from the server
 pull() {
        [ "${debug}" ] && echo -n "Getting global key file from the server: "
        
        if [ check_server ]; then
-               FILE=`basename ${SERVER_PATH}`
-               TMPFILE=`tempfile -d "${TMP_DIR}" -s '.skeysync'`
-               
-               if wget -q -O ${TMPFILE} http://${SERVER_HOST}/${SERVER_PATH}; then
-                   mv ${TMPFILE} ${LOCAL_FILE}
-                   [ "${debug}" ] && echo "done."
+               FILE=`basename "${SERVER_PATH}"`
+               TMPFILE=`tempfile -d "${TMP_DIR}"`
+
+               if wget -q -O "${TMPFILE}" "http://${SERVER_HOST}/${SERVER_PATH}"; then
+                       mv "${TMPFILE}" "${LOCAL_FILE}"
+                       [ "${debug}" ] && echo "done."
                else
-                   echo "Download failed!" >&2
-                   echo "Check the config file and/or check if the partition where ${TMP_DIR} lives is full." >&2
-                   exit 1
+                       echo "Download failed!" >&2
+                       if [ `df -h /tmp/ | awk ' /^\// { sub ("%",""); print $5 }'` -ge 99 ]; then
+                               echo "/tmp filesystem is full..."
+                       fi
+                       exit 1
                fi
        fi
 }
@@ -134,7 +127,6 @@ help() {
 
     while [ $# -gt 0 ]; do
        case "$1" in
-           -push)              export TASK=push ;;
            -pull)              export TASK=pull ;;
            -q|-quiet)          unset debug ;;
            -configcheck)       export TASK=" ";;
index af2c8b7..69726fc 100644 (file)
@@ -1,8 +1,8 @@
 #
 # /etc/rbm/ssh-keysync-client.conf
 #
-# Maximilian Wilhelm <debian@rfc2324.org>
-#  -- Sat, 25 Dec 2004 00:06:58 +0100
+# Maximilian Wilhelm <max@rfc2324.org>
+#  -- Fri, 30 Sep 2005 16:52:05 +0200
 
 #
 # The hostname or IP of the server can be downloaded (via HTTP)
@@ -13,8 +13,8 @@ SERVER_HOST=""
 #
 # Specify the path to the file on the server
 #
-# SERVER_PATH="ssh/ssh_known_hosts"
-SERVER_PATH=""
+# SERVER_PATH="ssh-keysync/ssh_known_hosts"
+SERVER_PATH="/ssh-keysync/ssh_known_hosts"
 
 #
 # Where to put the downloaded file.