配置fail2ban防止ssh暴力破解
dnf install fail2ban -y
cd /etc/fail2ban/jail.d/
#在jail.d目录下更改现有文件的文件名,让fail2ban使用iptables
mv 00-firewalld.conf 00-firewalld.disable
#在jail.d目录下创建sshd服务的配置文件
vim sshd.local

#文件内容如下
[DEFAULT]
ignoreip = 127.0.0.1/8
bantime = 30m                  #IP禁止访问时间
findtime = 60                  #密码输入时阿限制
maxretry = 5                    #最大错误次数
backend = auto
action = %(action_mw)s
[sshd]
enabled = true
port = 22                       #ssh端口号

#重启fail2ban服务
systemctl restart fail2ban.service

测试
通过另一台服务器ssh已配置fail2ban的服务器并输入错误密码5次

file

在fail2ban服务器查看iptables策略

iptables -vnL

file

配置fail2ban防止ssh暴力破解
https://www.linuxstudynotes.com/2023/05/11/ssh/%e9%85%8d%e7%bd%aefail2ban%e9%98%b2%e6%ad%a2ssh%e6%9a%b4%e5%8a%9b%e7%a0%b4%e8%a7%a3/
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