Update f2b+ufw.sh

This commit is contained in:
RaspbianProyect by HP3ICC 2023-06-03 07:07:00 +00:00
parent ab6db8aa59
commit 26ae76bfbf
1 changed files with 26 additions and 3 deletions

View File

@ -1,5 +1,4 @@
if systemctl status iptables-persistent |grep active >/dev/null 2>&1
then
sudo systemctl stop iptables-persistent
@ -14,7 +13,19 @@ then
fi
#ufw
sudo apt install ufw -y
apps=("ufw")
for app in "${apps[@]}"
do
# Verificar apps
if ! dpkg -s "$app" >/dev/null 2>&1; then
# app no instalada
sudo apt-get install -y "$app"
else
# app ya instalada
echo "$app ya instalada"
fi
done
sudo ufw allow 22/tcp
sudo ufw default deny incoming
@ -26,7 +37,19 @@ rm /var/log/auth.log
sudo systemctl enable rsyslog
sudo systemctl restart rsyslog
sudo apt install fail2ban -y
apps=("fail2ban")
for app in "${apps[@]}"
do
# Verificar apps
if ! dpkg -s "$app" >/dev/null 2>&1; then
# app no instalada
sudo apt-get install -y "$app"
else
# app ya instalada
echo "$app ya instalada"
fi
done
cat > /etc/fail2ban/jail.local <<- "EOF"
[sshd]