All Projects → gy-games → shield

gy-games / shield

Licence: other
基于Strom的日志实时流量分析主动防御(CCFirewall)系统

Projects that are alternatives of or similar to shield

xxhadoop
Data Analysis Using Hadoop/Spark/Storm/ElasticSearch/MachineLearning etc. This is My Daily Notes/Code/Demo. Don't fork, Just star !
Stars: ✭ 37 (-45.59%)
Mutual labels:  storm, zookeeper
flume-kafka-storm-drools-example
tech.shuyun.com/?p=356
Stars: ✭ 23 (-66.18%)
Mutual labels:  storm, flume-ng
cloud
云计算之hadoop、hive、hue、oozie、sqoop、hbase、zookeeper环境搭建及配置文件
Stars: ✭ 48 (-29.41%)
Mutual labels:  zookeeper, flume-ng
Bigdata Notes
大数据入门指南 ⭐
Stars: ✭ 10,991 (+16063.24%)
Mutual labels:  storm, zookeeper
Storm
Storm on Mesos!
Stars: ✭ 138 (+102.94%)
Mutual labels:  storm
Syncspout
SyncSpout是用来构造可交互的、同步的Storm拓扑的组件。我们在做实时推荐系统中,希望将Storm的并发性和分布式计算能力应用到“请求-响应”范式中, 比如客户的某次购买行为能够以消息的形式发送到storm拓扑中,storm在指定时间返回推荐结果,也就是说storm需要具有可交互性。基于这样的背景,大数据团队开发了SyncSpout组件, 该组件可以接收客户端异步的消息,经过Storm拓扑异步计算,在指定时间内返回给客户端。
Stars: ✭ 88 (+29.41%)
Mutual labels:  storm
Storm Dynamic Spout
A framework for building spouts for Apache Storm and a Kafka based spout for dynamically skipping messages to be processed later.
Stars: ✭ 40 (-41.18%)
Mutual labels:  storm
Storm Camel Example
Real-time analysis and visualization with Storm-AMQ-Camel-Websockets-Highcharts integration.
Stars: ✭ 28 (-58.82%)
Mutual labels:  storm
Storm Documents
Apache Storm 官方文档译文
Stars: ✭ 227 (+233.82%)
Mutual labels:  storm
Registry
Schema Registry
Stars: ✭ 184 (+170.59%)
Mutual labels:  storm
Streamparse
Run Python in Apache Storm topologies. Pythonic API, CLI tooling, and a topology DSL.
Stars: ✭ 1,445 (+2025%)
Mutual labels:  storm
Straw
A platform for real-time streaming search
Stars: ✭ 98 (+44.12%)
Mutual labels:  storm
Storm Doc Zh
Apache Storm 官方文档中文版
Stars: ✭ 142 (+108.82%)
Mutual labels:  storm
Kafka Study
关于kafka的一些相关使用示例代码。
Stars: ✭ 84 (+23.53%)
Mutual labels:  storm
Recommendsys
推荐项目(实时推荐和离线推荐)
Stars: ✭ 198 (+191.18%)
Mutual labels:  storm
Data Ingestion Platform
Stars: ✭ 39 (-42.65%)
Mutual labels:  storm
Spring Boot 2.x Examples
Spring Boot 2.x code examples
Stars: ✭ 104 (+52.94%)
Mutual labels:  storm
Streamline
StreamLine - Streaming Analytics
Stars: ✭ 151 (+122.06%)
Mutual labels:  storm
Bigdata Notebook
Stars: ✭ 100 (+47.06%)
Mutual labels:  storm
Storm
Simple and powerful toolkit for BoltDB
Stars: ✭ 1,814 (+2567.65%)
Mutual labels:  storm

CC防火墙

简介

CC防火墙的架构采用Flume+Kafka+Strom+Zookeeper+Mysql实现,实现异常IP的及时封停功能

组件

  • Flume :部署在所有的Nginx服务器上,将Nginx日志推送至Kafka中,
  • Kafka : 临时存储Nginx的log数据
  • Strom :从Kafka取数据并进行数据分析
  • Zookeeper :存储CC防火墙的配置文件,并且所有部署在Squid上的客户端也注册在这个Zookeeper上。
  • Agent :部署在每台Squid上,并且信息注册到Zookeeper的临时节点上,接收到封停指令后通过iptables封锁IP。

Strom拓扑

  • KafkaSpOut:进行Kafka数据的读取,这里为了方便与简单,并且保证顺序性Kafka内只是用一个Partion。
  • LogFormatBolt : 收到KafkaSpout读取出的Nginx日志后进行格式化处理,并在此使用纯真库进行IP GEO匹配
  • IpAnalysis : 几乎所有的逻辑都在这里实现,如IP的计数器,报警的匹配等等,为了可以动态调整防火墙的配置,配置文件保存在Zookeeper中,也是在这里Watch Zookeeper的节点,达到动态改变配置的。
  • BlockBolt : 接收到IpAnalysis 发送的信息后,将异常的信息通过Thrift发送给各个Squid机器。
  • UnBlockBolt : 接收到BlockBolt成功封锁后的IP后经过一段时间进行解封。
  • BlockReportBlot : 做数据统计用的,对整体的作用不大
  • xStoreBolt : 数据库存储Bolt,拓扑上的IPStoreBolt,BlockStoreBolt,BlockReportStoreBolt 都是使用的这一个Bolt。

Thrit封存解封接口

service CCfirewall{
	string  blockipbyiptables(1:string mkey,2: string ip)
	string  unblockipbyiptables(1:string mkey,2: string ip)
}

Zookeeper目录

目录树

.
└─ccfirewall
   ├─config                           //存储防火墙配置信息
   └─agent_list                       //存储Agent列表
   		└─iptables                       		//使用iptables封锁的站点
			├─10.0.0.1
			├─10.0.0.1
			├─...

config配置

{
    "count": "50",                            //IP计数个数
    "if_block": "true",                        //是否开启封停
    "if_warning": "false",                    //是否开启警告
    "threshold_w_secound": "10",            //警告阈值秒数
    "threshold_secound": "20",                //封停阈值秒数
    "block_second": "864000",                //封停秒数
    "ip_white_list": [                        //IP白名单
        "127.0.0.1",
        "211.103.231.10"
    ],
    "url_list": [{                            //URL黑名单
        "url": "all",                        //全部
        "type": "normal"                    //normal (精确) 或 after (向后模糊)
    }],
    "special_rule": {                        //特殊规则
        "reg.gyyx.cn/Login/Async": {        //URL
            "threshold_w_secound": "100",    //警告阈值秒数
            "threshold_secound": "300",        //封停阈值秒数
            "block_second": "86400"            //封停秒数
        }
    }
}

数据库模型

Agent

启动Agent

python CCFirewall.py 本机IP

前端

左上方可以设置防火前的配置,保存后实时生效,中上方可以查看当前已经上线的客户端,点击详情可以看到此客户端已经封停的IP格式,右上方可以看到曲线,地图,已经两个计数器信息

左下方显示最新的达到计数器的条目,右下方可以看到异常IP在客户端的封锁状况。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].