SiteQ8/openshift

GitHub: SiteQ8/openshift

面向 Red Hat OpenShift 4.x 的企业级安全架构蓝图,覆盖 PCI DSS v4.0 等多项合规标准,提供完整的纵深防御实现方案。

Stars: 0 | Forks: 0

OpenShift Secure Architecture
# OpenShift 企业安全架构蓝图

OpenShift 4.x PCI DSS v4.0 NIST 800-53 CIS Benchmark SOC2 License

一个生产级、符合 PCI DSS v4.0 标准的 Red Hat OpenShift Container Platform 企业环境安全架构蓝图。

## 目录 - [概述](#overview) - [架构图](#architecture-diagram) - [仓库结构](#repository-structure) - [快速开始](#quick-start) - [安全域](#security-domains) - [PCI DSS v4.0 映射](#pci-dss-v40-mapping) - [交互式 GUI](#interactive-gui) - [贡献](#contributing) - [作者](#author) ## 概述 本蓝图为部署和运行 Red Hat OpenShift Container Platform (OCP 4.x) 提供了一个**完整的企业级安全架构**,完全符合以下标准: | 标准 | 版本 | 覆盖范围 | |----------|---------|----------| | **PCI DSS** | v4.0 | 所有 12 项要求 | | **NIST SP 800-53** | Rev 5 | 高基线 | | **CIS Benchmarks** | OCP 4.x | Level 1 & 2 | | **SOC 2 Type II** | 2024 | 所有信任原则 | | **ISO 27001** | 2022 | 附录 A 控制 | | **MITRE ATT&CK** | v14 | 容器矩阵 | ### 关键特性 - **Zero Trust Architecture** — 网络微隔离,全链路 mTLS,身份感知代理 - **Defense in Depth** — 从基础设施到应用的 7 层安全模型 - **合规仪表盘** — 用于架构可视化和合规性跟踪的交互式 GUI - **GitOps Security** — 基于 ArgoCD 的策略执行,使用 OPA/Gatekeeper - 🕵️ **Runtime Security** — StackRox/ACS,Falco 和自定义 Admission Controller - 📦 **Supply Chain Security** — Sigstore,Cosign,SBOM 生成和镜像来源追溯 - 🌐 **Network Hardening** — Calico/OVN-Kubernetes 策略,Egress 防火墙,Service Mesh - 💾 **Data Protection** — 静态加密 (LUKS2),传输加密 (TLS 1.3),及使用中加密 (SGX) ## 架构图 ``` ┌─────────────────────────────────────────────────────────────────────┐ │ EXTERNAL BOUNDARY │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ │ │ WAF/DDoS │ │ External │ │ CDN │ │ DNS Security │ │ │ │ (F5/CF) │ │ LB (HA) │ │ │ │ (DNSSEC) │ │ │ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────────┬─────────┘ │ │ └──────────────┼──────────────┘ │ │ │ ▼ ▼ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ DMZ / INGRESS ZONE │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │ │ │ │ │ HAProxy │ │ OpenShift │ │ Cert Manager │ │ │ │ │ │ Ingress Ctrl │ │ Router │ │ (Let's Encrypt) │ │ │ │ │ └──────┬───────┘ └──────┬───────┘ └──────────────────┘ │ │ │ └─────────┼─────────────────┼─────────────────────────────────┘ │ │ ▼ ▼ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ OPENSHIFT CONTROL PLANE (HA x3) │ │ │ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │ │ │ │ API Server │ │ etcd │ │ Controller │ │ │ │ │ │ (RBAC+OPA) │ │ (Encrypted)│ │ Manager │ │ │ │ │ └────────────┘ └────────────┘ └────────────┘ │ │ │ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │ │ │ │ Scheduler │ │ OAuth/OIDC │ │ Admission │ │ │ │ │ │ │ │ (LDAP/AD) │ │ Webhooks │ │ │ │ │ └────────────┘ └────────────┘ └────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌───────────────────────────┼─────────────────────────────────┐ │ │ │ WORKER NODE POOL (Auto-scaled, Multi-AZ) │ │ │ │ │ │ │ │ │ ┌───────────┐ ┌─────────┴──────┐ ┌───────────────────┐ │ │ │ │ │ App Tier │ │ Service Mesh │ │ PCI CDE Namespace │ │ │ │ │ │ Namespace │ │ (Istio/mTLS) │ │ (Isolated) │ │ │ │ │ │ │ │ │ │ ┌───────────────┐ │ │ │ │ │ │ ┌───────┐ │ │ ┌────────────┐ │ │ │ Payment Pods │ │ │ │ │ │ │ │Pod+SC │ │ │ │ Envoy Proxy│ │ │ │ (Hardened) │ │ │ │ │ │ │ └───────┘ │ │ └────────────┘ │ │ └───────────────┘ │ │ │ │ │ └───────────┘ └────────────────┘ └───────────────────────┘ │ │ │ │ │ │ │ │ ┌──────────────────────────────────────────────────────┐ │ │ │ │ │ SECURITY & OBSERVABILITY │ │ │ │ │ │ StackRox/ACS │ Falco │ OPA │ Vault │ Prometheus │ │ │ │ │ │ Grafana │ EFK Stack │ Jaeger │ Kyverno │ Trivy │ │ │ │ │ └──────────────────────────────────────────────────────┘ │ │ │ └──────────────────────────────────────────────────────────────┘ │ │ │ │ │ ┌───────────────────────────┼─────────────────────────────────┐ │ │ │ STORAGE & DATA LAYER │ │ │ │ ┌────────────┐ ┌────────┴───┐ ┌────────────────────────┐ │ │ │ │ │ ODF/Ceph │ │ etcd │ │ External DB (Encrypted)│ │ │ │ │ │ (LUKS2) │ │ Backup │ │ PostgreSQL/MySQL │ │ │ │ │ └────────────┘ └────────────┘ └────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ CI/CD & SUPPLY CHAIN SECURITY │ │ │ │ Tekton │ ArgoCD │ Cosign │ Syft/SBOM │ Grype │ Quay │ │ │ └─────────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘ ``` ## 仓库结构 ``` openshift/ ├── README.md # This file ├── docs/ │ ├── architecture-overview.md # Detailed architecture documentation │ ├── deployment-guide.md # Step-by-step deployment guide │ ├── threat-model.md # STRIDE threat modeling │ └── compliance-matrix.md # Full compliance mapping ├── policies/ │ ├── network-policies.yaml # Kubernetes NetworkPolicy manifests │ ├── opa-constraints.yaml # OPA/Gatekeeper constraint templates │ ├── kyverno-policies.yaml # Kyverno cluster policies │ └── pod-security.yaml # Pod Security Standards (Restricted) ├── hardening/ │ ├── cluster-hardening.yaml # CIS Benchmark hardening manifests │ ├── node-hardening.sh # RHCOS node hardening script │ ├── etcd-encryption.yaml # etcd encryption configuration │ └── scc-profiles.yaml # Security Context Constraints ├── network/ │ ├── ingress-config.yaml # Ingress controller hardening │ ├── egress-firewall.yaml # Egress traffic restrictions │ ├── service-mesh.yaml # Istio/OSSM configuration │ └── calico-policies.yaml # Calico network policies ├── rbac/ │ ├── cluster-roles.yaml # Cluster-wide RBAC definitions │ ├── namespace-roles.yaml # Namespace-scoped roles │ ├── service-accounts.yaml # Service account configurations │ └── oauth-config.yaml # OAuth/OIDC integration ├── monitoring/ │ ├── prometheus-rules.yaml # Security alerting rules │ ├── grafana-dashboards.json # Security monitoring dashboards │ ├── falco-rules.yaml # Runtime threat detection │ └── audit-policy.yaml # API server audit configuration ├── pci-dss/ │ ├── requirement-mapping.md # PCI DSS v4.0 control mapping │ ├── cde-namespace.yaml # Cardholder Data Environment setup │ ├── encryption-config.yaml # Data encryption standards │ └── access-controls.yaml # PCI access control policies ├── ci-cd/ │ ├── tekton-pipeline.yaml # Secure CI/CD pipeline │ ├── argocd-config.yaml # GitOps deployment config │ ├── image-signing.yaml # Cosign image signing │ └── sbom-generation.yaml # SBOM with Syft ├── disaster-recovery/ │ ├── backup-strategy.md # Backup and recovery plan │ ├── velero-config.yaml # Velero backup configuration │ └── dr-runbook.md # DR procedures and runbook ├── scripts/ │ ├── compliance-check.sh # Automated compliance scanner │ ├── security-audit.sh # Security posture audit │ └── cluster-bootstrap.sh # Initial cluster security bootstrap ├── gui/ │ └── index.html # Interactive Architecture Dashboard └── .github/ └── workflows/ └── security-scan.yml # CI security scanning workflow ``` ## 快速开始 ### 前置条件 - Red Hat OpenShift 4.12+ 集群 - 已通过 cluster-admin 认证的 `oc` CLI 工具 - HashiCorp Vault 实例(用于密钥管理) - 容器镜像仓库(推荐 Quay.io) ### 1. 引导集群安全 ``` # 克隆 repository git clone https://github.com/SiteQ8/openshift.git cd openshift # 运行 security bootstrap chmod +x scripts/cluster-bootstrap.sh ./scripts/cluster-bootstrap.sh # 验证合规性 ./scripts/compliance-check.sh ``` ### 2. 应用加固 ``` # 应用 CIS Benchmark 加固 oc apply -f hardening/cluster-hardening.yaml # 配置 etcd 加密 oc apply -f hardening/etcd-encryption.yaml # 应用 Security Context Constraints oc apply -f hardening/scc-profiles.yaml ``` ### 3. 配置网络安全 ``` # 应用网络策略 oc apply -f policies/network-policies.yaml # 配置 egress 防火墙 oc apply -f network/egress-firewall.yaml # 部署 service mesh oc apply -f network/service-mesh.yaml ``` ### 4. 启用监控 ``` # 部署 Prometheus 规则 oc apply -f monitoring/prometheus-rules.yaml # 部署 Falco runtime security oc apply -f monitoring/falco-rules.yaml ``` ### 5. 启动交互式仪表盘 在浏览器中打开 `gui/index.html` 或访问 [GitHub Pages 站点](https://siteq8.github.io/openshift/)。 ## 安全域 ### 1. 基础设施安全 - 启用 SELinux Enforcing 模式的 RHCOS 不可变操作系统 - 启用 FIPS 140-2/3 加密模块 - 基于 TPM 2.0 认证的安全启动 - 通过 Machine Config Operator 实现节点自动补丁 ### 2. 集群加固 - CIS Benchmark Level 2 合规 - 使用 AES-256-GCM 进行 etcd 加密 - API Server 审计日志(完整请求/响应) - Admission Controller (OPA Gatekeeper + Kyverno) ### 3. 身份与访问管理 - OIDC/LDAP/Active Directory 集成 - 多因素认证 强制执行 - Just-In-Time (JIT) 特权访问 - Service Account Token 自动轮换 ### 4. 网络安全 - Zero Trust 网络模型与微隔离 - 通过 Service Mesh 为所有东西向流量提供双向 TLS (mTLS) - Egress 流量白名单和检查 - 在 Namespace 边界执行 Network Policy ### 5. 供应链安全 - 使用 Cosign/Sigstore 进行镜像签名 - 每次构建使用 Syft 生成 SBOM - 使用 Trivy + Grype 进行漏洞扫描 - 可信镜像仓库强制执行 ### 6. 运行时安全 - Red Hat ACS (StackRox) 用于运行时检测 - Falco 用于系统调用级监控 - 强制只读根文件系统 - Seccomp 和 AppArmor 配置文件 ### 7. 数据保护 - 静态加密 (ODF 使用 LUKS2,etcd 加密) - 传输加密 (最低 TLS 1.3) - HashiCorp Vault 用于密钥管理 - 自动密钥轮换策略 ## PCI DSS v4.0 映射 | PCI DSS 要求 | OpenShift 实施方案 | 状态 | |---------------------|-------------------------|--------| | **Req 1**: 网络安全控制 | NetworkPolicy, Calico, Egress Firewall | ✅ | | **Req 2**: 安全配置 | CIS Benchmarks, SCC, Machine Config | ✅ | | **Req 3**: 保护存储数据 | LUKS2, etcd 加密, Vault | ✅ | | **Req 4**: 加密传输 | TLS 1.3, 通过 Service Mesh 实现 mTLS | ✅ | | **Req 5**: 恶意软件防护 | ACS Runtime, Falco, 镜像扫描 | ✅ | | **Req 6**: 安全开发 | Tekton SAST/DAST, 签名镜像 | ✅ | | **Req 7**: 限制访问 | RBAC, Namespace 隔离, JIT | ✅ | | **Req 8**: 识别用户 | OIDC/LDAP, MFA, Token 轮换 | ✅ | | **Req 9**: 物理访问 | 云服务商控制 + 审计 | ✅ | | **Req 10**: 日志与监控 | EFK Stack, Prometheus, 审计日志 | ✅ | | **Req 11**: 测试安全 | Compliance Operator, CIS 扫描 | ✅ | | **Req 12**: 安全策略 | Policy-as-Code, GitOps 强制执行 | ✅ | ## 交互式 GUI 仪表盘包含一个用于访问控制的登录界面: | 凭证 | 值 | |------------|-------| | **用户名** | `admin` | | **密码** | `OCP@Secure2025` | 功能包括合规雷达图、风险分布环形图、按域划分的控制覆盖范围以及完整的架构可视化。 ### 启动 该蓝图包含一个交互式 Web 仪表盘,用于可视化架构和跟踪合规性: **🌐 在线演示**: [https://siteq8.github.io/openshift/gui/](https://siteq8.github.io/openshift/gui/) 功能: - 交互式架构拓扑查看器 - 带进度指示器的 PCI DSS 合规跟踪器 - 带状态监控的安全控制清单 - CIS Benchmark 评分仪表盘 - MITRE ATT&CK 覆盖热力图 - 网络策略可视化 - 实时风险评估矩阵 ## 作者 **Ali AlEnezi** ([@SiteQ8](https://github.com/SiteQ8)) 网络安全架构师 | 科威特 🇰🇼 - GitHub: [github.com/SiteQ8](https://github.com/SiteQ8) - Email: Site@hotmail.com ## 许可证 本项目基于 MIT 许可证授权 - 详情请参阅 [LICENSE](LICENSE) 文件。

用 ❤️ 为网络安全社区构建
逐个策略地保护容器安全。

标签:ATTACK-Python-Client, CISA项目, CIS Benchmark, Cloudflare, Cloudformation, DevSecOps, ISO 27001, JSONLines, MITRE ATT&CK, NIST 800-53, OpenShift, PCI DSS, Red Hat, SOC 2, Web截图, YAML, Zero Trust, 上游代理, 交互式GUI, 人工智能安全, 企业级安全, 合规性, 后端开发, 子域名字典, 子域名突变, 安全基线, 安全库, 安全架构, 容器安全, 平台工程, 应用安全, 教学环境, 数据处理, 网络安全, 自定义请求头, 足迹分析, 金融级安全, 隐私保护, 集群加固, 零信任