CSF –如何限制每个IP地址的连接数

防火墙

ConfigServer安全和防火墙(CSF)配置文件中,更新CT_LIMIT值以限制每个IP地址的连接数。 这是防止某些类型的拒绝服务(DOS)攻击的简单技巧。

注意
要立即停止拒绝服务(DoS)攻击,请阅读此空路由示例。

1. /etc/csf/csf.conf

SSH以root身份进入您的服务器。 编辑/etc/csf/csf.conf文件。

Terminal
$ ssh root@yourserver #login as root

$ vim /etc/csf/csf.conf

2. CT_LIMIT

查找CT_LIMIT并将其更新为150,这意味着如果与服务器的连接总数超过150,则IP地址将被阻止。 保存并退出。

/etc/csf/csf.conf
###############################################################################
# SECTION:Connection Tracking
###############################################################################
# Connection Tracking. This option enables tracking of all connections from IP
# addresses to the server. If the total number of connections is greater than
# this value then the offending IP address is blocked. This can be used to help
# prevent some types of DOS attack.
#
# Care should be taken with this option. It's entirely possible that you will
# see false-positives. Some protocols can be connection hungry, e.g. FTP, IMAPD
# and HTTP so it could be quite easy to trigger, especially with a lot of
# closed connections in TIME_WAIT. However, for a server that is prone to DOS
# attacks this may be very useful. A reasonable setting for this option might
# be around 300.
#
# To disable this feature, set this to 0
CT_LIMIT = "150"

3.重新启动CSF

$ csf -r

参考文献

  1. 什么是Configserver安全和防火墙(CSF)
  2. 使用CSF防火墙的基本DoS / DDoS缓解
  3. 列出连接到服务器的所有IP地址
  4. 如何使用空路由阻止攻击者IP

翻译自: https://mkyong.com/linux/csf-how-to-limit-the-number-of-connections-per-ip-address/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值