
Lab4PurpleSec 是一个分段式网络安全家庭实验室,用于红队和蓝队的动手实践,结合了网络与 Web 渗透测试、Active Directory 攻击以及防御性监控(SIEM、IDS/IPS)。它面向学生和网络安全爱好者,适合那些倾向于从零开始搭建环境而非使用预构建虚拟机的人。其目标是通手动安装和配置每个组件来理解它们,以可复现且可定制的方式进行。
下表概述了已记录的网络安全场景。
| 场景 | 状态 | 链接 |
|---|---|---|
| 场景 1 - Web 应用程序利用(WAN → DMZ) | 已记录 | 场景 1 |
| 场景 2 - 针对 GOAD 的 Active Directory 攻击(Kerberoasting 与 AS-REP Roasting) | 已记录 | 场景 2 |
另请参阅 SCENARIOS/00-lab-overview.md 了解实验室拓扑和场景索引。
Lab4PurpleSec 包含以下特性:
Lab4PurpleSec 是一个不断发展的网络安全家庭实验室,专为在接近企业级的环境中进行红队和蓝队训练而设计,集成了网络/Web 渗透测试、Active Directory、检测、SIEM 和 IDS/IPS。
本项目面向学生和网络安全爱好者!
Lab4PurpleSec 设计灵活,可根据您的需求和可用资源进行部署。您无需同时运行所有虚拟机——场景设计为逐步执行。
注意:以上前提条件为参考配置。你可以根据自身需求进行自定义。当然,RAM 是最重要的资源(对于虚拟化而言,CPU/GPU 性能不如 RAM 重要)。
重要说明:
Vagrantfile 中自定义虚拟机资源以匹配你的硬件(如有需要,可减少每台虚拟机的 RAM/CPU)有关详细的硬件和软件要求,请参阅 docs/SETUP/prereqs.md。
docs/SETUP/prereqs.mdLab4PurpleSec 不提供预构建的虚拟机(OVA/OVF)。安装完全按照所提供的详细指南“从零开始”完成。这种方式:
Lab4PurpleSec 是一个专注于应用程序和系统漏洞利用的环境,在隔离的 DMZ 区域中托管故意存在漏洞的机器(Metasploitable2/3)、OWASP Web 应用程序,以及一个存在漏洞的 Active Directory 环境(GOAD MINILAB)。整体拓扑如下图所示。

GOAD-MINILAB 复现了一个简化的 Active Directory 环境,包含一个域控制器和一台 Windows 客户端工作站(如有需要可多台),可用于模拟各类针对 Active Directory 的攻击。

本节介绍 Lab4PurpleSec 仓库的组织方式,并说明每个目录和主要文件的作用。该结构便于在安装指南、配置、测试和项目资源之间进行清晰导航。
Lab4PurpleSec/
├── README.md - General overview and quick start (EN)
├── README_FR.md - General overview and quick start (FR)
├── CONTRIBUTING.md - Contribution guidelines
├── LICENSE - License and usage information
├── .gitignore - Files/directories excluded from Git versioning
├── .github/
│ └── ISSUE_TEMPLATE/
│ ├── bug_report.md - Bug report template
│ ├── feature_request.md - Feature request template
│ └── documentation.md - Documentation improvement template
├── ARCHITECTURE.md - Architecture information, interfaces, network diagrams
├── assets/ - Visual resources (images, diagrams, etc.)
├── INVENTORY.md - Inventory list of all VMs and main characteristics
├── automation/ - Vagrant and Ansible automation for internal VMs
│ ├── README.md - Automation documentation and quick start
│ ├── ORCHESTRATION.md - VM orchestration and external integration guide
│ ├── Vagrantfile - Vagrant configuration for internal VMs
│ ├── vagrant-config.yml - Default configuration values for the Vagrantfile
│ ├── inventory.yml - Ansible inventory of the internal VMs
│ ├── ansible/ - Ansible playbooks and roles
│ └── scripts/ - Helper scripts for automation
├── docs/
│ ├── README.md
│ ├── SETUP/
│ │ ├── prereqs.md - Hardware and software requirements
│ │ ├── VMs_installation.md - Detailed VM installation and configuration guide
│ │ ├── pfsense_setup.md - pfSense installation and configuration documentation
│ │ ├── Web_server_setup.md - Web server deployment guide
│ │ ├── Wazuh_setup.md - Wazuh installation and agent enrollment guide
│ │ └── GOAD_setup.md - GOAD Active Directory deployment procedure
│ └── TESTS/
│ ├── Web_server.md - Web server validation checklist
│ ├── pfSense.md - pfSense and Suricata verification
│ ├── Wazuh.md - Wazuh testing/documentation
│ └── GOAD-MINILAB.md - GOAD MINILAB verification documentation
├── SCENARIOS/ - Attack & detection scenarios (Purple Team)
│ ├── README.md - Scenario index and overview
│ ├── 00-lab-overview.md - Shared lab topology and scenario index
│ ├── scenario-1-web-exploitation.md - Scenario 1: web exploitation (WAN → DMZ)
│ ├── scenario-2-active-directory.md - Scenario 2: Active Directory attacks on GOAD
│ └── figures/ - Screenshots and diagrams for the scenarios
├── CONFIGS/
│ ├── web-server/ - Web server configuration files (Nginx, Docker, etc.)
│ └── pfsense/ - pfSense configuration files (rules, XML exports)
⚠️ 安全警告:此实验环境包含故意存在漏洞的服务。切勿将这些机器连接到生产网络。安装后务必更改默认密码。此环境仅设计用于隔离的教学用途。
Lab4PurpleSec 使用 Vagrant 和 Ansible 为大多数内部虚拟机提供半自动化部署。
快速开始:
在 Windows 上:
cd automation # Navigate to the automation directory
$env:VAGRANT_ANSIBLE = "true" # Enable Ansible provisioning
vagrant up # Start the VMs