Linux专用服务器安全|用于入侵保护的Snort

在 CentOS / Ubuntu / Debian 上设置和配置 Snort 以扩展入侵检测和 DDoS 保护。

Snort 是一个免费、开源、轻量级的网络入侵检测系统 (NIDS),适用于 Linux 和 Windows专用服务器。Snort 执行协议分析、内容搜索和匹配。这些基本服务有许多用途,包括应用程序感知触发的服务质量,在使用延迟敏感的应用程序时降低批量流量的优先级。

Linux专用服务器安全|用于入侵保护的Snort

该程序还可用于检测探测或 攻击,包括但不限于操作系统指纹尝试、通用网关接口、缓冲区溢出、服务器消息块探测和隐形端口扫描。

本文将概述如何在您的CentOS 专用服务器上安装和配置 Snort 。您可以修改这些说明以相应地在其他发行版上安装 Snort。在本文的最后,我们将引导您完成一些基本的 Snort 命令以帮助您入门。

为 Linux 安装 Snort

安装 yum epel repo:

yum install -y epel-release

安装所需的依赖项:

yum install -y wget gcc flex bison zlib zlib-devel libpcap libpcap-devel pcre pcre-devel tcpdump mysql mysql-server mysql-devel git libtool curl man libdnet libdnet-devel

安装取证工具 repo:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.`uname -m`.rpm

rpm -Uhv rpmforge-release-0.5.3-1.el6.rf.`uname -m`.rpm

百胜安装 centos-release-scl

rpm -Uvh https://forensics.cert.org/cert-forensics-tools-release-el6.rpm

安装 Snort:

yum install –y snort

在 Snort.org 上创建一个帐户并将规则下载到您的专用服务器。

将规则提取到 snort 配置文件夹:

tar -xvf community-rules.tar -C /etc/snort/rules

tar -xvf snortrules-snapshot-2962.tar.gz -C /etc/snort/rules

tar -xvf snortrules-snapshot-2975.tar.gz -C /etc/snort/rules

tar -xvf snortrules-snapshot-2976.tar.gz -C /etc/snort/rules

tar -xvf snortrules-snapshot-2980.tar.gz -C /etc/snort/rules

修复权限:

cd /etc/snort

触摸 /etc/snort/rules/rules/white_list.rules

触摸 /etc/snort/rules/rules/black_list.rules

chown -R 鼻息:鼻息 *

mkdir /usr/local/lib/snort_dynamicrules

编辑 snort 的配置:

因为 /etc/snort/rules/etc/snort.conf

ipvar HOME_NET YOUR_NETWORK_HERE

ipvar EXTERNAL_NET !$HOME_NET

使用以下命令测试配置:

snort -T -i eth0 -u snort -g snort -c /etc/snort/rules/etc/snort.conf

在 init.d 脚本中更改配置:

vim /etc/sysconfig/snort

接口=您的_INTERFACE_HERE

CONF=/etc/snort/rules/etc/snort.conf

开始打鼾:

/etc/init.d/snort 启动

如何安装和配置pullpork

Pulledpork 是一种与 Snort 结合使用的工具,可自动下载最新规则并使您的 Windows 专用服务器与 Snort 保持最新。

安装必要的依赖项:

yum -y install perl-libwww-perl perl-Crypt-SSLeay perl-Archive-Tar

下载并安装pullpork:

wget https://pulledpork.googlecode.com/files/pulledpork-0.7.0.tar.gz

tar -zxf pullpork-0.7.0.tar.gz

cd pullpork-0.7.0

cp pullpork.pl /usr/sbin ; chmod 755 /usr/sbin/pulledpork.pl

cp etc/* /etc/snort/

如何配置pullpork

访问 snort.org 并注册一个帐户以获取您的 oinkcode。

编辑 pullpork 配置文件:

vim / etc /snort/pullpork.conf _

rule_url= https://www.snort.org/reg-rules/|snortrules-snapshot.tar.gz|d30f456401a96924b902ea384d358fcf2290315e

rule_url= https://www.snort.org/reg-rules/|opensource.gz|d30f456401a96924b902ea384d358fcf2290315e

rule_path = / etc /snort/rules/rules/snort.rules

out_path =/ etc /snort/rules/rules

local_rules = / etc /snort/rules/rules/local.rules

sid_msg =/ etc /snort/ sid-msg.map

config_path =/ etc /snort/rules/ etc / snort.conf

发行版= Centos-5-4

snort_control =/ usr /bin/ snort_control

IPRVersion =/ etc /snort/rules/rules/ iplists

运行拉猪肉:

pullpork.pl – vv -c / etc /snort/pullpork.conf -T -l

将 pullpork 添加到 crontab 以每天运行:

01 04 * * * /usr/sbin/pulledpork.pl -c / etc /snort/pulledpork.conf -l

如何在 Linux 上使用 Snort?

Snort 可以配置为三种主要模式:嗅探器、数据包记录器和网络入侵检测。在嗅探器模式下,程序将读取网络数据包并显示在控制台上。在数据包记录器模式下,程序会将数据包记录到磁盘。在入侵检测模式下,程序将监控网络流量并根据用户定义的规则集对其进行分析。然后程序将根据已识别的内容执行特定操作。

Snort 相当容易使用,但有很多命令,而且并不总是清楚哪些选项可以很好地协同工作。以下是一些帮助您入门的示例。

嗅探器模式

将 TCP/IP 数据包头打印到屏幕上:

./打鼾 -v

显示传输中的应用程序数据:

./打鼾 - vd

显示数据链路层标头:

./打鼾 - vde

数据包记录器模式

通过指定日志位置,Snort 将进入数据包记录器模式:

./ snort -dev -l ./log

为了相对于家庭网络进行日志记录,您需要告诉 Snort 哪个网络是家庭网络:

./ snort -dev -l ./log -h 192.168.1.0/24

对于高速和流量网络,建议以二进制模式登录:

./snort -l ./log –b

如果您想通过 Snort 以嗅探器模式运行二进制日志文件以将数据包转储到屏幕:

./ snort -dv -r packet.log

网络入侵检测模式

要启用网络入侵检测 (NIDS) 模式并查看其工作方式:

./ snort -dev -l ./log -h 192.168.1.0/24 -c snort规则.conf

对于长期使用 Snort,请删除 v 和 e 标志以加快操作:

./snort -d -h 192.168.1.0/24 -l ./log -c snort.conf

这些是基本命令。Snort.org 提供了所有可用命令及其用法的详尽汇编。

文章链接: https://www.mfisp.com/10953.html

文章标题:Linux专用服务器安全|用于入侵保护的Snort

文章版权:梦飞科技所发布的内容,部分为原创文章,转载请注明来源,网络转载文章如有侵权请联系我们!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
IDC云库

DDoS安全:DDoS预测工具

2022-10-11 10:26:52

IDC云库

Windows专用服务器安全|用于入侵保护的Snort

2022-10-11 10:43:32

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
客户经理
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索

梦飞科技 - 最新云主机促销服务器租用优惠