2020-09-03 17:07:38 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-09-08 17:59:02 +00:00
|
|
|
# check we have ssh access
|
|
|
|
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
|
|
|
|
|
|
|
|
ssh -T $ssh_root << EOSSH
|
2020-09-03 17:07:38 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-09-04 20:52:31 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2020-09-04 21:24:19 +00:00
|
|
|
echo "Installing packages .."
|
|
|
|
apt-get install -qq -y ufw || (echo "ERROR while installing ufw" ; exit 15)
|
|
|
|
echo "Packages installed"
|
2020-09-03 17:07:38 +00:00
|
|
|
|
|
|
|
ufw allow ssh || (echo "Error while configuring ufw to allow ssh" ; exit 20 )
|
|
|
|
yes | ufw enable
|
|
|
|
|
|
|
|
EOSSH
|