implementing-aws-nitro-enclave-security
它能做什么
这个工具可以帮你在 AWS 中创建一种叫做 Nitro Enclaves 的安全环境。它会把个人信息或加密密钥等敏感数据隔离在虚拟机的受保护区域中,即使是管理员也无法访问。
适用场景
- ✓保护高度敏感的数据,例如健康或金融信息。
- ✓确保处理机密信息的代码只在经过验证的环境中运行。
- ✓让不同的安全环境之间可靠地互相通信。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-aws-nitro-enclave-security/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我在 AWS 中设置一个安全环境来处理患者数据,并确保只有经过授权的代码才能解密这些信息。”
每周 5 个新技能,1 分钟读完。
工作原理
你需要使用特定的 AWS 工具,把代码打包成一个“enclave 镜像”,并配置安全策略,确保只有这个特定镜像才能访问加密密钥。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Implementing AWS Nitro Enclave Security
When to Use
- Processing sensitive data (PII, PHI, financial records, cryptographic secrets) that must be isolated from EC2 instance operators and administrators
- Building confidential computing pipelines where even root-level access on the parent instance cannot read enclave memory or state
- Implementing cryptographic attestation workflows that tie KMS decryption rights to a specific, verified enclave image hash
- Deploying multi-party computation environments where two or more enclaves authenticate each other via attestation before exchanging data
- Hardening existing workloads that currently decrypt secrets on the parent instance by migrating decryption into an enclave boundary
Do not use when the workload does not handle sensitive data that requires hardware-level isolation, when the instance type does not support Nitro Enclaves (requires Nitro-based instances with at least 4 vCPUs), or when latency constraints make the vsock communication overhead unacceptable.
Prerequisites
- An AWS account with permissions to launch Nitro-capable EC2 instances (m5.xlarge or larger, C5, R5, M6i families)
- AWS CLI v2 and the
nitro-clitoolset installed on the parent EC2 instance (Amazon Linux 2 or AL2023) - Docker installed on the parent instance for building enclave image files (EIF)
- An AWS KMS symmetric key with key policy permissions for the enclave's IAM role
- The
aws-nitro-enclaves-sdk-cor Pythonaws-encryption-sdkfor enclave-side KMS operations - The Nitro Enclaves allocator service configured with sufficient memory and vCPU allocation in
/etc/nitro_enclaves/allocator.yaml
Workflow
Step 1: Configure the Nitro Enclaves Environment
Set up the parent EC2 instance to support enclave launches:
- Install the Nitro Enclaves CLI: On Amazon Linux 2, install the tools and allocator:
sudo amazon-linux-extras install aws-nitro-enclaves-cli sudo yum install aws-nitro-enclaves-cli-devel -y sudo systemctl enable --now nitro-enclaves-allocator.service sudo systemctl enable --now docker sudo usermod -aG ne ec2-user sudo usermod -aG docker ec2-user - Configure memory and CPU allocation: Edit
/etc/nitro_enclaves/allocator.yamlto reserve resources for the enclave. The enclave requires dedicated memory that is carved from the parent instance:
Restart the allocator:--- memory_mib: 4096 cpu_count: 2sudo systemctl restart nitro-enclaves-allocator.service - Verify setup: Run
nitro-cli describe-enclavesto confirm the CLI can communicate with the Nitro hypervisor. An empty JSON array[]indicates no enclaves are running and the setup is correct.
Step 2: Build the Enclave Image File (EIF)
Package the sensitive workload into a signed enclave image:
Create the application Dockerfile: The enclave runs a minimal Linux environment. The application communicates exclusively through vsock:
FROM amazonlinux:2 RUN yum install -y python3 python3-pip && \ pip3 install boto3 cbor2 cryptography requests COPY enclave_app.py /app/enclave_app.py WORKDIR /app CMD ["python3", "enclave_app.py"]Build the EIF with nitro-cli: Convert the Docker image into an enclave image file, capturing the PCR measurements:
docker build -t enclave-app:latest . nitro-cli build-enclave \ --docker-uri enclave-app:latest \ --output-file enclave-app.eifThe output contains three critical PCR values:
- PCR0: SHA-384 hash of the enclave image file (the full image digest)
- PCR1: SHA-384 hash of the Linux kernel and bootstrap process
- PCR2: SHA-384 hash of the application code Record these values; they are used in KMS key policies for attestation-based access control.
Build a signed EIF (recommended for production): Generate a signing certificate and use it to produce PCR8:
openssl ecparam -name secp384r1 -genkey -noout -out enclave_key.pem openssl req -new -key enclave_key.pem -sha384 \ -nodes -subj "/CN=Enclave Signer" -out enclave_csr.pem openssl x509 -req -days 365 -in enclave_csr.pem \ -signkey enclave_key.pem -sha384 -out enclave_cert.pem nitro-cli build-enclave \ --docker-uri enclave-app:latest \ --output-file enclave-app.eif \ --private-key enclave_key.pem \ --signing-certificate enclave_cert.pem
…
常见问题
什么是 Nitro Enclaves?
它是一种机密计算环境,能在 AWS 虚拟机内隔离数据和代码,即使是系统管理员也无法接触到它们。
什么是“证明”(attestation)?
这是一个验证过程,用来证明你的代码确实在安全可信的环境中按预期运行,然后才允许它访问敏感数据。
需要特殊的硬件吗?
需要。你要使用支持 Nitro 技术、且至少有 4 个 vCPU 的 AWS 虚拟机。
详情
作者的原始描述
Build AWS Nitro Enclave confidential computing environments using nitro-cli to create enclave images, configure attestation-aware KMS policies with PCR condition keys, validate attestation documents against the Nitro PKI root, and set up vsock/kmstool-enclave-cli pipelines for processing PII, keys, and health records. Use for Nitro Enclave setup, attestation validation, or scoping KMS to an enclav
热度
- GitHub 星标
- 35k
- 排名
- #8000
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。