GithubHelp home page GithubHelp logo

qssec / hades-lite Goto Github PK

View Code? Open in Web Editor NEW
89.0 9.0 28.0 366 KB

Hades-lite 青松云安全开源的一个内核级 Anti-ddos 的驱动程序,轻量且高效,构建高性能代理防御,单机可抵御7Gb DDoS攻击

Home Page: http://www.qssec.com

License: GNU General Public License v3.0

Shell 0.87% C 99.13%
anti-ddos anti-ddos-protection ddos ddos-mitigation ddos-protection

hades-lite's Introduction

Hades-lite

1、技术背景:

分布式拒绝服务 DDoS ,由于攻击简单、容易达到目的、难于防止和追查,逐渐成为常见的攻击方式,其目的是使计算机或网络无法提供正常的服务。随着网络资源的丰富以及带宽的增长,任何人都可能有能力影响网络服务的正常使用。

由于传统x86服务器架构io处理性能问题,导致大流量的ddos攻击发生时,服务处于阻塞或者宕机状态。使得原本通用防护方案的短板凸显出来。传统厂商的防护方案在此又显得笨重昂贵,如果能有一种轻量级的方案,并且兼顾下一代防火墙的优势,将会是一种非常好的解决方案。

2、技术原理:

由于ddos flood 流量大部分为异常流量,为减轻内核处理负载,直接将非法流量在驱动层面直接丢弃。驱动按照NUMA 统一map内存表项分配到不通CPU上面,然后将每core对应的内存从NUMA中进行划分。防止remote memory access。

core0 为物理CPU1,core1为物理CPU2,core2为物理CPU3,core3为物理CPU4。服务器将每颗CPU引出的物理内存作为LocalMemory,访问时采用访问本地内存优先的策略,阻止CPU之间交互报文。同时为阻止CPU之间进行报文交互,PCIE Local Node需要将会话进行隔离。NIC侧内核需要将queue与指定的node进行绑定。申请内存做DMA保证内存访问一致性。

image

网卡队列与内核中断绑定: NIC QueueIrq绑定 网卡队列与中断绑定以后能够保证队列的同源同宿,核与核之间并行处理报文。在实际使用时如果出现频繁中断的情况需要加入中断合并处理,减少中断次数。

驱动层面的处理流程如下图: 核心处理模块流程:

image

Tcp流量举例,当发生攻击时首先检测流量是否在白名单中,如果在然后检测是否超时,没有超时的情况放行,对于出机房方向的流量默认放行,置标志位为永久有效。对于没有在白名单,或者受防护主机列表里面的流量,进入下一级防护流程。并记录当前流量属性。作为后续异常报文识别判断依据。

image

白名单超时报文处理:当流表中流量发生超时以后,检测是否还有会话保持,如果超过一定时间没有会话进来则进行老化处理,对于大流量攻击导致的会话表项超载,需要丢弃此会话。 流量整形:对于正常通过防御流程的报文,如果还是超过本地防御阈值的情况,进行流量整形处理,将超过阈值的流量进行丢弃处理,保证不会因为流量过高导致服务器被打挂。

3、 使用说明

A.给内核网卡驱动打补丁,目前适用内核4.4.104版本

patch -p1 < ${SRC_DIR}/ixgbe-4.4.104.patch

B.将ddos.c 放入如下内核目录中

/linux/linux/drivers/net/ethernet/intel/ixgbe/

C.编译内核

4、物理环境及性能

CPU :4 cores , Memery:16G , NIC:Intel 82599 10G

Performance :64bit 7G

hades-lite's People

Contributors

ssapym avatar sundw2015 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hades-lite's Issues

dpdk

这是满足考核要求开源出来的吧?
连dpdk都没用到,纯阉割版吧?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.