wazuh
从入门到上线
Wazuh 整合 Telegram 告警通知
Wazuh agent 密碼驗證機制
本文档使用 MrDoc 发布
-
+
首页
从入门到上线
# 组件模块 ## 客户端的功能 收集日志和事件日志; 文件和注册表的监控; 运行进程和安装软件的信息收集; 监控系统端口和网络配置; 检测恶意软件; 配置管理和策略监控 检测主机响应 ## 服务端 客户端的服务器注册; 实现客户端的连接服务; 根据各项规则实现事件日志的分析引擎; 提供RESTful API; 实现服务端的群集化; 使用Filebeat将日志文件吐给ES存储 ## Elastic Stack 事件日志的收集存储; 日志的分析和提供搜索功能; 展示和分析事件日志; # 单点部署 ## 端口要求 | Component | Software | Port | Protocol | Purpose | | ------------- | ------------- | ----------------------------------- | -------------------- | --------------------------- | | Wazuh server | Wazuh manager | 1514 | TCP (default) | Agents connection service | | | | 1514 | UDP | Agents connection service | | | | 1515 | TCP | Agents registration service | | | | 1516 | TCP | Wazuh cluster daemon | | Wazuh API | | 55000 | TCP | Wazuh RESTful API | | Elastic Stack | Elasticsearch | 9200 | TCP | Elasticsearch RESTful API | | 9300-9400 | TCP | Elasticsearch cluster communication | 9300-9400 | TCP | | Kibana | 5601 | TCP | Kibana web interface | Kibana | # 邮件告警 ``` # 开启全局邮件通知 # Wazuh本身没有邮件功能,它依赖系统的邮件投递 <global> <email_notification>yes</email_notification> <email_to>sujx@live.cn</email_to> <smtp_server>exmail.qq.com</smtp_server> <email_from>i@sujx.net</email_from> <email_maxperhour>12</email_maxperhour> </global> # 定义邮件告警级别,设定事件级别>=12级即发送邮件告警 <alerts> <log_alert_level>3</log_alert_level> <email_alert_level>12</email_alert_level> </alerts> # 定义每日高危漏洞通知(>=13级漏洞) <reports> <level>13</level> <title>Daily report: Alerts with level higher than 13</title> <email_to>sujx@live.cn</email_to> </reports> # 强制发送告警邮件,即不管上述如何设定一定要发邮件告警,是配置在rule上,而不是全局conf中 <rule id="502" level="3"> <if_sid>500</if_sid> <options>alert_by_email</options> <match>Ossec started</match> <description>Ossec server started.</description> </rule> ``` # 邮件投递 ``` yum install -y mailx # 使用mailx发送内部邮件 cat >> /etc/mail.rc<<EOF # 设定内部匿名邮件服务器 set smtp=smtp.example.com EOF # 使用公共邮箱发送邮件 yum install -y postfix mailx cyrus-sasl cyrus-sasl-plain # 建立邮件中继 cat >> /etc/postfix/main.cf<<EOF relayhost = [smtp.exmail.qq.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt smtp_use_tls = yes EOF # 设定使用i@sujx.net发送邮件给指定接收方 echo [smtp.exmail.qq.com]:587 i@sujx.net:PASSWORD > /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd chmod 400 /etc/postfix/sasl_passwd chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db # 重置服务 systemctl reload postfix # 邮件测试 echo "Test mail from postfix" | mail -s "Test Postfix" -r "i@sujx.net" sujx@live.cn # 邮件告警 Wazuh Notification. 2021 Jul 03 23:21:09 Received From: (server002.sujx.net) any->syscheck Rule: 550 fired (level 7) -> "Integrity checksum changed." Portion of the log(s): File '/etc/sysconfig/iptables.save' modified Mode: scheduled Changed attributes: mtime,md5,sha1,sha256 ………… --END OF NOTIFICATION # 邮件报告 Report 'Daily report: Alerts with level higher than 13.' completed. ------------------------------------------------ ->Processed alerts: 481384 ->Post-filtering alerts: 1953 ->First alert: 2021 Jun 29 00:06:08 ->Last alert: 2021 Jun 29 23:59:17 Top entries for 'Level': ------------------------------------------------ Severity 13 |1953 | Top entries for 'Group': ------------------------------------------------ gdpr_IV_35.7.d |1953 | pci_dss_11.2.1 |1953 | pci_dss_11.2.3 |1953 | tsc_CC7.1 |1953 | tsc_CC7.2 |1953 | vulnerability-detector |1953 | Top entries for 'Location': …… ``` # 生成自动化报告 可使用 ossec.conf 文件中的 report 选项来配置您自己的自定义报告 ``` <ossec_config> <reports> <category>syscheck</category> <title>Daily report: File changes</title> <email_to>example@test.com</email_to> </reports> </ossec_config> ``` # 告警级别 | 级别 | 描述 | 告警示例 | | -------- | ---------------------- | ---------------------------------------------------------------------------------- | | Level 0 | 忽略,不会采取任何行动 | 用来避免误报,这里没有安全问题 | | Level 2 | 系统低优先级的通知 | 没有安全相关性的状态消息 | | Level 3 | 成功或授权的事件 | 成功登录,防火墙允许的事件 | | Level 5 | 用户生成的错误 | 密码错误,拒绝操作 | | Level 6 | 低威胁的攻击 | 对系统没有威胁的蠕虫或病毒(例如Linux机器上的Windows蠕虫) | | Level 9 | 来自无效源的错误信息 | 试图以未知用户或无效的来源登录 | | Level 10 | 用户产生重复性的错误 | 多个错误密码,多次登录失败 | | Level 11 | 完整性检查的警告 | 检测到二进制文件被修改或通过rootcheck检测到rootkit存在信息。它们可能表明袭击成功。 | | Level 12 | 重要事件 | 来自系统或内核的错误或告警 | | Level 13 | 异常错误(重要) | 常见的攻击模式,如缓冲区溢出尝试 | | Level 14 | 重要安全事件 | 多个检测规则形成关联结果 | | Level 15 | 严重的攻击成功 | 很少产生误报,发现这个级别的告警需要立即处理 |
admin
2024年5月20日 16:44
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码