#!/bin/sh ## # Wilfredo Sanchez # # Set up a backup client. ## . "$(dirname "$0")/common.sh"; client_load_config; # # Verify SSH keys are set up # # FIXME: Can we automate this? # if [ ! -f "${client_key_file}" ]; then error "No client private key file: ${client_key_file}"; echo "Contact the backup server administrator to obtain the private key for" echo "this client."; exit 1; else chmod 600 "${client_key_file}"; fi; if [ ! -f "${server_pub_file}" ]; then error "No server public key file: ${server_pub_file}"; echo "Obtaining public key from backup server..."; # Connect via SSH to obtain the server public key. ssh -N \ -o BatchMode="yes" \ -o UserKnownHostsFile="${server_pub_file}" \ -o StrictHostKeyChecking="no" \ "${backup_server}" 2>/dev/null || true; if [ ! -f "${server_pub_file}" ]; then error "Unable to obtain public key from backup server."; exit 1; fi; fi;