Snort - manual 笔记(二)

1.5 Packet Acquisition

Snort 2.9 引入 DAQ 代替直接调用 libpcap .

有两种网卡特性会影响 Snort :

”Large Receive Offload” (LRO) and ”Generic Receive Offload” (GRO)

Snort 建议关闭这两项 ,对于linux系统 执行以下命令行 :

$ ethtool -K eth1 gro off
$ ethtool -K eth1 lro off

1.5.1 Configuration

假设我们没有禁用 static modules 或者改变默认的 DAQ 类型, 我们可以像以前一样使用 interface 运行Snort 中 readback 或者 sniffing. 当然, 也可以通过以下设置选择和配置 DAQ :

必须通过配置文件或者命令行指定好所需要的参数, 否则 -Q 会强制执行 inline, -r 会强制执行 read-file, mode默认为passive.

-省略-

1.5.2 pcap

pcap 是默认的 DAQ. snort 运行任何 w/o DAQ 命令, 都是通过操作 pcap.以下命令是等价的 :

./snort -i <device>
./snort -r <file>
./snort --daq pcap --daq-mode passive -i <device>
./snort --daq pcap --daq-mode read-file -r <file>

可以指定pcap buffer_size :

./snort --daq pcap --daq-var buffer_size=<#bytes>

pcap DAQ 不记录过滤的数据包.

1.5.3 AFPACKET

afpacket 函数类似与 memory mapped pacp DAQ 但是不需要外部依赖库 :

./snort --daq afpacket -i <device>
[--daq-var buffer_size_mb=<#MB>]
[--daq-var debug]

如果在 inline mode 中运行 afpacket, 必须设置一个或多个接口对(interface pairs), 格式如下 :

eth0:eth1

或者:

eth0:eth1::eth2:eth3

afpacket DAQ 默认分配128MB的包内存(packet memory), 可以通过以下配置修改 :

--daq-var buffer_size_mb=<#MB>

注意, 总的内存分配量比这个高, 约165.5MB(较128MB)

1.5.4 NFQ

NFQ 是新的改良的抓包(iptables packets)方式 :

关于 iptables
https://wiki.archlinux.org/index.php/Iptables_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

1.5.5 IPQ

IPQ 是旧的抓包(iptables packets)方式. pre-2.9 可以通过以下命令在build时启用 :

./configure --enable-inline / -DGIDS

通过一下设置启用 :

1.5.6 IPFW

BSD系统可以用IPFW. pre-2.9 可以通过以下命令在build时启用 :

./configure --enable-ipfw / -DGIDS -DIPFW

以下这条命令作废 :

./snort -J <port#>

改为以下命令 :

./snort --daq ipfw [--daq-var port=<port>]
<port> ::= 1..65535; default is 8000

IPFW 只支持ip4 流量

1.5.7 Dump

在 snort 2.9 版本中 dump DAQ 允许尝试多种inline模式特性, 例如 injection 和 normalization.

./snort -i <device> --daq dump
./snort -r <pcap> --daq dump

默认会生成一个文件名为inline-out.pcap的文件, 包括所有snort捕获和生成的包. 也可以自定义名字 :

./snort --daq dump --daq-var file=<name>

因为dump是通过调用pcap daq. 因此也没有计数过滤的包.

注意 dump DAQ 的inline mode 不是真正的 inline mode.此外, 在其他模式中需要用到 pcap DAQ :

./snort -r <pcap> -Q --daq dump --daq-var load-mode=read-file
./snort -i <device> -Q --daq dump --daq-var load-mode=passive

1.5.8 Statistics Changes

The Packet Wire Totals and Action Stats sections of Snort’s output include additional fields:

Filtered count of packets filtered out and not handed to Snort for analysis.
Injected packets Snort generated and sent, e.g. TCP resets.
Allow packets Snort analyzed and did not take action on.
Block packets Snort did not forward, e.g. due to a block rule.
Replace packets Snort modified.
Whitelist packets that caused Snort to allow a flow to pass w/o inspection by any analysis program.
Blacklist packets that caused Snort to block a flow from passing.
Ignore packets that caused Snort to allow a flow to pass w/o inspection by this instance of Snort.
The action stats show ”blocked” packets instead of ”dropped” packets to avoid confusion between dropped packets (those Snort didn’t actually see) and blocked packets (those Snort did not allow to pass).


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值