cisagov/dmarc-import
GitHub: cisagov/dmarc-import
该工具用于自动解析基于 RFC 7489 的 DMARC 聚合报告,支持从 S3 批量读取并写入 Elasticsearch 进行集中分析。
Stars: 11 | Forks: 6
# dmarc-import :postal_horn: :mailbox:
[](https://travis-ci.com/cisagov/dmarc-import)
[](https://coveralls.io/github/cisagov/dmarc-import?branch=develop)
`dmarc-import` 是一个用于解析 DMARC 聚合报告的工具。
这些聚合报告的预期格式在
[RFC 7489](https://tools.ietf.org/html/rfc7489#section-7.2.1.1) 中有所描述。
## 安装 Python 包
### 从 PyPI
```
pip install dmarc-import
```
### 从本地检出
使用 `git` 克隆仓库后,你可以使用
`pip` 安装 `dmarc-import`:
```
pip install /path/to/dmarc-import
```
### 从 GitHub
或者,如果你愿意,你可以直接从
[GitHub 仓库](https://github.com/cisagov/dmarc-import) 安装:
```
pip install git+https://github.com/cisagov/dmarc-import.git
```
## 构建 Docker 镜像
作为安装 Python 包的替代方案,你可以选择
构建 Docker 镜像:
```
docker-compose build
```
## 用法
```
Usage:
dmarc-import --schema=SCHEMA --s3-bucket=BUCKET [--s3-keys=KEYS] [--domains=FILE] [--reports=DIRECTORY] [--elasticsearch=URL] [--es-region=REGION] [--log-level=LEVEL] [--dmarcian-token=FILE] [--delete]
dmarc-import (-h | --help)
Options:
-h --help Show this message.
--log-level=LEVEL If specified, then the log level will be set to the
specified value. Valid values are "debug", "info",
"warn", and "error".
--schema=SCHEMA The XSD file against which the DMARC aggregate
reports are to be be verified.
--s3-bucket=BUCKET The AWS S3 bucket containing the DMARC aggregate
reports.
--s3-keys=KEYS A comma-separated list of DMARC aggregate report
keys. If specified, only the specified DMARC
aggregate reports will be processed. Otherwise all
reports in the AWS S3 bucket will be processed.
--domains=FILE A file to which to save a list of all domains for
which DMARC aggregate reports were received. If not
specified then no such file will be created.
--reports=DIRECTORY A directory to which to write files containing DMARC
aggregate report contents. If not specified then no
such files will be created.
--elasticsearch=URL A URL corresponding to an AWS Elasticsearch
instance, including the index where the DMARC
aggregate reports should be written.
--es-region=REGION The AWS region where the Elasticsearch instance
is located.
--dmarcian-token=FILE A simple text file whose only contents are the
Dmarcian API token. If specified then the
Dmarcian API will be queried to determine what
commercial mail-sending organization (if any) is
associated with the IP in the aggregate report.
--delete If present then the reports will be deleted after
processing.
```
## 设置 Docker secrets
在尝试通过 `docker-compose` 运行此项目之前,你必须
创建一个 `secrets` 目录,并在其中创建几个包含
供 Docker 容器使用的凭证文件。这些文件是:
* `secrets/aws/config` - [一个包含 AWS
配置的 ini 格式文件](http://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html)
* `secrets/aws/credentials` - [一个包含 AWS
凭证的 ini 格式文件](http://docs.aws.amazon.com/cli/latest/userguide/cli-config-files.html)
* `secrets/dmarcian/token` - 一个包含 [Dmarcian API
token](https://dmarcian.com/) 的文本文件
## 许可证
本项目属于全球性的[公有领域](LICENSE.md)。
本项目在美国属于公有领域,并且
通过 [CC0 1.0 Universal 公有领域
dedication](https://creativecommons.org/publicdomain/zero/1.0/) 放弃了作品在全球范围内的版权和相关权利。
对本项目的所有贡献都将根据 CC0
dedication 发布。通过提交拉取请求,即表示你同意遵守
此版权利益的放弃声明。
标签:AWS S3, DMARC, Elasticsearch, Python, 数据解析, 无后门, 请求拦截, 逆向工具, 邮件安全