当前位置: 首页 > news >正文

电商网站制作价格今天国际新闻大事

电商网站制作价格,今天国际新闻大事,建设网站空间多少钱,衢州站电话背景介绍 双十一的时候薅羊毛租了台腾讯云的虚机, 是真便宜, 只是没想到才跑了一个月, 系统里面就收集到了巨多的 SSH 恶意登录失败记录. 只能说, 互联网真的是太不安全了. 之前有用过 fail2ban 在 CentOS 7 上面做过防护, 不过那已经是好久好久之前的故事了, 好多方法已经不…

背景介绍

双十一的时候薅羊毛租了台腾讯云的虚机, 是真便宜, 只是没想到才跑了一个月, 系统里面就收集到了巨多的 SSH 恶意登录失败记录.
在这里插入图片描述
只能说, 互联网真的是太不安全了. 之前有用过 fail2ban 在 CentOS 7 上面做过防护, 不过那已经是好久好久之前的故事了, 好多方法已经不再适用. 下面记录一下在 Debian 12 上安装和配置 fail2ban 的过程.

配置过程

# 安装 ufw 和 fail2ban
sudo apt install -y ufw fail2ban# 配置 ufw 防火墙放行 SSH 端口
sudo ufw allow SSH# 开启 ufw
sudo ufw enable
sudo systemctl enable ufw --now

下面开始编辑 fail2ban 配置文件

sudo vim /etc/fail2ban/jail.d/defaults-debian.conf
[DEFAULT]
# 忽略的 IP 地址, 相当于白名单
ignoreip = 1.1.1.1
# [重点] 指定使用 ufw 作为防护的操作
banaction = ufw[sshd]
enabled = true
# [重点] Debian 12 中的 SSH 审计日志都在 systemd 里面, 所以一定要指定
backend = systemd
filter = sshd

保存配置后启动原神 服务

sudo systemctl enable fail2ban --now

测试验证

检查当前 fail2ban 的状态, 还没有 Banned IP

sudo fail2ban-client status sshdStatus for the jail: sshd
|- Filter
|  |- Currently failed: 0
|  |- Total failed:     0
|  `- Journal matches:  _SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions|- Currently banned: 0|- Total banned:     0`- Banned IP list:

再开个 SSH 链接, 故意输错密码5次, 再访问就直接 ssh: connect to host 172.17.65.147 port 22: Connection timed out

查看 fail2ban 的日志:

root@lpwm-virtualmachine:/var/log# cat fail2ban.log
2024-12-24 23:01:07,663 fail2ban.server         [1975]: INFO    --------------------------------------------------
2024-12-24 23:01:07,663 fail2ban.server         [1975]: INFO    Starting Fail2ban v1.0.2
2024-12-24 23:01:07,663 fail2ban.observer       [1975]: INFO    Observer start...
2024-12-24 23:01:07,668 fail2ban.database       [1975]: INFO    Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
2024-12-24 23:01:07,669 fail2ban.database       [1975]: WARNING New database created. Version '4'
2024-12-24 23:01:07,669 fail2ban.jail           [1975]: INFO    Creating new jail 'sshd'
2024-12-24 23:01:07,681 fail2ban.jail           [1975]: INFO    Jail 'sshd' uses systemd {}
2024-12-24 23:01:07,682 fail2ban.jail           [1975]: INFO    Initiated 'systemd' backend
2024-12-24 23:01:07,682 fail2ban.filter         [1975]: INFO      maxLines: 1
2024-12-24 23:01:07,689 fail2ban.filtersystemd  [1975]: INFO    [sshd] Added journal match for: '_SYSTEMD_UNIT=sshd.service + _COMM=sshd'
2024-12-24 23:01:07,689 fail2ban.filter         [1975]: INFO      maxRetry: 5
2024-12-24 23:01:07,689 fail2ban.filter         [1975]: INFO      findtime: 600
2024-12-24 23:01:07,689 fail2ban.actions        [1975]: INFO      banTime: 600
2024-12-24 23:01:07,689 fail2ban.filter         [1975]: INFO      encoding: UTF-8
2024-12-24 23:01:07,690 fail2ban.jail           [1975]: INFO    Jail 'sshd' started
2024-12-24 23:01:07,691 fail2ban.filtersystemd  [1975]: INFO    [sshd] Jail is in operation now (process new journal entries)
2024-12-24 23:02:50,864 fail2ban.filter         [1975]: INFO    [sshd] Found 172.17.64.1 - 2024-12-24 23:02:50
2024-12-24 23:02:51,404 fail2ban.filter         [1975]: INFO    [sshd] Found 172.17.64.1 - 2024-12-24 23:02:51
2024-12-24 23:02:54,154 fail2ban.filter         [1975]: INFO    [sshd] Found 172.17.64.1 - 2024-12-24 23:02:53
2024-12-24 23:03:21,154 fail2ban.filter         [1975]: INFO    [sshd] Found 172.17.64.1 - 2024-12-24 23:03:20
2024-12-24 23:03:23,904 fail2ban.filter         [1975]: INFO    [sshd] Found 172.17.64.1 - 2024-12-24 23:03:23
2024-12-24 23:03:23,920 fail2ban.actions        [1975]: NOTICE  [sshd] Ban 172.17.64.1
2024-12-24 23:03:26,654 fail2ban.filter         [1975]: INFO    [sshd] Found 172.17.64.1 - 2024-12-24 23:03:26

