Microsoft Azure Attestation(MAA) 서비스는 플랫폼의 신뢰성과 그 안에서 실행되는 바이너리의 무결성을 원격으로 검증하는 통합 솔루션입니다. 이 서비스는 Intel(tm) SGX(Software Guard Extensions) Enclave 및 VBS(가상화 기반 보안) Enclave와 같은 TEE(신뢰할 수 있는 실행 환경) 상태를 증명할 수 있는 기능과 함께 TPM(신뢰할 수 있는 플랫폼 모듈)에서 지원하는 플랫폼의 증명을 지원합니다.
증명은 소프트웨어 이진 파일이 신뢰할 수 있는 플랫폼에서 올바르게 인스턴스화되었음을 보여주는 프로세스입니다. 그러면 원격 신뢰 당사자가 이러한 의도된 소프트웨어만 신뢰할 수 있는 하드웨어에서 실행된다고 확신할 수 있습니다. Azure Attestation은 증명을 위한 통합 고객 지향 서비스 및 프레임워크입니다.
Azure Attestation을 사용하면 Azure 기밀 컴퓨팅 및 인텔리전트 에지 보호와 같은 최첨단 보안 패러다임을 사용할 수 있습니다. 고객은 컴퓨터의 위치, 해당 컴퓨터의 VM(가상 머신) 상태 및 Enclave가 해당 VM에서 실행되는 환경을 독립적으로 확인하는 기능을 요청했습니다. Azure Attestation은 이러한 요청과 많은 추가 고객 요청을 지원합니다.
Azure Attestation은 컴퓨팅 엔터티로부터 증거를 받고, 클레임 집합으로 전환하고, 구성 가능한 정책에 대해 유효성을 검사하고, 클레임 기반 애플리케이션(예: 신뢰 당사자 및 감사 기관)에 대한 암호화 증명을 생성합니다.
Azure 라이브러리에 대한 보다 완전한 개요는 azure sdk typescript 릴리스를 참조하세요.
참고: 이 SDK는 Microsoft Azure Attestation 서비스의 미리보기 SDK입니다. Azure Attestation 서비스에 접근하는 데 필요한 모든 필수 기능을 제공하며, 'as-is'로 간주되어야 하며, 향후 변경될 수 있어 이전 버전과의 호환성이 깨질 수 있습니다.
키 링크:
시작하기
현재 지원되는 환경
- LTS 버전의 Node.js
- Safari, Chrome, Edge 및 Firefox의 최신 버전입니다.
자세한 내용은 지원 정책 참조하세요.
Prerequisites
- Azure 구독
- 기존의 Azure Attestation 인스턴스를 사용하거나, 각 Azure 리전에서 제공되는 "공유 공급자"를 사용할 수 있습니다. Azure Attestation 서비스 인스턴스를 생성해야 하는 경우 Azure Portal 또는 Azure CLI를 사용할 수 있습니다.
@azure/attestation 패키지 설치
NPM을 사용하여 JavaScript용 Microsoft Azure Attestation 클라이언트 라이브러리를 설치하세요:
npm install @azure/attestation
클라이언트 인증
Microsoft Azure Attestation 서비스와 상호작용하려면 Attestation Client 또는 Attestation Administration Client 클래스의 인스턴스를 생성해야 합니다. 인증( attestation) 인스턴스 URL이 필요하며, 이는 포털에 표시되는 "Attest URI"이거나 공유 인증서 제공자 중 하나일 것입니다.
또한 인증 관리 클라이언트를 사용하거나 API를 attestTpm 호출하려면 클라이언트 자격 증명이 필요합니다. 클라이언트 자격 증명은 클라이언트 객체를 인스턴스화하기 위해 (클라이언트 ID, 클라이언트 시크릿, 테넌트 ID) 가 필요합니다.
이 시작 섹션에서는 DefaultAzureCredential 공급자를 통한 클라이언트 비밀 자격 증명을 사용해 인증하지만, @azure/ID 패키지를 통한 더 많은 인증 메커니즘도 제공합니다. 패키지를 @azure/identity 설치하려면:
npm install @azure/identity
자격 증명 만들기/가져오기
아래 Azure CLI 코드 조각을 사용하여 클라이언트 비밀 자격 증명을 만들거나 가져옵니다.
서비스 주체를 만들고 Azure 리소스에 대한 액세스를 구성합니다.
az ad sp create-for-rbac -n <your-application-name> --skip-assignment출력:
{ "appId": "generated-app-ID", "displayName": "dummy-app-name", "name": "http://dummy-app-name", "password": "random-password", "tenant": "tenant-ID" }서비스 주체 objectId를 기록해 둡
az ad sp show --id <appId> --query objectId출력:
"<your-service-principal-object-id>"위에서 반환된 자격 증명을 사용하여 AZURE_CLIENT_ID (appId), AZURE_CLIENT_SECRET (비밀번호), AZURE_TENANT_ID (테넌트) 환경 변수를 설정합니다. 다음 예제에서는 Powershell에서 이 작업을 수행하는 방법을 보여줍니다.
$Env:AZURE_CLIENT_ID="generated-app-ID"
$Env:AZURE_CLIENT_SECRET="random-password"
$Env:AZURE_TENANT_ID="tenant-ID"
Azure Identity API와 사용 방법에 대한 자세한 내용은 Azure Identity 클라이언트 라이브러리를 참조하세요
주요 컨셉
이 미리보기 SDK에는 네 가지 주요 기능 계열이 제공됩니다:
- SGX 및 TPM 엔클레이브 인증.
- MAA 인증 토큰 서명 인증서 검색 및 검증.
- 공증 정책 관리.
- 인증 정책 관리 인증서 관리 (네, 정책 관리 관리입니다).
Microsoft Azure Attestation 서비스는 "격리됨" 및 "AAD"의 두 가지 별도 모드로 실행됩니다. 서비스가 "격리" 모드에서 실행되는 경우 고객은 인증 자격 증명 이외의 추가 정보를 제공하여 증명 인스턴스의 상태를 수정할 권한이 있는지 확인해야 합니다.
마지막으로, Microsoft Azure Attestation 서비스가 제공되는 각 지역은 "공유" 인스턴스를 지원하며, 이를 통해 Azure 기준선에 대한 검증만 필요한 SGX 엔클레이브를 인증할 수 있습니다(공유 공급자에는 정책이 적용되지 않습니다). 공유 공급자에서는 TPM 인증이 제공되지 않습니다. 공유 인스턴스는 AAD 인증이 필요하지만, RBAC 정책은 없으며, 유효한 AAD 보유자 토큰을 가진 고객은 공유 인스턴스를 사용하여 인증할 수 있습니다.
Attestation
SGX 또는 TPM 증명은 신뢰할 수 있는 실행 환경에서 수집된 증명의 유효성을 검사하여 해당 환경에 대한 Azure 기준과 해당 환경에 적용된 고객 정의 정책을 모두 충족하는지 확인하는 프로세스입니다.
인증 서비스 토큰 서명 인증서 검색 및 검증
Azure Attestation 서비스의 핵심 운영 보장 중 하나는 서비스가 "운영 상의 TCB 외부" 방식으로 운영된다는 점입니다. 즉, Microsoft 운영자가 서비스 운영을 조작하거나 클라이언트로부터 전송된 데이터를 손상시킬 수 있는 방법은 없습니다. 이 보장을 보장하기 위해 인증 서비스의 핵심은 Intel(tm) SGX 인클레이브에서 실행됩니다.
고객이 작업이 실제로 엔클레이브 내에서 수행되었는지 확인할 수 있도록, Attestation Service의 대부분의 응답은 인증 서비스 엔클레이브 내에 보유된 키로 서명된 JSON 웹 토큰으로 인코딩됩니다.
이 토큰은 지정된 인스턴스에 대해 MAA 서비스에서 발급한 서명 인증서로 서명됩니다.
만약 MAA 서비스 인스턴스가 SGX 엔클레이브에서 서비스가 실행되는 지역에서 실행 중이라면, 서버가 발급한 인증서를 oe_verify_attestation_certificate API를 통해 검증할 수 있습니다.
객체는 AttestationResponse 두 가지 주요 속성을 포함합니다: token 와 value. 속성에는 token 증명 서비스가 반환한 전체 토큰이 포함되며, 속성에는 value JSON 웹 토큰 응답의 본문이 포함됩니다.
정책 관리
각 증명 서비스 인스턴스에는 고객이 정의한 추가 조건을 정의하는 정책이 적용됩니다.
증명 정책에 대한 자세한 내용은 증명 정책을 참조하세요.
정책 관리 인증서 관리
증명 인스턴스가 "격리" 모드로 실행 중이면, 인스턴스를 생성한 고객은 인스턴스가 생성될 때 정책 관리 인증서를 제공한 상태입니다. 모든 정책 수정 작업은 고객이 기존 정책 관리 인증서 중 하나로 정책 데이터에 서명해야 합니다. 정책 관리 인증서 관리 API는 클라이언트가 정책 관리 인증서를 "롤링"할 수 있도록 합니다.
격리 모드 및 AAD 모드
각 Microsoft Azure Attestation 서비스 인스턴스는 "AAD" 모드 또는 "Isolated" 모드로 동작합니다. MAA 인스턴스가 AAD 모드로 동작할 때, 이는 인증서 인스턴스를 생성한 고객이 Azure Active Directory 및 Azure 역할 기반 접근 제어 정책을 통해 인증서 인스턴스에 대한 접근을 검증하도록 허용한다는 의미입니다.
AttestationType
Microsoft Azure Attestation 서비스는 환경에 따라 다양한 유형의 증거를 인증하는 것을 지원합니다. 현재 MAA는 다음과 같은 신뢰할 수 있는 실행 환경을 지원합니다:
- OpenEnclave - SGX Enclave 내에서 코드를 실행하는 Intel(tm) 프로세서로, OpenEnclave
oe_get_report또는oe_get_evidenceAPI를 통해 인증 증거를 수집했습니다. - SgxEnclave - Intel SGX SDK를 사용하여 인증 증거를 수집한 SGX Enclave에서 코드를 실행하는 Intel(tm) 프로세서입니다.
- Tpm - 프로세서의 신뢰 플랫폼 모듈을 사용하여 증명 증거를 제공하는 가상화 기반 보안 환경입니다.
런타임 데이터 및 초기 시간 데이터
RuntimeData는 Intel SGX Quote 생성 로직이나 oe_get_report/oe_get_evidence API에 제공되는 데이터를 의미합니다. attest API 호출자가 속성을 제공 runtime_data 했다면, Azure Attestation 서비스는 SGX Quote/OE Report/OE Evidence의 필드 처음 32바이트 report_data 가 해당 필드의 SHA256 해시runtime_data와 일치하는지 검증합니다.
InitTime 데이터는 인증될 SGX 인클레이브를 구성하는 데 사용되는 데이터를 의미합니다.
Azure DCsv2-Series 가상 머신에서는 InitTime 데이터가 지원되지 않는다는 점에 유의하세요.
추가 개념
예시
클라이언트 인스턴스 생성
기본 Azure 자격 증명(DefaultAzureCredential)을 사용하여 uri endpoint에 인증 클라이언트 인스턴스를 생성합니다.
import { DefaultAzureCredential } from "@azure/identity";
import { AttestationClient } from "@azure/attestation";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const credentials = new DefaultAzureCredential();
const client = new AttestationClient(endpoint, credentials);
// Retrieve the set of attestation policy signers from the attestation client.
const attestationSigners = await client.getAttestationSigners();
API를 attestTpm 호출하지 않는 경우, 인증용 클라이언트에 접근하기 위해 자격 증명을 제공할 필요가 없습니다. 이는 다음을 간단히 사용하여 클라이언트를 생성할 수 있음을 의미합니다:
import { AttestationClient } from "@azure/attestation";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const client = new AttestationClient(endpoint);
// Retrieve the set of attestation policy signers from the attestation client.
const attestationSigners = await client.getAttestationSigners();
uri endpoint에서 인증 관리 클라이언트 인스턴스를 생성합니다.
관리 클라이언트는 Azure 자격 증명이 필요하다는 점에 유의하세요.
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
import { DefaultAzureCredential } from "@azure/identity";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
// Retrieve the SGX policy from the specified attestation instance.
const policyResponse = await client.getPolicy(KnownAttestationType.SgxEnclave);
인증 정책 받기
이 메서드는 getPolicy 서비스에서 증명 정책을 가져옵니다.
증명 정책은 인증서 유형별로 인스턴스화되며, 매개변수는 AttestationType 검색할 인스턴스 유형을 정의합니다.
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
import { DefaultAzureCredential } from "@azure/identity";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
const policyResponse = await client.getPolicy(KnownAttestationType.OpenEnclave);
지정된 증명 유형에 대한 인증 정책 설정하기
증명 서비스 인스턴스가 격리 모드로 실행 중이라면, set_policy API는 호출자가 인증 인스턴스의 정책을 수정할 권한이 있는지 검증하는 데 사용할 수 있는 서명 인증서(및 개인 키)를 제공해야 합니다. 서비스 인스턴스가 AAD 모드로 실행 중인 경우, 서명 인증서와 키는 선택 사항입니다.
서비스 인스턴스가 AAD 모드로 실행 중인 경우, setPolicy 호출은 예상과 같습니다:
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
import { DefaultAzureCredential } from "@azure/identity";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
const newPolicy = `<New Attestation Policy>`;
// Set the new attestation policy. Set the policy as an unsecured policy.
const setPolicyResult = await client.setPolicy(KnownAttestationType.SgxEnclave, newPolicy);
서비스 인스턴스가 격리 모드로 실행 중인 경우, setPolicy 호출은 클라이언트가 정책 관리 개인 키와 인증서 중 하나에 접근할 수 있음을 증명할 수 있어야 합니다.
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
import { DefaultAzureCredential } from "@azure/identity";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
const newPolicy = `<New Policy Document>`;
// Set the new attestation policy. Set the policy as an secured policy.
const privateKey = "<Retrieve isolated mode private key from storage>";
const certificate = "<Retrieve certificate associated with that private key>";
const setPolicyResult = await client.setPolicy(KnownAttestationType.OpenEnclave, newPolicy, {
privateKey: privateKey,
certificate: certificate,
});
그 안에서 setPolicy API는 정책 문서 certificate 에 포함된 JSON 웹 토큰을 생성하고, 이를 통해 서명 privateKey 한 후 인증 서비스로 전송됩니다.
클라이언트가 인증 서비스 인클레이브가 정책 문서를 받기 전에 수정되지 않았는지 확인하고자 하는 경우, PolicyResult objct에서 반환된 속성을 사용하여 서비스가 정책 문서를 받았는지 확인할 수 있습니다:
-
policySigner- 통화에setPolicyacertificate가 포함된 경우, 이 값은 통화 시setPolicy점에 제공된 인증서가 됩니다. 정책 서명자가 설정되지 않은 경우, 이 항목은 null로 표시됩니다. -
policyTokenHash- 이는 setPolicy API에 대해 서비스에 전송된 JSON 웹 서명 의 해시입니다.
해시를 검증하기 위해 클라이언트는 인증 정책 토큰(인증 정책 설정에 사용되는 토큰을 나타내는 헬퍼 클래스)을 생성하고, 그 토큰으로부터 생성된 해시를 검증할 수 있습니다:
import { createAttestationPolicyToken } from "@azure/attestation";
import { createHash } from "node:crypto";
// Set the new attestation policy. Set the policy as an secured policy.
const privateKey = "<Retrieve isolated mode private key from storage>";
const certificate = "<Retrieve certificate associated with that private key>";
const expectedPolicy = createAttestationPolicyToken(`<Policy Document>`, privateKey, certificate);
// Use your favorite SHA256 hash generator function to create a hash of the stringified JWS.
const expectedHash = createHash("sha256").update(expectedPolicy.serialize()).digest("hex");
SGX와 오픈 엔클레이브를 증명하세요
메서드를 attestSgxEnclave 사용하여 SGX enclave를 증명합니다.
고객들이 암호화된 환경과 상호작용할 때 직면하는 핵심 과제 중 하나는 환경에서 실행 중인 코드('enclave code')와 안전하게 통신할 수 있도록 하는 방법입니다.
이 문제에 대한 한 가지 해결책은 'Secure Key Release'라고 불리는 방식으로, 이는 enclave 코드와의 안전한 통신을 가능하게 하는 패턴입니다.
"Secure Key Release" 패턴을 구현하기 위해 엔클레이브 코드는 일시적인 비대칭 키를 생성합니다. 그 후 키의 공개 부분을 어떤 형식(가능하면 JSON 웹 키, PEM 또는 다른 직렬화 형식)으로 직렬화합니다.
그 후 엔클레이브 코드는 공개키의 SHA256 값을 계산해 입력으로 코드에 전달하고, 코드는 SGX 인용문을 생성합니다(OpenEnclave의 경우 oe_get_evidence 또는 oe_get_report가 해당됩니다).
클라이언트는 이후 SGX 견적과 직렬화된 키를 인증 서비스에 전송합니다. 인증 서비스는 견적을 검증하고 키의 해시가 견적에 포함되어 있는지 확인한 후 "증명 토큰"을 발급합니다.
클라이언트는 그 후 해당 인증 토큰(직렬화된 키가 포함된 토큰)을 제3자 "의존 당사자"에게 보낼 수 있습니다. 그 후 의존 당사자는 인증 토큰이 인증 서비스에 의해 생성되었음을 검증하며, 따라서 직렬화된 키를 사용하여 "의존 당사자"가 보유한 일부 데이터를 암호화하여 서비스에 전송할 수 있습니다.
이 예제는 요청과 연결된 인증서 토큰을 가져오기 위해 어트증 서비스를 호출하는 한 가지 일반적인 패턴을 보여줍니다.
이 예제는 엔드포인트에 Attest URI가 구성된 기존 AttestationClient 객체가 있다고 가정합니다. 또한 테스트하려는 SGX 엔클레이브 내에서 생성된 OpenEnclave 보고서report()와 SGX 견적에서 참조되는 "런타임 데이터"(binaryRuntimeData)가 있다고 가정합니다.
import { DefaultAzureCredential } from "@azure/identity";
import { AttestationClient } from "@azure/attestation";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const credentials = new DefaultAzureCredential();
const client = new AttestationClient(endpoint, credentials);
const report = new Uint8Array(0); // Report data from the enclave.
const binaryRuntimeData = new Uint8Array(0); // Runtime data from the enclave.
const attestationResult = await client.attestOpenEnclave(report, {
runTimeData: binaryRuntimeData,
});
또한 인증(attestation) 서비스로 전송된 내용 binaryRuntimeData 이 JSON 데이터로 해석되도록 의도되었을 가능성도 있습니다. 이 경우 클라이언트는 attest API 호출에서 다음을 지정 runTimeJson 해야 합니다:
import { DefaultAzureCredential } from "@azure/identity";
import { AttestationClient } from "@azure/attestation";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const credentials = new DefaultAzureCredential();
const client = new AttestationClient(endpoint, credentials);
const report = new Uint8Array(0); // Report data from the enclave.
const binaryRuntimeData = new Uint8Array(0); // Runtime JSON data from the enclave.
const attestationResult = await client.attestOpenEnclave(report, {
runTimeJson: binaryRuntimeData,
});
마찬가지로, Intel SDK를 사용해 "견적"을 생성하는 경우, 다음과 같은 방법으로 견적을 검증할 수 있습니다:
import { DefaultAzureCredential } from "@azure/identity";
import { AttestationClient } from "@azure/attestation";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const credentials = new DefaultAzureCredential();
const client = new AttestationClient(endpoint, credentials);
const quote = new Uint8Array(0); // Quote data.
const binaryRuntimeData = new Uint8Array(0); // Runtime JSON data from the enclave.
const attestationResult = await client.attestSgxEnclave(quote, {
runTimeData: binaryRuntimeData,
});
인증 토큰 검증 수행 방법에 대한 추가 정보는 MAA 서비스 인증 샘플에서 확인할 수 있습니다.
토큰 인증서 검색
인증 서비스에서 반환된 토큰을 검증하는 데 사용할 수 있는 인증서를 검색하는 데 사용합니다 getSigningCertificates . 이 호출은 Azure 자격 증명이 포함된 클라이언트를 생성하지만, 또는 attestOpenEnclave API를 호출 attestSgxEnclave 하는 경우에는 이 계정이 필요하지 않다는 점에 유의하세요
import { DefaultAzureCredential } from "@azure/identity";
import { AttestationClient } from "@azure/attestation";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const credentials = new DefaultAzureCredential();
const client = new AttestationClient(endpoint, credentials);
const attestationSigners = await client.getAttestationSigners();
console.log(`There are ${attestationSigners.length} signers`);
Troubleshooting
대부분의 Attestation 서비스 작업은 Azure Core에서 정의된 예외를 발생시킵니다. 인증 서비스 API는 실패 시 유용한 오류 코드와 함께 '실패'를 띄 RestError 웁니다. 이러한 오류의 대부분은 복구할 수 있습니다.
import { DefaultAzureCredential } from "@azure/identity";
import { AttestationClient } from "@azure/attestation";
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
const credentials = new DefaultAzureCredential();
const client = new AttestationClient(endpoint, credentials);
const openEnclaveReport = new Uint8Array(0); // Open enclave report data
try {
await client.attestSgxEnclave(openEnclaveReport);
} catch (error) {
console.log(`Exception thrown for invalid request: ${error.message}`);
}
Logging
로깅을 사용하도록 설정하면 오류에 대한 유용한 정보를 파악하는 데 도움이 될 수 있습니다. HTTP 요청 및 응답 로그를 보려면 AZURE_LOG_LEVEL 환경 변수를 info설정합니다. 또는 setLogLevel@azure/logger 호출하여 런타임에 로깅을 사용하도록 설정할 수 있습니다.
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
로그를 사용하도록 설정하는 방법에 대한 자세한 지침은 @azure/로거 패키지 문서를 참조하세요.
MAA 서비스에 대한 추가 문제 해결 정보는 여기에서 확인할 수 있습니다
다음 단계
Microsoft Azure Attestation 서비스에 대한 자세한 내용은 설명서 페이지를 참조하세요.
Contributing
이 프로젝트는 기여와 제안을 환영합니다. 대부분의 기여는 귀하가 귀하의 기여를 사용할 권리를 부여할 권리가 있음을 선언하는 CLA(기여자 사용권 계약)에 동의해야 합니다. 자세한 내용은 기여자 라이선스 계약 사이트를 방문하세요.
끌어오기 요청을 제출하면 CLA 봇은 CLA를 제공하고 PR을 적절하게 데코레이팅해야 하는지 여부를 자동으로 결정합니다(예: 레이블, 주석). 봇에서 제공하는 지침을 따르기만 하면 됩니다. CLA를 사용하여 모든 리포지토리에서 한 번만 이 작업을 수행해야 합니다.
이 프로젝트는 Microsoft 오픈 소스 준수 사항을 채택했습니다. 자세한 내용은 행동강령 FAQ를 참조하시거나 추가 질문이나 의견이 있으시면 연락 opencode@microsoft.com 해 주세요.
이 라이브러리들에 대한 구축, 테스트 및 기여에 대한 자세한 내용은 CONTRIBUTING.md 를 참조하십시오.
피드백 제공
버그를 발견하거나 제안이 있으시면 프로젝트의 이슈 섹션에 문제를 제출해 주세요.
관련 프로젝트
Azure SDK for JavaScript