Fail2ban避免非法登录
yum install fail2ban
nano /etc/fail2ban/jail.conf
# 找到[sshd],增加enable
[sshd]
# To use more aggressive sshd modes set filter parameter "mode" in jail.local:
# normal (default), ddos, extra or aggressive (combines all).
# See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details.
#mode = normal
filter = sshd
port = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s
enabled = true
systemctl start fail2ban
systemctl enable fail2ban
fail2ban-client status sshd
对某个ip取消限制
fail2ban-client set sshd unbanip $ip
查看被限制的ip
fail2ban-client status sshd