resend/resend-dmarc-analyzer

GitHub: resend/resend-dmarc-analyzer

基于 Next.js 的 DMARC 报告解析工具,通过 Resend Webhook 自动接收邮件聚合与取证报告,提供 Web 界面分析及邮件通知功能。

Stars: 20 | Forks: 3

# DMARC 分析器 一个用于分析 DMARC 汇总报告 (RUA) 和取证报告 (RUF) 的 Next.js 应用程序。通过 Resend Inbound webhooks 接收报告,并提供 Web 界面进行手动分析。 ## 功能特性 - 从 XML 解析 DMARC 汇总报告 (RUA) - 处理压缩附件 (.xml.gz, .zip) - 用于 Resend Inbound 的 Webhook 端点 - 用于报告摘要的 React Email 模板 - 用于粘贴和分析的 Web 界面 ## 项目结构 ``` src/ ├── app/ │ ├── api/ │ │ ├── analyze/route.ts # POST endpoint for frontend parsing │ │ └── webhooks/dmarc/ │ │ ├── rua/route.ts # Aggregate report webhook │ │ └── ruf/route.ts # Forensic report webhook (pass-through) │ ├── page.tsx # Paste-and-analyze frontend │ ├── layout.tsx # App layout │ └── globals.css # Resend-style dark theme ├── components/dmarc/ │ ├── summary-card.tsx # Stats card component │ ├── status-badge.tsx # Pass/fail badges │ ├── records-table.tsx # Records table with auth results │ └── report-viewer.tsx # Main report display component ├── emails/ │ └── dmarc-report.tsx # React Email template ├── lib/ │ ├── config.ts # Environment config │ ├── dmarc/ │ │ ├── parser.ts # XML parser & analysis │ │ ├── attachments.ts # .xml, .gz, .zip extraction │ │ └── sample.ts # Sample XML for testing │ ├── email/ │ │ └── send-report.ts # Resend email sender │ └── webhook/ │ └── verify.ts # Svix signature verification ├── types/ │ └── dmarc.ts # TypeScript types └── .env.example # Environment variables template ``` ## 快速开始 1. 安装依赖: ``` pnpm install ``` 2. 复制环境变量模板并填写您的凭证: ``` cp .env.example .env.local ``` 3. 运行开发服务器: ``` pnpm dev ``` 4. 打开 [http://localhost:3000](http://localhost:3000) 使用分析器。 ## 环境变量 | 变量 | 描述 | |----------|-------------| | `RESEND_API_KEY` | 您的 Resend API key | | `RESEND_WEBHOOK_SECRET` | 来自 Resend 的 Webhook 签名密钥 | | `DMARC_RECIPIENT_EMAIL` | 接收报告摘要的电子邮件地址 | | `DMARC_SENDING_DOMAIN` | 用于发送电子邮件的已验证域名 | ## Webhook URL 在您的 Resend 仪表板中配置这些端点: - **RUA (汇总报告)**: `https://your-domain.com/api/webhooks/dmarc/rua` - **RUF (取证报告)**: `https://your-domain.com/api/webhooks/dmarc/ruf` 从 Resend 仪表板复制签名密钥并将其粘贴到 `RESEND_WEBHOOK_SECRET` 环境变量中。 ## 脚本 | 脚本 | 描述 | |--------|-------------| | `pnpm dev` | 启动开发服务器 | | `pnpm build` | 构建生产版本 | | `pnpm start` | 启动生产服务器 | | `pnpm lint:fix` | 运行 linter 并自动修复 | | `pnpm email` | 预览电子邮件模板 (端口 3003) | | `pnpm test:email ` | 使用示例数据发送测试电子邮件 | ## 技术栈 - [Next.js 16](https://nextjs.org/) - React 框架 - [React 19](https://react.dev/) - UI 库 - [Tailwind CSS 4](https://tailwindcss.com/) - 样式 - [Resend](https://resend.com/) - 电子邮件发送服务 - [React Email](https://react.email/) - 电子邮件模板 - [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) - XML 解析
标签:DKIM, DMARC 分析器, React, Resend, RUA, RUF, SPF, Syscalls, TypeScript, Webhook, XML 解析, 云安全态势管理, 前端应用, 力导向图, 域名安全, 安全插件, 开源安全工具, 电子邮件安全, 网络安全, 自动化攻击, 逆向工程平台, 邮件合规, 邮件报告, 钓鱼防护, 隐私保护