Matano 开源安全数据湖是一个开源的云原生安全数据湖,专为 AWS 上的安全团队构建。
[!NOTE] Matano 提供商业托管式云 SIEM,适用于完整的企业安全运营平台。了解更多。
安装 matano CLI 以将 Matano 部署到您的 AWS 账户中,并管理您的部署。
Linux```bash curl -OL https://github.com/matanolabs/matano/releases/download/nightly/matano-linux-x64.sh chmod +x matano-linux-x64.sh sudo ./matano-linux-x64.sh
**macOS**```bash
curl -OL https://github.com/matanolabs/matano/releases/download/nightly/matano-macos-x64.sh
chmod +x matano-macos-x64.sh
sudo ./matano-macos-x64.sh
要开始使用,运行 matano init 命令。
初始化完成后,你的 Matano 目录 用于控制和管理项目中的所有资源,例如日志源、检测规则及其他配置。其结构如下:```bash ➜ example-matano-dir git:(main) tree ├── detections │ └── aws_root_credentials │ ├── detect.py │ └── detection.yml ├── log_sources │ ├── cloudtrail │ │ ├── log_source.yml │ │ └── tables │ │ └── default.yml │ └── zeek │ ├── log_source.yml │ └── tables │ └── dns.yml ├── matano.config.yml └── matano.context.json
当接入新的日志源或编写检测规则时,从项目中的任何位置运行 `matano deploy` 即可将更改部署到您的账户。
## 🔧 日志转换与数据标准化
[**阅读关于配置自定义日志源的完整文档**](https://www.matano.dev/docs/log-sources/configuration)
[Vector Remap Language (VRL)](https://vector.dev/docs/reference/vrl/) 允许您轻松接入自定义日志源,并鼓励您根据 [Elastic Common Schema (ECS)](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html) 标准化字段,以实现在安全数据湖中增强的数据透视和大批量 IOC 搜索。
用户可以定义自定义 VRL 程序,在日志通过日志源支持的机制(例如 S3、SQS)被摄取时,解析和转换非结构化日志。
VRL 是一种面向表达式的语言,旨在以安全且高效的方式转换可观测性数据(例如日志)。它具有简单的语法和丰富的内置函数,专门针对可观测性用例而设计。
### 示例:解析 JSON
让我们看一个简单的示例。假设您正在处理如下所示的 HTTP 日志事件:```json
{
"line": "{\"status\":200,\"srcIpAddress\":\"1.1.1.1\",\"message\":\"SUCCESS\",\"username\":\"ub40fan4life\"}"
}
您希望对每个事件应用以下更改:
line 字符串解析为 JSON,并将字段展开到顶层srcIpAddress 重命名为 ECS 字段 source.ipusername 字段message 转换为小写将以下 VRL 程序作为 transform 步骤添加到您的日志源中即可完成所有这些操作:
transform: | . = object!(parse_json!(string!(.json.line))) .source.ip = del(.srcIpAddress) del(.username) .message = downcase(string!(.message))
schema: ecs_field_names: - source.ip - http.status
结果事件 🎉:```json
{
"message": "success",
"status": 200,
"source": {
"ip": "1.1.1.1"
}
}
使用检测规则来定义规则,可以在安全日志中实时警报威胁。检测是一个Python程序,它会实时接收来自日志源的数据,并可以创建警报。
def detect(record): return ( record.deepget("event.action") == "CreateInstanceExportTask" and record.deepget("event.provider") == "ec2.amazonaws.com" and record.deepget("event.outcome") == "failure" )
#### 检测所有已配置日志源(例如 Okta、AWS、GWorkspace)中按 IP 的暴力登录尝试
###### detect.py```python
def detect(r):
return (
"authentication" in r.deepget("event.category", [])
and r.deepget("event.outcome") == "failure"
)
def title(r):
return f"Multiple failed logins from {r.deepget('user.full_name')} - {r.deepget('source.ip')}"
def dedupe(r):
return r.deepget("source.ip")
tables:
#### 检测用户从未见过的IP成功登录```python
from detection import remotecache
# a cache of user -> ip[]
user_to_ips = remotecache("user_ip")
def detect(record):
if (
record.deepget("event.action") == "ConsoleLogin" and
record.deepget("event.outcome") == "success"
):
# A unique key on the user name
user = record.deepget("user.name")
existing_ips = user_to_ips[user] or []
updated_ips = user_to_ips.add_to_string_set(
user,
record.deepget("source.ip")
)
# Alert on new IPs
new_ips = set(updated_ips) - set(existing_ips)
if existing_ips and new_ips:
return True
所有告警自动存储在名为 matano_alerts 的 Matano 表中。告警和规则匹配结果已规范化为 ECS,并包含触发规则匹配的原始事件上下文,以及告警和规则数据。
示例查询
汇总上周已激活(超过阈值)的告警```sql select matano.alert.id as alert_id, matano.alert.rule.name as rule_name, max(matano.alert.title) as title, count(*) as match_count, min(matano.alert.first_matched_at) as first_matched_at, max(ts) as last_matched_at, array_distinct(flatten(array_agg(related.ip))) as related_ip, array_distinct(flatten(array_agg(related.user))) as related_user, array_distinct(flatten(array_agg(related.hosts))) as related_hosts, array_distinct(flatten(array_agg(related.hash))) as related_hash from matano_alerts where matano.alert.first_matched_at > (current_timestamp - interval '7' day) and matano.alert.activated = true group by matano.alert.rule.name, matano.alert.id order by last_matched_at desc
#### 发送告警
您可以将告警发送到外部系统。您可以使用告警 SNS 主题将告警发送到电子邮件、Slack 和其他服务。
<div align="center">
<br>
<img src="https://assets.kitploit.com/production/public/readmes/5606/979ffa3a7d4505421e1206b39e30e6e2cd96d47949ae953cdb755f00b64ac86e.png" width="600">
<br>
<i>一个中等级别告警已发送到 Slack</i>
</div>
## ❤️ 社区支持
有关使用的一般帮助,请参阅官方[文档](https://matano.dev/docs)。如需更多帮助,欢迎使用以下渠道提问:
- [Discord](https://discord.gg/YSYfHMbfZQ) \(欢迎加入大家庭,与团队和社区互动\)
- [Forum](https://github.com/matanolabs/matano/discussions) \(关于功能、项目或问题的深度讨论\)
- [GitHub](https://github.com/matanolabs/matano) \(报告错误、贡献代码\)
- [Twitter](https://twitter.com/matanolabs) \(获取最新消息\)
## 👷 贡献者
感谢这些出色的人们([表情符号说明](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/shaeqahmed"><img src="https://assets.kitploit.com/production/public/readmes/5606/da6af7bd665b48461fc19bf8cb33b49258aa7060fc2cb4d3dc143889596acfd0.jpg" width="100px;" alt="Shaeq Ahmed"/><br /><sub><b>Shaeq Ahmed</b></sub></a><br /><a href="#maintenance-shaeqahmed" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.matano.dev/"><img src="https://assets.kitploit.com/production/public/readmes/5606/837b51975f416f31c504d2fe6f14d3a1b1ba787578f6363d666892d745d5d7fc.jpg" width="100px;" alt="Samrose"/><br /><sub><b>Samrose</b></sub></a><br /><a href="#maintenance-Samrose-Ahmed" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kai-ten"><img src="https://assets.kitploit.com/production/public/readmes/5606/a0825103807e9a55e29f2208f6a4b1820214b1ca7000b602bf4895bbeaa50908.jpg" width="100px;" alt="Kai Herrera"/><br /><sub><b>Kai Herrera</b></sub></a><br /><a href="https://github.com/matanolabs/matano/commits?author=kai-ten" title="Code">💻</a> <a href="#ideas-kai-ten" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-kai-ten" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rams3sh"><img src="https://assets.kitploit.com/production/public/readmes/5606/75ea8a3a8b768a26e69217f4700efeea7e56ee99d4273ece2fb757d7d3fd3842.jpg" width="100px;" alt="Ram"/><br /><sub><b>Ram</b></sub></a><br /><a href="https://github.com/matanolabs/matano/issues?q=author%3Arams3sh" title="Bug reports">🐛</a> <a href="#ideas-rams3sh" title="Ideas, Planning, & Feedback">🤔</a> <a href="#userTesting-rams3sh" title="User Testing">📓</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://zbmowrey.com/"><img src="https://assets.kitploit.com/production/public/readmes/5606/3cf4d1cd4dac53a82628dacff2ea9b99505aef82723f4ee6fd4506fd1b63ed48.png" width="100px;" alt="Zach Mowrey"/><br /><sub><b>Zach Mowrey</b></sub></a><br /><a href="#ideas-zbmowrey" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/matanolabs/matano/issues?q=author%3Azbmowrey" title="Bug reports">🐛</a> <a href="#userTesting-zbmowrey" title="User Testing">📓</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/marcin-kwasnicki"><img src="https://assets.kitploit.com/production/public/readmes/5606/8c89eb3f4824adbc668f7e8e8d4714ba6ed7f3e08a9dcdb392335d42d0c5ff3b.png" width="100px;" alt="marcin-kwasnicki"/><br /><sub><b>marcin-kwasnicki</b></sub></a><br /><a href="#userTesting-marcin-kwasnicki" title="User Testing">📓</a> <a href="https://github.com/matanolabs/matano/issues?q=author%3Amarcin-kwasnicki" title="Bug reports">🐛</a> <a href="#ideas-marcin-kwasnicki" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/gdrapp"><img src="https://assets.kitploit.com/production/public/readmes/5606/efef1d590d1f113b3e2f0a59de8d7a5cb67534b61b25f20089688a7ee7533488.png" width="100px;" alt="Greg Rapp"/><br /><sub><b>Greg Rapp</b></sub></a><br /><a href="https://github.com/matanolabs/matano/issues?q=author%3Agdrapp" title="Bug reports">🐛</a> <a href="#ideas-gdrapp" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/niheconomoum"><img src="https://assets.kitploit.com/production/public/readmes/5606/2fbec725261340b771febb64341a3cf224757dec4b630ad3dc264dd2f06b004d.png" width="100px;" alt="Matthew X. Economou"/><br /><sub><b>Matthew X. Economou</b></sub></a><br /><a href="https://github.com/matanolabs/matano/issues?q=author%3Aniheconomoum" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jarretraim"><img src="https://assets.kitploit.com/production/public/readmes/5606/caa7cc87b6164d0f803772fab5bac40a3d997437b6c383919a5e077a466ac334.jpg" width="100px;" alt="Jarret Raim"/><br /><sub><b>Jarret Raim</b></sub></a><br /><a href="https://github.com/matanolabs/matano/issues?q=author%3Ajarretraim" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://mdfranz.dev/"><img src="https://assets.kitploit.com/production/public/readmes/5606/65c31a803bb41772596c3e2daadd6d9a74a678fc1043321ed77883b03a4d7930.jpg" width="100px;" alt="Matt Franz"/><br /><sub><b>Matt Franz</b></sub></a><br /><a href="https://github.com/matanolabs/matano/issues?q=author%3Amdfranz" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/francescofaenzi/"><img src="https://assets.kitploit.com/production/public/readmes/5606/c46cb3d9f09d191e8a3da1732159dd75187435993d87d7c9655e02df9feeb239.jpg" width="100px;" alt="Francesco Faenzi"/><br /><sub><b>Francesco Faenzi</b></sub></a><br /><a href="#ideas-FrancescoFaenzi" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://nishant.daspatnaik.com/"><img src="https://assets.kitploit.com/production/public/readmes/5606/b35b7582c587503707d73914779acb8592fe5eb95535e0c7d823e4cc50e6b097.jpg" width="100px;" alt="Nishant Das Patnaik"/><br /><sub><b>Nishant Das Patnaik</b></sub></a><br /><a href="#ideas-dpnishant" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/timoguin"><img src="https://assets.kitploit.com/production/public/readmes/5606/c4c413260019be4943b6c577c46a587862f553ceda7ef70a8adf3f92c003f523.png" width="100px;" alt="Tim O'Guin"/><br /><sub><b>Tim O'Guin</b></sub></a><br /><a href="#ideas-timoguin" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/matanolabs/matano/issues?q=author%3Atimoguin" title="Bug reports">🐛</a> <a href="https://github.com/matanolabs/matano/commits?author=timoguin" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/francescor"><img src="https://assets.kitploit.com/production/public/readmes/5606/7174ae423e954ecd8be9849969348acd29fc7b8f8ce3d539398669d564d0ee92.jpg" width="100px;" alt="Francesco R."/><br /><sub><b>Francesco R.</b></sub></a><br /><a href="https://github.com/matanolabs/matano/issues?q=author%3Afrancescor" title="Bug reports">🐛</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://grue.io"><img src="https://assets.kitploit.com/production/public/readmes/5606/1d375cb6024264e2e8116b4114d4537734bcca383526d32754e0d8e335641bd3.jpg" width="100px;" alt="Joshua Sorenson"/><br /><sub><b>Joshua Sorenson</b></sub></a><br /><a href="https://github.com/matanolabs/matano/commits?author=grue" title="Code">💻</a> <a href="https://github.com/matanolabs/matano/commits?author=grue" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.nevermind.co.nz"><img src="https://assets.kitploit.com/production/public/readmes/5606/6afd9108528633598c724be40eae37abdde5ea9c89fd498d35c398f98bc4f765.jpg" width="100px;" alt="Chris Smith"/><br /><sub><b>Chris Smith</b></sub></a><br /><a href="https://github.com/matanolabs/matano/commits?author=chrismsnz" title="Code">💻</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
本项目遵循 [all-contributors](https://allcontributors.org) 规范。欢迎任何形式的贡献!
## 许可证
- [Apache-2.0 许可证](https://github.com/matanolabs/matano/blob/main/LICENSE)
<img referrerpolicy="no-referrer-when-downgrade" src="https://assets.kitploit.com/production/public/readmes/5606/93ae7d494fad0fb30cbf3ae746a39c4bc7a0f8bbf87fbb587a3f3c01f3c5ce20.png"/>