SOC-OpenSource第二阶段部署:Snort与Cowrie Honeypot完整安装指南
SOC-OpenSource第二阶段部署:Snort与Cowrie Honeypot完整安装指南
【免费下载链接】SOC-OpenSourceThis is a Project Designed for Security Analysts and all SOC audiences who wants to play with implementation and explore the Modern SOC architecture.项目地址: https://gitcode.com/gh_mirrors/so/SOC-OpenSource
SOC-OpenSource是专为安全分析师和所有SOC受众设计的项目,旨在帮助用户实践和探索现代SOC架构。本文将详细介绍第二阶段部署中Snort入侵检测系统和Cowrie蜜罐的安装步骤,为构建完整的安全运营中心奠定基础。
第二阶段部署架构概览
现代SOC架构需要多种安全组件协同工作,第二阶段部署将重点集成入侵检测与蜜罐系统。以下架构图展示了Snort和Cowrie在SOC环境中的位置与数据流向:
从架构图中可以看到,Snort IDS和Cowrie Honeypot作为日志源,将安全事件数据通过Logstash处理后存储到Elasticsearch,最终在Kibana中进行可视化分析,并与TheHive、Cortex等组件联动实现安全事件响应。
前置准备工作
在开始安装前,请确保已完成第一阶段部署(Elasticsearch、Kibana、TheHive等核心组件)。如果尚未完成,可参考installation/install1.md文档进行第一阶段部署。
环境要求
- 操作系统:推荐Ubuntu 20.04 LTS或更高版本
- 内存:至少4GB RAM(Snort建议8GB以上)
- 存储:至少20GB可用空间
- 网络:具备互联网连接,开放必要端口(Snort需要监听网络接口)
Snort IDS安装与配置
Snort是一款开源的网络入侵检测系统(IDS),能够实时监控网络流量并检测可疑活动。
安装步骤
- 克隆项目仓库获取相关配置文件:
git clone https://gitcode.com/gh_mirrors/so/SOC-OpenSource cd SOC-OpenSource- 按照官方指南安装Snort:
# Ubuntu系统基础依赖安装 sudo apt-get update sudo apt-get install -y build-essential libpcap-dev libpcre3-dev libdnet-dev zlib1g-dev # 下载并安装Snort(具体版本请参考官方最新稳定版) wget https://www.snort.org/downloads/snort/snort-2.9.19.tar.gz tar -xvzf snort-2.9.19.tar.gz cd snort-2.9.19 ./configure --enable-sourcefire make sudo make install- 配置Snort规则集:
# 创建规则目录 sudo mkdir -p /etc/snort/rules sudo cp etc/snort.conf /etc/snort/ # 下载社区规则(需注册Snort账号) wget https://www.snort.org/rules/community -O /etc/snort/rules/community.rules- 验证安装是否成功:
snort -V基本配置
编辑Snort配置文件/etc/snort/snort.conf,设置网络变量和规则路径:
ipvar HOME_NET 192.168.1.0/24 # 设置本地网络 include $RULE_PATH/community.rules # 包含规则文件启动Snort进行数据包捕获:
sudo snort -A console -q -u snort -g snort -c /etc/snort/snort.conf -i eth0Cowrie Honeypot安装与部署
Cowrie是一款中等交互性的SSH和Telnet蜜罐,用于记录攻击者的活动和收集威胁情报。
安装步骤
- 安装必要依赖:
sudo apt-get install -y python3 python3-pip python3-venv git- 克隆Cowrie仓库并创建虚拟环境:
git clone https://github.com/cowrie/cowrie cd cowrie python3 -m venv cowrie-env source cowrie-env/bin/activate pip install -r requirements.txt- 配置Cowrie:
cp cowrie.cfg.dist cowrie.cfg- 编辑配置文件
cowrie.cfg,设置基本参数:
[ssh] enabled = true port = 2222 # 建议使用非标准端口避免冲突 [telnet] enabled = true port = 2323 [output_jsonlog] enabled = true logfile = log/cowrie.json- 启动Cowrie蜜罐:
bin/cowrie start验证部署
检查Cowrie是否正常运行:
bin/cowrie status查看日志确认是否捕获到连接尝试:
tail -f log/cowrie.json组件集成与数据流向
成功安装Snort和Cowrie后,需要将它们集成到SOC架构中,实现安全事件的收集与分析。
数据收集配置
Snort日志集成: 配置Snort将告警日志输出为JSON格式,然后通过Filebeat收集并发送到Elasticsearch:
# 安装Filebeat(参考[installation/beats.md](https://link.gitcode.com/i/9b1fedcdf9b8c21aaf6bfa7d06b3cf2f)) sudo apt-get install filebeat # 配置Filebeat采集Snort日志 sudo vi /etc/filebeat/filebeat.ymlCowrie日志集成: 配置Filebeat监控Cowrie的JSON日志文件:
filebeat.inputs: - type: log paths: - /path/to/cowrie/log/cowrie.json json.keys_under_root: true json.add_error_key: true启动Filebeat服务:
sudo systemctl start filebeat sudo systemctl enable filebeat
测试与验证
Snort测试
使用以下命令生成测试流量,验证Snort是否能正常检测:
# 发送一个包含测试攻击特征的数据包 sudo hping3 -c 1 -d 120 -S -w 64 -p 80 --flood 192.168.1.100在Kibana中查看Snort告警:
- 打开Kibana控制台(http://your-ip:5601)
- 导航到Discover页面
- 搜索
event.module:snort查看相关告警
Cowrie测试
使用SSH连接Cowrie蜜罐测试是否正常工作:
ssh -p 2222 test@your-cowrie-ip # 尝试使用常见用户名密码组合(如root/123456)在Kibana中查看Cowrie日志:
event.module:cowrie常见问题解决
Snort相关问题
问题:Snort启动失败,提示"Fatal Error: /etc/snort/rules/community.rules not found"解决:确保已正确下载规则文件并在snort.conf中正确配置路径
问题:Snort不检测任何流量解决:检查网络接口配置是否正确,确认Snort有足够权限访问网络接口
Cowrie相关问题
问题:无法连接到Cowrie蜜罐解决:检查防火墙设置,确保配置的端口已开放;确认Cowrie服务是否正常运行
问题:Cowrie日志不显示在Kibana中解决:检查Filebeat配置是否正确,查看Filebeat日志排除采集问题
下一步建议
完成第二阶段部署后,您可以继续进行:
- 规则优化:根据实际需求调整Snort规则,减少误报
- 告警联动:配置TheHive与Cortex实现告警自动响应
- 威胁情报集成:参考installation/elastic-edr.md文档集成威胁情报
- 自动化流程:使用Shuffle实现安全事件响应自动化
通过逐步完善SOC架构,您将构建一个功能强大的安全运营中心,有效提升组织的安全防护能力。
【免费下载链接】SOC-OpenSourceThis is a Project Designed for Security Analysts and all SOC audiences who wants to play with implementation and explore the Modern SOC architecture.项目地址: https://gitcode.com/gh_mirrors/so/SOC-OpenSource
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考