如何在 Ubuntu 12.04 上安装 Bro-IDS 2.2

金钱(警告)

** 状态:** 被贬值

如果您目前正在运行运行 Ubuntu 12.04 的服务器,我们强烈建议升级或迁移到支持的 Ubuntu 版本:

** 原因:** Ubuntu 12.04 已于 2017 年 4 月 28 日到期(EOL)并且不再收到安全补丁或更新。

** 相反,请参见:** 本指南可能仍然有用作为参考,但可能不会在其他Ubuntu版本上工作. 如果可用,我们强烈建议使用为您正在使用的Ubuntu版本撰写的指南。

介绍


`Bro最初是由Vern Paxson开发的,他现在继续与位于加州伯克利的国际计算机科学研究所的研究人员和开发人员的核心团队共同领导该项目;以及位于加州阿尔巴纳 - 香槟的国家超级计算应用中心。

Bro 框架与许多传统 IDS 不同,因为它设计的灵活和高效,同时非常具有多种协议的分析器,无论它们运行在哪个端口。Bro-IDS 涵盖了从包裹捕捉、流量检查、流量记录、数据警报和脚本的整个范围。

步骤一:更新 OS


一旦您登录到您的 VPS,您应该通过执行以下命令作为 root 来确保您的 OS 处于最新状态:

1apt-get update && apt-get upgrade

如果内核在此过程中被更新,您应该在继续之前重新启动您的实例。

步骤二:安装依赖性


接下来,我们需要通过执行以下命令作为 root 来安装所需的依赖性,以获取有关 [Required Dependencies] 的更多信息(http://www.bro.org/sphinx/install/install.html# prerequisites)

1apt-get install cmake make gcc g++ flex bison libpcap-dev libgeoip-dev libssl-dev python-dev zlib1g-dev libmagic-dev swig2.0

一些这些包可能已经安装了;但是,列出所有要求并不伤害。 apt-get 将抓住缺少的包并为我们安装它们。

第三步 - 安装 LibGeoIP


Bro 可以利用 GeoIP 库,我们已经在上面安装了它(libgeoip-dev)。 要做到这一点,我们需要在启动 Bro 之前安装 GeoLite 数据库。

安装 GeoIPLite 数据库


1wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
2wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz
3gunzip GeoLiteCity.dat.gz
4gunzip GeoLiteCityv6.dat.gz

接下来,我们需要通过执行以下命令将数据库文件移动到 /usr/share/GeoIP/ 目录:

1mv GeoLiteCity.dat  /usr/share/GeoIP/GeoLiteCity.dat
2mv GeoLiteCityv6.dat /usr/share/GeoIP/GeoLiteCityv6.dat

现在我们需要为 GeoLiteCit.dat 和 GeorLiteCityv6.data 文件创建链接,分别为 GeoIPCity.dat 和 GeoIPCityv6.dat. 如果我们用安装了 LibGeoIP 来构建 Bro,但无法链接文件,我们会在 /nsm/bro/logs/current/stderr.log 中看到以下类型的错误

11392083947.452043 Failed to open GeoIP database: /usr/share/GeoIP/GeoIPCity.dat
21392083947.452043 Fell back to GeoIP Country database
31392083947.452043 Failed to open GeoIP database: /usr/share/GeoIP/GeoIPCityv6.dat

要链接文件,执行以下命令:

1ln -s /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
2ln -s /usr/share/GeoIP/GeoLiteCityv6.dat /usr/share/GeoIP/GeoIPCityv6.dat

步骤四:安装 Bro-IDS


现在我们将下载 bro-ids. 要做到这一点,我们将从源头下载并安装应用程序。

作为 root,我们可以下载和提取 Bro-IDS tarball 用以下命令:

1wget http://www.bro.org/downloads/release/bro-2.2.tar.gz
2tar -xvzf bro-2.2.tar.gz

为了构建应用程序,我们用cd bro-2.2命令更改目录,并通过设置--prefix=选项来设置我们打算安装 Bro-IDS 应用程序的目录。

1cd bro-2.2
2./configure --prefix=/nsm/bro
3make
4make install

没有错误?好吧,现在添加 bro 到您的路径。

1export PATH=/nsm/bro/bin:$PATH

您也可以在您的主目录中添加 PATH=/opt/bro2/bin:$PATH 到您的 ~/.profile 文件,以使更改永久。

配置 Bro-IDS


对于最基本的安装步骤,我们将遵循 项目页面上的文档

使用您最喜欢的编辑器修改以下3个文件:

  • $PREFIX/etc/node.cfg -> 配置网络接口来监控(即接口=eth0)
  • $PREFIX/etc/networks.cfg -> 配置本地网络(即 10.0.0.0/8 私人 IP 空间 )
  • $PREFIX/etc/broctl.cfg -> 更改 MailTo 地址和日志旋转

** 注意** : $PREFIX 用于引用 Bro-IDS 安装根目录,根据您在 ./configure --prefix= 上设置的内容,从上面的示例中取代 $PREFIX/nsm/bro (即 nsm/bro/etc/node.cfg)

设置 node.cfg 文件


假设你的系统是设置一个单一的界面,默认 node.cfg 应该是好的去除可能更改的扫描界面。

 1root@brodemo:/nsm/bro/etc# ifconfig
 2eth0 Link encap:Ethernet HWaddr 04:01:10:15:fa:01  
 3          inet addr:162.243.XXX.XXX Bcast:162.243.XXX.XXX Mask:255.255.255.0
 4          inet6 addr: fe80::601:10ff:fe15:fa01/64 Scope:Link
 5          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 6          RX packets:998663 errors:0 dropped:0 overruns:0 frame:0
 7          TX packets:27341 errors:0 dropped:0 overruns:0 carrier:0
 8          collisions:0 txqueuelen:1000 
 9          RX bytes:130635788 (130.6 MB)  TX bytes:4043010 (4.0 MB)
10
11lo Link encap:Local Loopback  
12          inet addr:127.0.0.1 Mask:255.0.0.0
13          inet6 addr: ::1/128 Scope:Host
14          UP LOOPBACK RUNNING MTU:65536 Metric:1
15          RX packets:2174 errors:0 dropped:0 overruns:0 frame:0
16          TX packets:2174 errors:0 dropped:0 overruns:0 carrier:0
17          collisions:0 txqueuelen:0 
18          RX bytes:114442 (114.4 KB)  TX bytes:114442 (114.4 KB)

从这个例子中我们可以看到,系统有一个界面 eth0 ,默认配置应该是好的,只有以下几行没有评论:

 1root@brodemo:~# cat /nsm/bro/etc/node.cfg 
 2# Example BroControl node configuration.
 3#
 4# This example has a standalone node ready to go except for possibly changing
 5# the sniffing interface.
 6
 7# This is a complete standalone configuration. Most likely you will
 8# only need to change the interface.
 9[bro]
10type=standalone
11host=localhost
12interface=eth0
13
14## Below is an example clustered configuration. If you use this,
15## remove the [bro] node above.
16
17#[manager]
18#type=manager
19#host=host1
20#
21#[proxy-1]
22#type=proxy
23#host=host1
24#
25#[worker-1]
26#type=worker
27#host=host2
28#interface=eth0
29#
30#[worker-2]
31#type=worker
32#host=host3
33#interface=eth0
34#
35#[worker-3]
36#type=worker
37#host=host4
38#interface=eth0

配置 networks.cfg 文件


假设您的系统配置一个网络接口,如上所示 networks.cfg 应该是好的,因为这个文件用于配置本地/私人网络。

1root@brodemo:~# cat /nsm/bro/etc/networks.cfg 
2# List of local networks in CIDR notation, optionally followed by a
3# descriptive tag.
4# For example, "10.0.0.0/8" or "fe80::/64" are valid prefixes.
5
610.0.0.0/8 Private IP space
7192.168.0.0/16 Private IP space

配置 broctl.cfg 文件


在 broctl.cfg 文件中,您可以配置 Bro 和 BroControl 发送的所有电子邮件的收件人地址,以及其他功能中的日志旋转间隔。

步骤五 - 开始 Bro-IDS


接下来,我们需要启动 broctl 壳,从那里您可以执行 bro 命令. 作为 root 类型 broctl,如果您没有设置路径,如上所述,您可以使用执行命令通过其完整路径 /nsm/bro/bin/broctl

1# broctl 
2warning: cannot read '/nsm/bro/spool/broctl.dat' (this is ok on first run)
3
4Welcome to BroControl 1.2
5
6Type "help" for help.
7
8[BroControl] >

首先执行的命令,因为这是一个新的安装,是运行安装,然后我们将运行开始,然后是状态验证 Bro-IDS正在运行

 1[BroControl] > install
 2warning: cannot read '/nsm/bro/spool/broctl.dat' (this is ok on first run)
 3creating policy directories ... done.
 4installing site policies ... done.
 5generating standalone-layout.bro ... done.
 6generating local-networks.bro ... done.
 7generating broctl-config.bro ... done.
 8updating nodes ... done.
 9[BroControl] > start
10starting bro ...
11[BroControl] > status
12Name Type Host Status Pid Peers Started              
13bro standalone localhost running 15837 0 10 Feb 20:57:35  
14[BroControl] >

您现在有 Bro-IDS 在您的系统上运行. 查看 文档页面 有关更多信息。

Article Submitted by: @schwartz1375
Published At
Categories with 技术
Tagged with
comments powered by Disqus