giselleevita/network-security-lab

GitHub: giselleevita/network-security-lab

一个模拟中小企业网络环境的网络安全加固实验室,集成防火墙策略、网络分段、入侵检测与 ISO 27001 合规映射。

Stars: 0 | Forks: 0

# network-security-lab [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/7e59d0ef2a172559.svg)](https://github.com/giselleevita/network-security-lab/actions/workflows/ci.yml) [![Python](https://img.shields.io/badge/python-3.11-blue)](https://python.org) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![ISO 27001](https://img.shields.io/badge/ISO%2027001-Annex%20A-blueviolet)](isms/controls.md) 有关实现的权衡和咨询背景,请参阅 [docs/CASE_STUDY.md](docs/CASE_STUDY.md)。 ## 概述 本实验室模拟了典型中小企业网络环境的安全加固。它涵盖了从**威胁建模** → **网络分段设计** → **防火墙策略** → **IDS/IPS 部署** → **ISMS 控制映射**的完整生命周期。 该架构反映了 IT 安全咨询公司及其客户环境中常见的配置:边界防火墙、分段的内部区域、用于面向公众服务的 DMZ 以及监控基础设施。 ## 仓库结构 ``` network-security-lab/ ├── firewall/ │ ├── iptables-baseline.sh # Linux host hardening ruleset │ ├── nftables-perimeter.conf # Perimeter firewall (stateful, all chains hardened) │ └── README.md ├── segmentation/ │ ├── vlan-design.md # VLAN architecture + DMZ design │ ├── acl-policy.md # Inter-VLAN ACL policy │ └── topology.md # Network topology diagram ├── ids-ips/ │ ├── snort-local.rules # Snort 3 detection rules │ ├── suricata-local.rules # Suricata detection rules (.rules format) │ └── README.md ├── isms/ │ ├── controls.md # ISO 27001 Annex A control mapping │ ├── risk-register.md # Network risk register │ └── README.md ├── threat-model/ │ ├── threat-model.md # STRIDE threat model │ └── attack-paths.md # Attack paths + mitigations ├── scripts/ │ ├── audit_open_ports.py # Port audit tool │ ├── check_firewall_rules.py # Firewall policy validator │ └── generate_risk_report.py # Risk register → Markdown report ├── tests/ │ └── test_scripts.py # pytest suite └── docs/ └── references.md # Standards and references ``` ## 核心功能 | 领域 | 涵盖内容 | |---|---| | **Firewall** | 状态检测 iptables + nftables — 所有链均已加固(INPUT/FORWARD/OUTPUT 默认拒绝) | | **Segmentation** | VLAN 设计(LAN / DMZ / MGMT / GUEST / SERVER),区域间 ACL 策略 | | **IDS/IPS** | 用于端口扫描、SQLi、反向 shell 的 Snort 规则;用于 C2、RDP 暴力破解、DNS 数据外传的 Suricata 规则 | | **ISMS** | ISO 27001 A.8.16, A.8.20–A.8.23 映射至具体实施 | | **Threat Model** | STRIDE 分析,包含缓解措施的 5 条已记录攻击路径 | | **Scripts** | Python 工具:端口审计器、防火墙验证器、风险报告生成器 | | **CI** | GitHub Actions:pytest、防火墙策略验证、ruff linting | ## 快速开始 ``` git clone https://github.com/giselleevita/network-security-lab cd network-security-lab pip install -r requirements.txt # 审计开放端口 python scripts/audit_open_ports.py --target 127.0.0.1 # 验证 firewall rules python scripts/check_firewall_rules.py firewall/iptables-baseline.sh python scripts/check_firewall_rules.py firewall/nftables-perimeter.conf # 生成风险报告 python scripts/generate_risk_report.py # 运行 tests pytest tests/ -v ``` ## ISMS 对齐 所有控制措施均映射至 **ISO 27001:2022 Annex A** — 网络安全领域: - **A.8.16** — 监控活动 - **A.8.20** — 网络安全 - **A.8.21** — 网络服务的安全 - **A.8.22** — 网络隔离 - **A.8.23** — Web 过滤 有关完整映射,请参阅 [`isms/controls.md`](isms/controls.md)。 ## 威胁模型摘要 | 威胁 | 类别 | 缓解措施 | |---|---|---| | 端口扫描 / 侦察 | 信息泄露 | IDS 规则、速率限制 | | 通过扁平网络的横向移动 | 权限提升 | VLAN 分段、ACL | | 未修补的面向互联网服务 | 篡改 | DMZ 隔离、WAF 规则 | | 凭据暴力破解 (SSH/RDP) | 伪造 | 速率限制、仅密钥认证 | | DNS 隧道 / 数据外传 | 信息泄露 | Snort + Suricata DNS 规则 | | C2 信标 | 篡改 | Suricata 间隔检测 | 完整详情请见 [`threat-model/`](threat-model/)。 ## 作者 **Giselle Koch** — 网络安全工程师 [github.com/giselleevita](https://github.com/giselleevita) · [linkedin.com/in/giselle-koch](https://linkedin.com/in/giselle-koch)
标签:IDS/IPS, Metaprompt, 信息安全管理体系, 安全规则引擎, 实验室环境, 网络加固, 网络安全, 网络架构, 逆向工具, 防火墙策略, 隐私保护