SOCasS(把SOC当作一种服务)的架构部署和技术漫谈-下
字数 1646 2025-08-22 18:37:21
SOCaaS架构部署与技术实现详解
1. Wazuh整合
1.1 Wazuh概述
Wazuh是一个免费开源的企业级安全监控解决方案,用于威胁检测、完整性监控、事件响应及合规性。
核心组件:
- Wazuh服务端:运行Wazuh manager、API和Filebeat,收集和分析来自agent的数据
- Wazuh agent:在被监控主机上运行,收集系统日志和配置数据,检测入侵和异常情况
1.2 Wazuh安装与配置
1.2.1 Wazuh服务端安装
- 安装Wazuh manager、API和Filebeat
- 配置Filebeat连接到Elasticsearch
cd /etc/filebeat nano filebeat.yml - 设置索引模板并启动服务
filebeat setup --index-management service filebeat start service wazuh-manager start service wazuh-api start
1.2.2 Wazuh agent安装
- 安装agent包
- 检查agent运行状态
1.2.3 Wazuh App与Kibana整合
- 安装与ELK Stack兼容的Wazuh app
cd /usr/share/kibana sudo -u kibana bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.12.2_7.6.1.zip - 增加Kibana heap大小
cat >> /etc/default/kibana << EOF NODE_OPTIONS="--max_old_space_size=2048" EOF - 重启Kibana
systemctl restart kibana
1.3 Agent连接与配置
- 在Wazuh manager上添加agent
/var/ossec/bin/manage_agents - 在agent主机上导入密钥
/var/ossec/bin/manage_agents -i "Your_Secret_key" - 编辑agent配置添加Wazuh server地址
nano /var/ossec/etc/ossec.conf
1.4 Wazuh主动响应
- 定义响应命令(使用firewall-drop.sh脚本)
- 配置OSSEC运行主动响应
<command> <name>firewall-drop</name> <executable>firewall-drop.sh</executable> <expect>srcip</expect> <timeout_allowed>yes</timeout_allowed> </command> <active-response> <command>firewall-drop</command> <location>local</location> <rules_id>5712</rules_id> <timeout>60</timeout> </active-response> - 在agent上启用主动响应
<active-response> <disabled>no</disabled> </active-response>
2. 告警系统
2.1 ElastAlert系统
2.1.1 组件介绍
- Praeco:告警配置界面,支持多种通知方式
- ElastAlert:对Elasticsearch中数据的异常进行告警
- Sigma规则:通用开放的签名格式,用于描述日志事件
2.1.2 安装与配置
-
克隆项目
cd /etc git clone https://github.com/Yelp/elastalert.git git clone https://github.com/ServerCentral/elastalert-server.git git clone https://github.com/ServerCentral/praeco.git -
配置Elastalert
cd /etc/elastalert mkdir rules rule_templates cp config.yaml.example config.yaml nano config.yaml关键配置:
es_host: localhost writeback_index: elastalert_status rules_folder: rules -
安装Python 3.6(如系统使用2.7)
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.6 -
安装依赖和Elastalert
pip install PyYAML==5.1 cd /etc/elastalert pip3 install "setuptools>=11.3" python setup.py install -
创建索引
cd /usr/local/bin/ ./elastalert-create-index
2.1.3 API Server配置
编辑/etc/elastalert-server/config/config.json:
{
"elastalertPath": "/etc/elastalert",
"es_host": "elasticsearch",
"writeback_index": "elastalert_status"
}
2.1.4 Praeco配置
-
修改配置文件
cd /etc/praeco/config nano api.config.json nano elastalert.yml -
安装Praeco
sudo npm install export PRAECO_ELASTICSEARCH=localhost -
复制BaseRule.cfg
cp /etc/praeco/rules/BaseRule.config /etc/elastalert/rules/ -
启动Praeco
npm run serve
2.2 规则创建
2.2.1 使用Praeco界面创建规则
- 在Praeco界面创建规则
- 配置过滤条件和通知方式(如Slack)
- 保存并启用规则
2.2.2 向TheHive发送告警
- 在Praeco中创建规则
- 手动编辑规则文件添加TheHive输出
type: any index: wazuh-alerts-3.x-* alert: - hivealerter hive_connection: hive_host: http://localhost hive_port: 9000 hive_apikey: "your-api-key"
2.3 Sigma工具使用
-
下载Sigma
cd ~ git clone https://github.com/Neo23x0/sigma.git -
使用Sigma创建告警
cd ~/sigma/tools pip3 install -r requirements.txt ./sigmac -t elastalert -c winlogbeat ../rules/windows/builtin/win_user_creation.yml
3. 报告系统
3.1 工具介绍
- VulnWhisperer:漏洞管理工具和报告聚合工具
- Nessus Essentials:免费版漏洞扫描工具
3.2 Nessus安装
-
下载并安装Nessus
dpkg -i Nessus-8.10.0-ubuntu910_amd64.deb /etc/init.d/nessusd start service nessusd start -
访问https://YourServerIp:8834激活Nessus
-
运行首次扫描
3.3 VulnWhisperer安装与配置
-
切换Python版本至2.7
-
克隆并安装VulnWhisperer
cd /etc/ git clone https://github.com/HASecuritySolutions/VulnWhisperer cd VulnWhisperer/ sudo apt-get install zlib1g-dev libxml2-dev libxslt1-dev pip install -r requirements.txt python setup.py install -
配置VulnWhisperer
nano configs/frameworks_example.ini -
设置定时任务
crontab -e添加:
SHELL=/bin/bash * * * * * /usr/local/bin/vuln_whisperer -c /etc/VulnWhisperer/configs/frameworks_example.ini >/dev/null 2>&1 -
导入Elasticsearch模板和Kibana可视化文件
4. 事件管理系统
4.1 TheHive和Cortex安装
使用docker-compose安装:
version: "2"
services:
elasticsearch:
image: elasticsearch:6.8.0
ports:
- "0.0.0.0:9200:9200"
environment:
- http.host=0.0.0.0
- cluster.name=hive
- thread_pool.index.queue_size=100000
- thread_pool.search.queue_size=100000
- thread_pool.bulk.queue_size=100000
ulimits:
nofile:
soft: 65536
hard: 65536
cortex:
image: thehiveproject/cortex:3.0.1
depends_on:
- elasticsearch
ports:
- "0.0.0.0:9001:9001"
thehive:
image: thehiveproject/thehive:3.4.0
depends_on:
- elasticsearch
- cortex
ports:
- "0.0.0.0:9000:9000"
command: --cortex-port 9001
4.2 配置与集成
- 创建application.conf文件配置Cortex集成
- 修改docker-compose.yml添加volume和cortex-key
- 启动容器
sudo sysctl -w vm.max_map_count=524288 docker-compose up
4.3 MISP集成
-
安装MISP
sudo apt-get update -y && sudo apt-get upgrade -y sudo apt-get install mysql-client -y curl https://raw.githubusercontent.com/MISP/MISP/2.4/INSTALL/INSTALL.sh -o misp_install.sh chmod +x misp_install.sh ./misp_install.sh -A -
配置MISP用户和API密钥
-
在Cortex中启用MISP分析器
4.4 事件管理功能
- 事件创建与标签管理
- 任务分配与跟踪
- 可观察对象管理
- 事件模板使用
- 事件关闭与分类
5. 总结
本文详细介绍了SOCaaS架构的完整部署流程,包括Wazuh安全监控、告警系统、报告系统和事件管理系统的安装配置与集成。通过这套系统,可以实现从简单的日志监控到主动响应、漏洞管理和事件处理的完整安全运营流程。