dev-scripts/dev-production-universal/scripts/debian10/install-base.sh

22 lines
689 B
Bash
Executable File

#!/bin/sh
# check we have ssh access
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
ssh -T $ssh_root << EOSSH
sed -i '/PubkeyAuthentication/c\PubkeyAuthentication yes' /etc/ssh/sshd_config
sed -i '/PasswordAuthentication/c\PasswordAuthentication no' /etc/ssh/sshd_config
sed -i '/PermitRootLogin/c\PermitRootLogin prohibit-password' /etc/ssh/sshd_config
systemctl restart sshd
export DEBIAN_FRONTEND=noninteractive
echo "Installing packages .."
apt-get install -qq -y ufw || (echo "ERROR while installing ufw" ; exit 15)
echo "Packages installed"
ufw allow ssh || (echo "Error while configuring ufw to allow ssh" ; exit 20 )
yes | ufw enable
EOSSH