arpitgupta369/security-policy-generator
GitHub: arpitgupta369/security-policy-generator
一款基于Python标准库的ISMS策略文档生成工具,通过参数化模板和单一组织配置自动产出符合ISO/IEC 27001标准的完整策略包。
Stars: 0 | Forks: 0
# security-policy-generator
**从单一组织配置生成一套完整的、符合 ISO/IEC 27001 标准的 ISMS 策略包——无需任何依赖,纯 Python 实现。**
## 项目背景
作为 **New Milestone Edutech LLP 的 GRC 分析师**,起草和维护
ISO/IEC 27001 ISMS 策略集——并跟踪针对该策略集的不符合项——是
核心工作。其中最重复的部分是手工将相同的组织详细信息、
范围、所有者和审查日期印刻在十几份文档中。该工具将其
转化为一个可重复、版本控制的生成步骤:只需提供配置,
即可获得一致且可供审查的策略包。这体现了在
ISMS 控制差距分析、策略起草以及 NIST CSF / NIST 800-53 映射方面的实战经验。
## 功能
- 从单一配置生成 **6 项核心 ISMS 策略**:
信息安全、可接受使用、访问控制、事件响应、
业务连续性以及数据保留与销毁。
- **轻量级内置模板引擎**(`{{ token }}` 语法)——无需 Jinja,无需第三方依赖。
- 自动计算派生字段(下次审查日期、生成日期、年份)。
- 输出整洁的 **Markdown**,并可选择输出适合打印的独立 **HTML**。
- 生成 **索引/封面**(`README.md`),列出整个策略包。
- 内置 **示例组织配置** 和一键运行的 `--demo`。
- 模板以可编辑的 `.md.tmpl` 文件形式存放在 `templates/` 中——可自由调整。
## 技术栈
- Python 3.8+(仅使用标准库:`argparse`、`json`、`datetime`、`re`、`html`)。
## 安装
```
git clone https://github.com/arpitgupta369/security-policy-generator.git
cd security-policy-generator
# 无需安装 dependencies — 仅使用 standard library。
python policy_generator.py --list
```
## 用法
将内置的示例策略包(Markdown + HTML)生成到 `out/` 目录:
```
python policy_generator.py --demo
```
预期输出:
```
Generated 13 files into C:\...\security-policy-generator\out
+ information_security_policy.md
+ information_security_policy.html
+ acceptable_use.md
+ acceptable_use.html
+ access_control.md
+ access_control.html
+ incident_response.md
+ incident_response.html
+ business_continuity.md
+ business_continuity.html
+ data_retention_disposal.md
+ data_retention_disposal.html
+ README.md
```
使用您自己的配置生成:
```
python policy_generator.py --config config.sample.json --out out --html
```
配置字段(参见 `config.sample.json`):
```
{
"org_name": "Northwind Health Analytics Pvt. Ltd.",
"scope": "All information systems, cloud workloads, data pipelines...",
"ciso_name": "Ananya Deshpande",
"effective_date": "2026-02-01",
"review_cycle_months": 12,
"classification": "Internal"
}
```
## 项目结构
```
security-policy-generator/
├── policy_generator.py # CLI + templater + Markdown->HTML shim
├── config.sample.json # Sample organisation profile
├── templates/ # Editable policy templates ({{ token }} syntax)
│ ├── information_security_policy.md.tmpl
│ ├── acceptable_use.md.tmpl
│ ├── access_control.md.tmpl
│ ├── incident_response.md.tmpl
│ ├── business_continuity.md.tmpl
│ └── data_retention_disposal.md.tmpl
├── out/ # Generated pack (created by --demo)
├── requirements.txt
├── README.md
├── LICENSE
└── .gitignore
```
## 免责声明
仅供**教育、防御和授权使用**。生成的文档
是**模板,而非法律建议**,也不是认证交付物。在采用之前,请根据您组织的法律、合同和监管环境审查
并调整每一项策略——并由合格的顾问和管理层批准。
由 **Arpit Gupta** 构建 — [LinkedIn](https://linkedin.com/in/arpit-gupta-060b302a7/) · [GitHub](https://github.com/arpitgupta369)
标签:GRC, ISMS, Python, 合规管理, 文档生成, 无后门, 模板引擎, 逆向工具