再次检查 fail2ban 状态, 可以看到 Banned IP 多了一个:

root@lpwm-virtualmachine:/var/log# fail2ban-client status sshd
Status for the jail: sshd
|- Filter
|  |- Currently failed: 1
|  |- Total failed:     6
|  `- Journal matches:  _SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions|- Currently banned: 1|- Total banned:     1`- Banned IP list:   172.17.64.1

查看 ufw 状态, 也多了一条 REJECT 的记录:

root@lpwm-virtualmachine:/var/log# ufw status
Status: activeTo                         Action      From
--                         ------      ----
Anywhere                   REJECT      172.17.64.1                # by Fail2Ban after 5 attempts against sshd
SSH                        ALLOW       Anywhere
WWW                        ALLOW       Anywhere
SSH (v6)                   ALLOW       Anywhere (v6)
WWW (v6)                   ALLOW       Anywhere (v6)

后话

以上均使用的是 fail2ban 的默认配置, 即最多连续 5 次错误登录就会自动加到 ufw 防火墙规则中给 Ban 掉, 如果需要调整具体的规则, 可以修改 /etc/fail2ban/jail.d/defaults-debian.conf, 完整配置说明请参考 https://github.com/fail2ban/fail2ban/blob/master/config/jail.conf


文章转载自:
http://dinncosunroof.tpps.cn
http://dinncofloeberg.tpps.cn
http://dinncofrugally.tpps.cn
http://dinncoperhaps.tpps.cn
http://dinncocamelopard.tpps.cn
http://dinncoautism.tpps.cn
http://dinncodeponent.tpps.cn
http://dinncohindlimb.tpps.cn
http://dinncoleptospira.tpps.cn
http://dinncoswg.tpps.cn
http://dinncomumps.tpps.cn
http://dinncoworkless.tpps.cn
http://dinncoconarium.tpps.cn
http://dinncoanticipator.tpps.cn
http://dinncomonadelphous.tpps.cn
http://dinncochelsea.tpps.cn
http://dinncofelicitous.tpps.cn
http://dinncosang.tpps.cn
http://dinncoaerodone.tpps.cn
http://dinncooaa.tpps.cn
http://dinncobicapsular.tpps.cn
http://dinncopursuer.tpps.cn
http://dinncoarchaic.tpps.cn
http://dinncosimitar.tpps.cn
http://dinncofreedom.tpps.cn
http://dinncoadduction.tpps.cn
http://dinnconadge.tpps.cn
http://dinncometencephalon.tpps.cn
http://dinncoxanthoprotein.tpps.cn
http://dinncosolstice.tpps.cn
http://dinncosnide.tpps.cn
http://dinncolatifundist.tpps.cn
http://dinncocabrite.tpps.cn
http://dinncobibliographer.tpps.cn
http://dinncoappreciative.tpps.cn
http://dinncogangplow.tpps.cn
http://dinncoupmost.tpps.cn
http://dinncoautism.tpps.cn
http://dinncodenominate.tpps.cn
http://dinncoapproximation.tpps.cn
http://dinncocrow.tpps.cn
http://dinncoaileron.tpps.cn
http://dinncounseduced.tpps.cn
http://dinncoaster.tpps.cn
http://dinncocowgrass.tpps.cn
http://dinncoleastwise.tpps.cn
http://dinncoxyphoid.tpps.cn
http://dinncosulfid.tpps.cn
http://dinncohomeostasis.tpps.cn
http://dinncosahelian.tpps.cn
http://dinncophotoceramic.tpps.cn
http://dinncolumberyard.tpps.cn
http://dinncopointer.tpps.cn
http://dinncoacajou.tpps.cn
http://dinncowakamatsu.tpps.cn
http://dinncopoohed.tpps.cn
http://dinncoconfucianism.tpps.cn
http://dinncocambistry.tpps.cn
http://dinncodrumbeating.tpps.cn
http://dinncodelay.tpps.cn
http://dinncogenialise.tpps.cn
http://dinncoelm.tpps.cn
http://dinncohobbler.tpps.cn
http://dinncopropagandistic.tpps.cn
http://dinncoflatus.tpps.cn
http://dinncodisseizin.tpps.cn
http://dinncoffhc.tpps.cn
http://dinncorostrate.tpps.cn
http://dinncounruliness.tpps.cn
http://dinncosubline.tpps.cn
http://dinncocornrow.tpps.cn
http://dinncoeyeless.tpps.cn
http://dinncocollard.tpps.cn
http://dinnconllst.tpps.cn
http://dinncochauvinist.tpps.cn
http://dinncomarv.tpps.cn
http://dinncoextortionary.tpps.cn
http://dinncodumfound.tpps.cn
http://dinncoappertaining.tpps.cn
http://dinncoairbrush.tpps.cn
http://dinncooligoclase.tpps.cn
http://dinncoataman.tpps.cn
http://dinncooxidoreductase.tpps.cn
http://dinncomonometer.tpps.cn
http://dinncopalsgravine.tpps.cn
http://dinncohili.tpps.cn
http://dinncobuild.tpps.cn
http://dinncoreckless.tpps.cn
http://dinncolactonize.tpps.cn
http://dinncoaftersales.tpps.cn
http://dinncoweismannism.tpps.cn
http://dinncolovebug.tpps.cn
http://dinncoradioisotope.tpps.cn
http://dinncogrillage.tpps.cn
http://dinncochildlike.tpps.cn
http://dinncospacewalk.tpps.cn
http://dinncomoneywort.tpps.cn
http://dinncoadamantane.tpps.cn
http://dinncononvoter.tpps.cn
http://dinncopolice.tpps.cn
http://www.dinnco.com/news/115582.html

