Код: Выделить всё
vim /etc/systemd/system/rc-local.service
Код: Выделить всё
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
Код: Выделить всё
vim /etc/rc.local
Код: Выделить всё
#!/bin/sh -e
exit 0
Код: Выделить всё
chmod +x /etc/rc.local
Код: Выделить всё
systemctl enable rc-local
Код: Выделить всё
systemctl start rc-local.service
Код: Выделить всё
sleep 10
/sbin/iptables -t filter -A INPUT -p tcp --destination-port 22 -m state --state NEW -m recent --set --name SSH -j ACCEPT
/sbin/iptables -t filter -A INPUT -p tcp --destination-port 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j LOG --log-prefix "SSH_BRUTFORCE: "
/sbin/iptables -t filter -A INPUT -p tcp --destination-port 22 -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP