implementing-zero-trust-network-access

通过配置身份感知代理、微分段、基于条件访问策略的持续验证,以及在 AWS、Azure 和 GCP 环境中以 BeyondCorp 风格的架构替代传统 VPN 访问,在云环境中实施零信任网络访问(ZTNA)。

9 stars

Best use case

implementing-zero-trust-network-access is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

通过配置身份感知代理、微分段、基于条件访问策略的持续验证,以及在 AWS、Azure 和 GCP 环境中以 BeyondCorp 风格的架构替代传统 VPN 访问,在云环境中实施零信任网络访问(ZTNA)。

Teams using implementing-zero-trust-network-access should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/implementing-zero-trust-network-access/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/implementing-zero-trust-network-access/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/implementing-zero-trust-network-access/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How implementing-zero-trust-network-access Compares

Feature / Agentimplementing-zero-trust-network-accessStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

通过配置身份感知代理、微分段、基于条件访问策略的持续验证,以及在 AWS、Azure 和 GCP 环境中以 BeyondCorp 风格的架构替代传统 VPN 访问,在云环境中实施零信任网络访问(ZTNA)。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 实施零信任网络访问

## 适用场景

- 将传统 VPN 远程访问替换为基于身份的访问控制时
- 实施微分段(Micro-Segmentation)以限制云网络内的横向移动时
- 合规要求或安全策略需要采用零信任架构时
- 为云工作负载提供安全访问而无需将其暴露到公共互联网时
- 基于用户身份、设备健康状况和位置构建上下文感知访问策略时

**不适用于**:完全替代网络安全控制(ZTNA 是防火墙和网络 ACL 的补充而非替代)、保护面向互联网的公共应用(应使用 WAF),或无法实现基于身份认证的 IoT 设备访问场景。

## 前置条件

- 已启用 MFA 的身份提供商(Entra ID、Okta、Google Workspace)
- 云原生网络能力(AWS PrivateLink、Azure Private Link、GCP IAP)
- 用于设备态势评估的设备管理解决方案(Intune、Jamf、CrowdStrike)
- 服务网格或零信任代理(Cloudflare Access、Zscaler ZPA 或云原生 IAP)
- 用于访问决策和策略执行的集中日志记录

## 工作流程

### 步骤 1:为应用访问部署 GCP 身份感知代理(IAP)

配置 IAP,无需 VPN 即可为 Web 应用提供经身份验证的访问。

```bash
# 启用 IAP API
gcloud services enable iap.googleapis.com

# 配置 OAuth 同意屏幕
gcloud iap oauth-brands create \
  --application_title="Corporate Apps" \
  --support_email=security@company.com

# 为 App Engine 应用启用 IAP
gcloud iap web enable \
  --resource-type=app-engine \
  --oauth2-client-id=CLIENT_ID \
  --oauth2-client-secret=CLIENT_SECRET

# 为后端服务(GCE/GKE)启用 IAP
gcloud compute backend-services update BACKEND_SERVICE \
  --iap=enabled,oauth2-client-id=CLIENT_ID,oauth2-client-secret=CLIENT_SECRET \
  --global

# 设置 IAP 访问策略(谁可以访问)
gcloud iap web add-iam-policy-binding \
  --resource-type=app-engine \
  --member="group:engineering@company.com" \
  --role="roles/iap.httpsResourceAccessor"

# 基于设备和上下文配置访问级别
gcloud access-context-manager levels create corporate-device \
  --title="Corporate Managed Device" \
  --basic-level-spec=level-spec.yaml \
  --policy=POLICY_ID
```

### 步骤 2:实施 AWS Verified Access 实现零信任

部署 AWS Verified Access,为内部应用提供基于身份的访问。

```bash
# 创建 Verified Access 信任提供程序(OIDC)
aws ec2 create-verified-access-trust-provider \
  --trust-provider-type user \
  --user-trust-provider-type oidc \
  --oidc-options '{
    "Issuer": "https://login.microsoftonline.com/TENANT_ID/v2.0",
    "AuthorizationEndpoint": "https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/authorize",
    "TokenEndpoint": "https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/token",
    "UserInfoEndpoint": "https://graph.microsoft.com/oidc/userinfo",
    "ClientId": "CLIENT_ID",
    "ClientSecret": "CLIENT_SECRET",
    "Scope": "openid profile email"
  }'

# 创建 Verified Access 实例
aws ec2 create-verified-access-instance \
  --description "Zero Trust Access Instance"

# 将信任提供程序附加到实例
aws ec2 attach-verified-access-trust-provider \
  --verified-access-instance-id vai-INSTANCE_ID \
  --verified-access-trust-provider-id vatp-PROVIDER_ID

# 创建带策略的 Verified Access 组
aws ec2 create-verified-access-group \
  --verified-access-instance-id vai-INSTANCE_ID \
  --policy-document '{
    "Version": "2012-10-17",
    "Statement": [{
      "Effect": "Allow",
      "Principal": "*",
      "Action": "verified-access:AllowAccess",
      "Condition": {
        "StringEquals": {
          "verified-access:user/groups": "engineering"
        }
      }
    }]
  }'

# 为内部应用创建端点
aws ec2 create-verified-access-endpoint \
  --verified-access-group-id vag-GROUP_ID \
  --endpoint-type load-balancer \
  --attachment-type vpc \
  --domain-certificate-arn arn:aws:acm:REGION:ACCOUNT:certificate/CERT_ID \
  --application-domain app.internal.company.com \
  --endpoint-domain-prefix app \
  --load-balancer-options '{
    "LoadBalancerArn": "arn:aws:elasticloadbalancing:REGION:ACCOUNT:loadbalancer/app/internal-app/xxx",
    "Port": 443,
    "Protocol": "https",
    "SubnetIds": ["subnet-xxx"]
  }'
```

### 步骤 3:配置 Azure Private Link 和条件访问

设置 Azure Private Link 实现网络隔离,并配置条件访问实现基于身份的控制。

```bash
# 为 Azure 服务创建私有端点
az network private-endpoint create \
  --name app-private-endpoint \
  --resource-group production-rg \
  --vnet-name production-vnet \
  --subnet private-endpoint-subnet \
  --private-connection-resource-id /subscriptions/SUB_ID/resourceGroups/RG/providers/Microsoft.Web/sites/internal-app \
  --group-ids sites \
  --connection-name app-connection

# 为服务配置私有 DNS 区域
az network private-dns zone create \
  --resource-group production-rg \
  --name privatelink.azurewebsites.net

az network private-dns link vnet create \
  --resource-group production-rg \
  --zone-name privatelink.azurewebsites.net \
  --name production-link \
  --virtual-network production-vnet \
  --registration-enabled false
```

```powershell
# 创建要求合规设备和 MFA 的条件访问策略
Connect-MgGraph -Scopes "Policy.ReadWrite.ConditionalAccess"

$params = @{
    DisplayName = "Zero Trust - Require MFA and Compliant Device"
    State = "enabled"
    Conditions = @{
        Applications = @{
            IncludeApplications = @("All")
        }
        Users = @{
            IncludeUsers = @("All")
            ExcludeGroups = @("BreakGlass-Group-ID")
        }
        Locations = @{
            IncludeLocations = @("All")
            ExcludeLocations = @("AllTrusted")
        }
    }
    GrantControls = @{
        Operator = "AND"
        BuiltInControls = @("mfa", "compliantDevice")
    }
    SessionControls = @{
        SignInFrequency = @{
            Value = 4
            Type = "hours"
            IsEnabled = $true
        }
    }
}

New-MgIdentityConditionalAccessPolicy -BodyParameter $params
```

### 步骤 4:使用网络策略实施微分段

部署网络层微分段,以补充基于身份的访问控制。

```bash
# AWS:创建微分段安全组
aws ec2 create-security-group \
  --group-name web-tier-sg \
  --description "Web tier - only HTTPS from ALB" \
  --vpc-id vpc-PROD

aws ec2 authorize-security-group-ingress \
  --group-id sg-WEB \
  --protocol tcp --port 443 \
  --source-group sg-ALB

aws ec2 create-security-group \
  --group-name app-tier-sg \
  --description "App tier - only from web tier"

aws ec2 authorize-security-group-ingress \
  --group-id sg-APP \
  --protocol tcp --port 8080 \
  --source-group sg-WEB

# Kubernetes NetworkPolicy 实现 Pod 级别分段
cat << 'EOF' | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: api-allow-web-only
  namespace: production
spec:
  podSelector:
    matchLabels:
      app: api-server
  policyTypes:
    - Ingress
  ingress:
    - from:
        - podSelector:
            matchLabels:
              app: web-frontend
      ports:
        - protocol: TCP
          port: 8080
EOF
```

### 步骤 5:启用持续验证和日志记录

实施持续信任验证,而非一次性认证。

```bash
# 配置 CloudWatch 监控访问决策
aws logs create-log-group --log-group-name /verified-access/access-logs

# 启用 Verified Access 日志记录
aws ec2 modify-verified-access-instance-logging-configuration \
  --verified-access-instance-id vai-INSTANCE_ID \
  --access-logs '{
    "CloudWatchLogs": {
      "Enabled": true,
      "LogGroup": "/verified-access/access-logs"
    }
  }'

# 查询被拒绝的访问日志
aws logs start-query \
  --log-group-name /verified-access/access-logs \
  --start-time $(date -d "24 hours ago" +%s) \
  --end-time $(date +%s) \
  --query-string '
    fields @timestamp, identity.user, http_request.url, decision
    | filter decision = "deny"
    | sort @timestamp desc
    | limit 50
  '
```

## 核心概念

| 术语 | 定义 |
|------|------|
| 零信任(Zero Trust) | 要求对访问资源的每个人和每台设备进行严格身份验证的安全模型,与网络位置无关 |
| ZTNA | 零信任网络访问,通过提供基于身份感知、上下文的应用访问实现零信任原则的技术 |
| 身份感知代理(Identity-Aware Proxy) | 在允许访问后端应用前验证用户身份和设备上下文的代理服务,替代 VPN 访问 |
| 微分段(Micro-Segmentation) | 在单个工作负载或应用周围创建细粒度安全区域以限制横向移动的网络安全技术 |
| BeyondCorp | Google 的零信任架构实现,将访问控制从网络边界转移到个人用户和设备 |
| 持续验证(Continuous Verification) | 在整个会话中而非仅在认证时持续评估用户身份、设备健康状况和访问上下文 |

## 工具与系统

- **GCP Identity-Aware Proxy**:Google 的 BeyondCorp 实现,为 Web 应用和虚拟机提供上下文感知访问
- **AWS Verified Access**:基于身份和设备态势验证提供应用零信任访问的 AWS 服务
- **Azure Conditional Access**:Microsoft 的策略引擎,基于用户、设备、位置和风险实施上下文访问控制
- **Cloudflare Access**:云交付的 ZTNA 解决方案,为内部应用提供身份感知访问
- **Zscaler ZPA**:企业级 ZTNA 平台,通过基于身份和上下文的应用级访问替代 VPN

## 常见场景

### 场景:用零信任访问替代企业 VPN 访问云应用

**场景背景**:一个拥有 2000 名员工的组织通过传统 VPN 集中器访问 30 多个内部云应用。VPN 性能问题和安全顾虑推动了实施 ZTNA 的决策。

**方法**:
1. 梳理所有通过 VPN 访问的应用并按敏感程度分类
2. 为基于 Web 的内部应用部署 GCP IAP 或 AWS Verified Access
3. 配置条件访问策略,要求所有应用使用 MFA 和设备合规
4. 使用安全组实施微分段,限制应用层级之间的横向移动
5. 为敏感应用设置持续验证,每 4 小时重新认证
6. 分阶段迁移用户,从低风险应用开始,监控访问日志排查问题
7. 所有应用通过 ZTNA 可访问且有完整日志后,停用 VPN

**常见陷阱**:并非所有应用都支持身份感知代理集成。传统厚客户端应用可能需要基于代理的 ZTNA 解决方案而非代理方式。设备态势评估需要在所有企业设备上部署终端管理解决方案。必须为身份提供商不可用的场景记录应急访问程序。

## 输出格式

```
零信任网络访问实施报告
==================================================
组织: Acme Corp
实施日期: 2026-02-23
已迁移应用: 24 / 30

ZTNA 架构:
  身份提供商: Microsoft Entra ID
  访问代理: AWS Verified Access + GCP IAP
  设备管理: Microsoft Intune
  MFA: FIDO2 + 认证器应用

访问策略覆盖率:
  要求 MFA 的应用:              30 / 30 (100%)
  要求合规设备的应用:            24 / 30 (80%)
  启用持续验证的应用:            18 / 30 (60%)
  有位置限制的应用:              12 / 30 (40%)

安全改进:
  VPN 相关事件(之前):          12 次/月
  ZTNA 相关事件(之后):          2 次/月
  检测未授权访问的平均时间:        4 分钟(原来 2 小时)
  已消除的横向移动路径:           85%

迁移状态:
  第 1 阶段(低风险应用):        12/12 完成
  第 2 阶段(中风险应用):        12/12 完成
  第 3 阶段(高风险应用):         0/6  进行中
  VPN 停用:                     计划在第 3 阶段完成后执行
```

Related Skills

testing-for-broken-access-control

9
from killvxk/cybersecurity-skills-zh

系统性测试 Web 应用程序中的访问控制缺陷,包括权限提升、缺失的功能级检查以及不安全的直接对象引用。

securing-remote-access-to-ot-environment

9
from killvxk/cybersecurity-skills-zh

本技能涵盖为操作员、工程师和供应商实施OT/ICS环境的安全远程访问,同时防止可能危害工业运营的未授权访问。涉及跳板服务器架构、多因素认证、会话记录、特权访问管理、供应商远程访问控制,以及符合IEC 62443和NERC CIP-005远程访问要求。

scanning-network-with-nmap-advanced

9
from killvxk/cybersecurity-skills-zh

使用 Nmap 的脚本引擎、时序控制、规避技术和输出解析,对授权目标网络执行高级网络侦察, 发现主机、枚举服务、检测漏洞并识别操作系统。

performing-wireless-network-penetration-test

9
from killvxk/cybersecurity-skills-zh

执行无线网络渗透测试,通过捕获握手包、破解 WPA2/WPA3 密钥、检测流氓接入点以及使用 Aircrack-ng 和相关工具测试无线网络分段,评估 WiFi 安全性。

performing-privileged-account-access-review

9
from killvxk/cybersecurity-skills-zh

对特权账户进行系统性审查,验证访问权限,识别过多权限,并在 PAM 基础设施中执行最小权限原则。

performing-ot-network-security-assessment

9
from killvxk/cybersecurity-skills-zh

本技能涵盖对运营技术(OT)网络(包括SCADA系统、DCS架构和工业控制系统通信路径)进行全面安全评估。内容涉及Purdue参考模型各层、识别IT/OT融合风险、评估区域间防火墙规则,以及映射工业协议流量(Modbus、DNP3、OPC UA、EtherNet/IP),以检测关键基础设施中的错误配置、未授权连接和攻击面。

performing-network-traffic-analysis-with-zeek

9
from killvxk/cybersecurity-skills-zh

部署 Zeek 网络安全监控器,捕获、解析和分析网络流量元数据,用于威胁检测、异常识别和取证调查。

performing-network-traffic-analysis-with-tshark

9
from killvxk/cybersecurity-skills-zh

使用 tshark 和 pyshark 自动化网络流量分析,进行协议统计、可疑流量检测、DNS 异常识别以及从 PCAP 文件中提取威胁指标(IOC)

performing-network-packet-capture-analysis

9
from killvxk/cybersecurity-skills-zh

使用 Wireshark、tshark 和 tcpdump 对网络数据包捕获(PCAP/PCAPNG)进行取证分析,重建网络通信、提取传输文件、识别恶意流量,并建立数据渗出或命令与控制活动的证据。

performing-network-forensics-with-wireshark

9
from killvxk/cybersecurity-skills-zh

使用 Wireshark 和 tshark 捕获并分析网络流量,重建网络事件、提取制品并识别恶意通信。

performing-initial-access-with-evilginx3

9
from killvxk/cybersecurity-skills-zh

在红队演练中,使用 EvilGinx3 中间人(Adversary-in-the-Middle)钓鱼框架执行授权的初始访问,捕获会话令牌并绕过多因素认证(MFA)。

performing-external-network-penetration-test

9
from killvxk/cybersecurity-skills-zh

依照 PTES 方法论,通过侦察、扫描、漏洞利用和报告等阶段,对面向互联网的基础设施执行全面的外部网络渗透测试,识别可利用漏洞。