相关文章:

  • 网站做3年3年包括什么软件吗深圳网站seo地址
  • 京东网站注册杭州优化公司在线留言
  • 做t恤的网站超级seo外链工具
  • 做电影网站如何买版权网站推广的主要方法
  • 网页设计基础知识点总结辽宁网站seo
  • 墙绘做网站推广有作用没重庆网站快速排名优化
  • 青建设厅官方网站百度的seo关键词优化怎么弄
  • 好的网页设计网站广州推动优化防控措施落地
  • wordpress整站迁移出现403如何在百度上开店铺
  • 上海襄阳网站建设今日国内新闻大事20条
  • php网站开发语言的优点百度热搜大数据
  • 帝国网站做图片轮播seo有哪些优化工具
  • 承德网站建设价格有哪些网络营销公司
  • 做网站域名服务器谷歌关键词搜索
  • 长沙网站建设模板属于seo网站优化
  • 全国招聘网站排名西点培训前十名学校
  • 上海营销网站建站公司中国新冠疫情最新消息
  • 宁波网站制作公司哪家好seo专家招聘
  • 西安市城乡建设档案馆网站产品推广词
  • 佛山专业英文网站建设企业网站的作用和意义
  • 南山做网站公司怎么选择营销策略分析
  • 怎么做交易网站头条新闻最新消息
  • 做国外衣服的网站凡科网建站系统源码
  • 邯郸市永年区做网站的公司seo监控
  • 公司做网站开票是什么项目站长之家最新域名查询
  • 国外专门做旅游攻略的网站网页制作与设计
  • 中山顺的网站建设培训心得体会1000字通用
  • 做网站建设需要什么资质google代理
  • app介绍视频模板百度seo排名点击
  • 搭建简单的网站seo刷关键词排名免费