install-aws-server: Stop using ssh -t without a real terminal.

More modern Linux versions like Bionic will block this, and what we
actually want to do is just run the code in our <<EOF block via bash,
so we should do that explicitly.
This commit is contained in:
Tim Abbott 2019-06-13 13:53:17 -07:00
parent e85250941d
commit 2d1c2d4802
1 changed files with 4 additions and 4 deletions

View File

@ -60,13 +60,13 @@ SSH_OPTS=(-o 'HostKeyAlgorithms=ssh-rsa')
set +e
ssh "${SSH_OPTS[@]}" "$server" -t -i "$amazon_key_file" -lubuntu -o "ControlMaster=no" <<EOF
ssh "${SSH_OPTS[@]}" "$server" -i "$amazon_key_file" -lubuntu -o "ControlMaster=no" /bin/bash <<EOF
sudo mkdir -p ~root/.ssh && sudo cp .ssh/authorized_keys /root/.ssh/authorized_keys
sudo sed -i 's/disable_root: true/disable_root: false/' /etc/cloud/cloud.cfg
sudo mkdir -p /etc/zulip
EOF
# shellcheck disable=SC2029 disable=SC2087
ssh "${SSH_OPTS[@]}" "$server" -t -i "$amazon_key_file" -lroot <<EOF
ssh "${SSH_OPTS[@]}" "$server" -i "$amazon_key_file" -lroot /bin/bash <<EOF
# Set the hostname early
echo "$hostname" > /etc/hostname
hostname "$hostname"
@ -84,7 +84,7 @@ if [ -e "$zulipconf_file" ]; then
fi
# shellcheck disable=SC2029 disable=SC2087
ssh "${SSH_OPTS[@]}" "$server" -t -i "$amazon_key_file" -lroot <<EOF
ssh "${SSH_OPTS[@]}" "$server" -i "$amazon_key_file" -lroot /bin/bash <<EOF
set -x
# Finish setting up the SSH private key
chmod 600 /root/.ssh/id_rsa
@ -120,7 +120,7 @@ EOF
scp "${SSH_OPTS[@]}" -i "$amazon_key_file" "$server_private_key_file" root@"$server":/home/zulip/.ssh/id_rsa
scp "${SSH_OPTS[@]}" -i "$amazon_key_file" "$server_private_key_file".pub root@"$server":/home/zulip/.ssh/id_rsa.pub
# shellcheck disable=SC2029
ssh "${SSH_OPTS[@]}" "$server" -t -i "$amazon_key_file" -lroot <<EOF
ssh "${SSH_OPTS[@]}" "$server" -i "$amazon_key_file" -lroot /bin/bash <<EOF
chown zulip:zulip /home/zulip/.ssh/id_rsa*
chmod 600 /home/zulip/.ssh/id_rsa*
EOF