神代綺凛

[fail2ban] 防止SSH暴力破解 一键脚本
因为最近用的比较多,所以还是搬运过来记录一下把,以后也方便找
扫描右侧二维码阅读全文
11
2018/05

[fail2ban] 防止SSH暴力破解 一键脚本

因为最近用的比较多,所以还是搬运过来记录一下把,以后也方便找

Head Pic: 「メカ娘!」/「mamuru」[pixiv]

fail2ban

这个一键脚本可以帮你安装 fail2ban,各位应该都听说过这个程序,可以根据 ssh 登录失败记录来屏蔽某个 IP

功能

  • 自助修改SSH端口
  • 自定义SSH尝试连接次数
  • 自定义最高封禁IP的时间(以小时为单位)
  • 一键完成SSH防止暴力破解

支持

  • Centos 6/7 (x86/x64)
  • Ubuntu 14.04/16.10 (x86/x64)
  • Debian 7/8 (x86/x64)

安装

wget --no-check-certificate https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/fail2ban.sh && bash fail2ban.sh 2>&1 | tee fail2ban.log

第一步:选择是否修改SSH端口。
第二步:输入最多尝试输入SSH连接密码的次数
第三步:输入每个恶意IP的封禁时间(单位:小时)

卸载

wget --no-check-certificate https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/uninstall.sh && bash uninstall.sh

注意事项

  1. 如果你需要更改SSH端口,请记得在防火墙或者安全组中开放新的SSH端口
  2. 安装完成后请会重启SSH服务,请重新连接SSH会话
  3. 若出现SSH无法连接的情况,请检查是否修改过SSH端口,请填写写改后的正确端口进行连接
搬瓦工VPS优惠套餐,建站稳如狗,支持支付宝,循环出账94折优惠码BWH3HYATVBJW
年付$47CN2线路,1核/1G内存/20G硬盘/1T@1Gbps【点击购买
季付$47CN2 GIA线路,1核/1G内存/20G硬盘/1T@2.5Gbps【点击购买
Last modification:May 11th, 2018 at 05:23 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment Cancel reply

3 comments

  1. weeper  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 70.0.3538.110(Google Chrome 70.0.3538.110)
    女Boss,看了一下支付宝红包还剩7.18,三天后过期,于是就付了你7.19。望笑纳
    1. 神代綺凜  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 71.0.3578.80(Google Chrome 71.0.3578.80)
      @weeper 多谢打赏(晚上加鸡腿
  2. 1920987959  Windows 10 x64 Edition(Windows 10 x64 Edition) / Google Chrome 67.0.3396.99(Google Chrome 67.0.3396.99)
    好东西!_(:з」∠)_