2020-06-08 18:59:06 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-06-25 10:27:14 +00:00
|
|
|
if [ -z "$1" ] ; then
|
|
|
|
echo "error: must specify configuration file to use"
|
2020-06-12 22:41:13 +00:00
|
|
|
exit 5
|
|
|
|
fi
|
|
|
|
|
2020-06-25 10:27:14 +00:00
|
|
|
. ./"$1"
|
|
|
|
|
|
|
|
ssh -T $ssh << EOSSH
|
2020-06-12 22:41:13 +00:00
|
|
|
|
2020-06-13 10:21:55 +00:00
|
|
|
apt update || exit 5
|
2020-06-08 21:32:05 +00:00
|
|
|
apt upgrade -y || exit 10
|
|
|
|
apt install -y tmux ufw curl || exit 15
|
2020-06-08 19:20:39 +00:00
|
|
|
|
2020-06-08 20:42:47 +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-06-08 19:20:39 +00:00
|
|
|
ufw allow ssh || exit 20
|
2020-06-08 20:17:30 +00:00
|
|
|
yes | ufw enable
|
2020-06-08 20:42:47 +00:00
|
|
|
|
2020-06-12 22:41:13 +00:00
|
|
|
EOSSH
|