跳转至

UTS Snort规则管理系统设计概要

规则管理

规则交互数据结构设计

数据库设计

针对 snort 规则需要与前端和引擎交互,作为中间管理层,需要设计一套用于双方数据交互与表达合理的数据结构,根据数据结构来进行对应的数据库表字段设计。在本系统中,总共有 7 张表,分别为: rule (规则主表), snort_related (关联规则表), snort_ref (cve 等值的关联表,与 snort 规则中的 reference 字段相关),snort_meta(用于存储 snort 规则中的 metadata 字段相关的值,目前设计用于存储 service 中的应用层协议),snort_port (端口表), snort_ip (ip 表), snort_content (规则内容表) ,其中 rule 为数据库的主表,其余 6 个表为 rule 的关联表。表结构及字段设计如下:

Rule 表结构及字段设计

字段名 类型 备注
id int 规则的主键id
command_id int 监测指令引擎id
related_type str 关联规则类型
domain str 域名
email str 邮箱
invalid_time int 失效时间
effect_time int 生效时间
iscap bool 是否抓包
rule_type str 规则类型
action str 动作
protocols str 协议
sip_flag bool 源ip组取反
sport_flag bool 源端口组取反
dip_flag bool 目的ip组取反
dport_flag bool 目的端口组取反
direction int 方向
desc str 规则描述
msg str 规则名称
sid int 规则id
classtype str 分类类型(逻辑优先级)
flow str 流量方向
imp bool 是否导入
imp_version str 导入版本
active int 规则编译状态
invalid_error str 编译错误原因
enable bool 规则是否启用
ishidden bool 是否隐藏
attack_chain int 攻击链
body_size str http响应大小
snort_no_sid str snort规则不带sid
snort str 下发到引擎的snort规则
attack_result int 研判结果
risk_level int 威胁等级
confidence_level int 置信度
create_time str 规则创建时间
update_time str 规则更新时间
rev int 规则版本号
is_platform bool 是否来源于平台下发
plat_name str 平台名字, 如果是本地为空
字段名 类型 备注
id int 主键id
related_type str 关联类型
rule_type str 值的类型
value str 存储的关联规则的id
rule_id int 关联rule表的id值

Snort_ref 表结构及字段设计

字段名 类型 备注
id int 主键id
rule_type str 规则类型
type str 值类型
value str
rule_id int 关联 rule 表的 id 值

Snort_port 表结构及字段设计

字段名 类型 备注
id int 主键id
port_type str 端口类型
port str 端口值
flag bool 取反
rule_id int 关联rule表的id值

Snort_ip 表结构及字段设计

字段名 类型 备注
id int 主键id
ip_type str IP类型
ip str IP值
flag bool 取反
rule_id int 关联rule表的id值

Snort_meta 表结构及字段设计

字段名 类型 备注
id int 主键id
type str meta类型
value str
rule_id int 关联rule表的id值

Snort_content 表结构及字段设计

字段名 类型 备注
id int 主键id
senum int 规则内容的顺序号
rule_id int 关联rule表的id值
snort_type str 规则类型
rule_type str 内容的类型
content str 规则的内容
encode bool 是否为GBK编码
flag bool 取反
offset int offset
distance int distance
depth int depth
within int within
rawbytes bool 匹配位置
nocase bool 忽略大小写
http_client_body bool 匹配位置
http_cookie bool 匹配位置
http_raw_cookie bool 匹配位置
http_header bool 匹配位置
http_raw_header bool 匹配位置
http_method bool 匹配位置
http_uri bool 匹配位置
http_raw_uri bool 匹配位置
http_stat_code bool 匹配位置
http_stat_msg bool 匹配位置
http_encode bool 匹配位置
dns_query bool 匹配位置
fast_pattern bool 匹配位置
file_data bool 匹配位置
pkt_data bool 匹配位置
referer bool 匹配位置
user_agent bool 匹配位置
host bool 匹配位置
x_forwarded_for bool 匹配位置
pkt_client_data bool 匹配位置
http_client_header bool 匹配位置
http_client_cookie bool 匹配位置
pkt_server_data bool 匹配位置
http_server_header bool 匹配位置
http_server_cookie bool 匹配位置

规则验证

规则分发

安全性