From 2d8ee99393f1a8f81a5d382b8bd54ffbe6d6f9d5 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sat, 31 Aug 2013 13:05:58 +0000 Subject: [PATCH] stop if the machine permits password login; remove testing code --- scripts/start.sh | 14 ++++++++++++++ scripts/system.sh | 3 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 800e26c2..091a4ed0 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,3 +1,16 @@ +# Check system setup. +if grep -q "^PasswordAuthentication yes" /etc/ssh/sshd_config \ + || ! grep -q "^PasswordAuthentication no" /etc/ssh/sshd_config ; then + echo + echo "The SSH server on this machine permits password-based login." + echo "Add your SSH public key to $HOME/.ssh/authorized_keys, check" + echo "check that you can log in without a password, set the option" + echo "'PasswordAuthentication no' in /etc/ssh/sshd_config, and then" + echo "restart the machine." + exit +fi + +# Gather information from the user. if [ -z "$PUBLIC_HOSTNAME" ]; then echo echo "Enter the hostname you want to assign to this machine." @@ -18,6 +31,7 @@ fi if [ -z "$STORAGE_ROOT" ]; then if [ ! -d /home/user-data ]; then useradd -m user-data; fi STORAGE_ROOT=/home/user-data + mkdir -p $STORAGE_ROOT fi . scripts/system.sh diff --git a/scripts/system.sh b/scripts/system.sh index efd2be8d..18ae4a80 100755 --- a/scripts/system.sh +++ b/scripts/system.sh @@ -20,8 +20,5 @@ if [ -z "$DISABLE_FIREWALL" ]; then ufw --force enable; fi -# Mount the storage volume. -export STORAGE_ROOT=/home/ubuntu/storage -mkdir -p storage