mirror of https://gitlab.com/hp3icc/emq-TE1.git
Update f2b+ufw.sh
This commit is contained in:
parent
ab6db8aa59
commit
26ae76bfbf
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Reference in New Issue