美文网首页
Snort gen-msg.map文件概述

Snort gen-msg.map文件概述

作者: 小天是我见过最单纯善良的人 | 来源:发表于2015-09-07 14:01 被阅读373次

0x00 来源

解压自snort,来自于<解压目录>/etc/
   classification.config
   reference.config
   sid-msg.map
   snort.conf
   threshold.conf
   unicode.map
将这些.conf和.map文件放在/etc/snort 目录下,具体的请看 CentOS6.6下基于snort+barnyard2+base的入侵检测系统的搭建

0x01 作用

# $Id: gen-msg.map,v 1.82 2014/11/24 21:27:46 cwaxman Exp $
# GENERATORS -> msg map
# Format: generatorid || alertid || MSG

1 || 1 || snort general alert
2 || 1 || tag: Tagged Packet
3 || 1 || snort dynamic alert

上面是这个文件的中的开头部分,此文件的作用就是对应gid对应的告警信息,可以类比sid-msg.map的作用。

[root@localhost preproc_rules]# pwd
/etc/snort/preproc_rules
[root@localhost preproc_rules]# ll
total 68
-rw-r--r--. 1 1210 1210 20100 Aug 20 09:48 decoder.rules
-rw-r--r--. 1 1210 1210 41816 Aug 20 09:48 preprocessor.rules
-rw-r--r--. 1 1210 1210  1309 Aug 20 09:48 sensitive-data.rules

查看decoder.rules

[root@localhost preproc_rules]# more decoder.rules | grep "sid:1; gid:1"
alert ( msg:"DECODE_NOT_IPV4_DGRAM"; sid:1; gid:116; rev:1; metadata:rule-type decode; classtype:protocol-command-decode;)
[root@localhost preproc_rules]# more ../gen-msg.map | grep 116
116 || 1 || snort_decoder: WARNING: Not IPv4 datagram

可以看到decoder.rules中的规则中sid:1; gid:116; 的对应到gen-msg.map的告警信息是snort_decoder: WARNING: Not IPv4 datagram。意思是snort_decoder这个解码模块报了Not IPv4 datagram这个告警。这样就可以看到是哪个预处理或者解码模块告警了什么样的问题。
但是还没有搞懂msg和这个告警之间的联系,他不像sid-msg.map里面的告警内容就是规则中写的msg。

0x02 修饰符

用到的修饰符是gid,查看manual看到gid的描述如下,

The gid keyword (generator id) is used to identify what part of Snort generates the event when a particular rule fires.
gid(generator id)修饰符经常是用来确定当一个特定规则告警时,是Snort的哪部产生的这个事件。
For example gid 1 is associated with the rules subsystem and various gids over 100 are designated for specific preprocessors and the decoder.
举个例子,gid为1的时候是规则子系统(也就是snort自由规则和自定义规则),大量的gid是大于100的,这些是被和特定的预处理器和解码器有关。
See etc/generators in the source tree for the current generator ids in use.
没找到etc/generatos
Note that the gid keyword is optional and if it is not specified in a rule, it will default to 1 and the rule will be part of the general rule subsystem.
gid修饰符是可选的,并且当gid并没有在一个规则中出现的时,gid被默认为1,也就是通常规则子系统的一部分。
To avoid potential conflict with gids defined in Snort (that for some reason aren’t noted it etc/generators),it is recommended that values starting at 1,000,000 be used.
为了防止潜在的gid定义冲突,建议使用大于1000000的gid。
For general rule writing, it is not recommended that the gid keyword be used. This option should be used with the sid keyword. (See section 3.4.4) The file etc/gen-msg.map contains contains more information on preprocessor and decoder gids.
通常来讲,不推荐在写规则的时候使用gid。我们更多的使用sid。etc/gen-msg中保存了预处理和解码的gid。
基本不用。

相关文章

网友评论

      本文标题:Snort gen-msg.map文件概述

      本文链接:https://www.haomeiwen.com/subject/perycttx.html