

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 信頼プロバイダーから Verified Access に送信されるトラストデータ
<a name="trust-data"></a>

信頼データは、信頼プロバイダー AWS Verified Access から に送信されるデータです。トラストデータは、「ユーザークレーム」または「信頼コンテキスト」とも呼ばれます。データには通常、ユーザーまたはデバイスに関する情報が含まれます。トラストデータの例には、ユーザーの E メール、グループメンバーシップ、デバイスのオペレーティングシステムのバージョン、デバイスのセキュリティ状態などがあります。送信される情報は信頼プロバイダーによって異なるため、最新のトラストデータの完全なリストについては、信頼プロバイダーのドキュメントを参照してください。

ただし、Verified Access のログ記録機能を使用すれば、信頼プロバイダーからどのようなトラストデータが送信されているかを確認することもできます。これは、アプリケーションへのアクセスを許可または拒否するポリシーを定義するときに役立つ可能性があります。ログにトラストコンテキストを含める方法については、[Verified Access 信頼コンテキストの有効化または無効化](include-trust-context.md) を参照してください。

このセクションでは、ポリシーの作成を開始するときに役立つトラストデータのサンプルと例を示します。ここに記載されている情報は、例示を目的とするもので、正式なレファレンスではありません。

**Topics**
+ [デフォルトコンテキスト](trust-data-default-context.md)
+ [AWS IAM アイデンティティセンター コンテキスト](trust-data-iam.md)
+ [サードパーティーのコンテキスト](trust-data-third-party-trust.md)
+ [ユーザークレームの引き渡し](user-claims-passing.md)

# Verified Access トラストデータのデフォルトコンテキスト
<a name="trust-data-default-context"></a>

AWS Verified Access には、設定された信頼プロバイダーに関係なく、すべての Cedar 評価に現在のリクエストに関するいくつかの要素がデフォルトで含まれています。必要に応じて、データに対して評価を行うポリシーを作成できます。

以下は、評価に含まれるデータの例です。

**Topics**
+ [HTTP リクエスト](#default-context-http-request)
+ [TCP フロー](#default-context-tcp-flow)

## HTTP リクエスト
<a name="default-context-http-request"></a>

ポリシーが評価されると、Verified Access は `context.http_request`キーの Cedar コンテキストに現在の HTTP リクエストに関するデータを含めます。

```
{
    "title": "HTTP Request data included by Verified Access",
    "type": "object",
    "properties": {
        "http_method": {
            "type": "string",
            "description": "The HTTP method",
            "example": "GET"
        },
        "hostname": {
            "type": "string",
            "description": "The host subcomponent of the authority component of the URI",
            "example": "example.com"
        },
        "path": {
            "type": "string",
            "description": "The path component of the URI",
            "example": "app/images"
        },
        "query": {
            "type": "string",
            "description": "The query component of the URI",
            "example": "value1=1&value2=2"
        },
        "x_forwarded_for": {
            "type": "string",
            "description": "The value of the X-Forwarded-For request header",
            "example": "17.7.7.1"
        },
        "port": { 
           "type": "integer",
           "description": "The endpoint port",
           "example": 443
        },
        "user_agent": {
            "type": "string",
            "description": "The value of the User-Agent request header",
            "example": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
        },
        "client_ip": {
            "type": "string",
            "description": "The IP address connecting to the endpoint",
            "example": "15.248.6.6"
        }
    }
}
```

**ポリシーの例**  
以下は、HTTP リクエストデータを使用する Cedar ポリシーの例です。

```
forbid(principal, action, resource) when {
   context.http_request.http_method == "POST"
   && !(context.identity.roles.contains("Administrator"))
 };
```

## TCP フロー
<a name="default-context-tcp-flow"></a>

ポリシーが評価されると、Verified Access は`context.tcp_flow`キーの下の Cedar コンテキストに現在の TCP フローに関するデータを含めます。

```
{
    "title": "TCP flow data included by Verified Access",
    "type": "object",
    "properties": {
        "destination_ip": {
            "type": "string",
            "description": "The IP address of the target",
            "example": "192.100.1.3"
        },
        "destination_port": {
            "type": "string",
            "description": "The target port",
            "example": 22
        },
        "client_ip": {
            "type": "string",
            "description": "The IP address connecting to the endpoint",
            "example": "172.154.16.9"
        }
    }
}
```

# AWS IAM アイデンティティセンター Verified Access 信頼データのコンテキスト
<a name="trust-data-iam"></a>

ポリシーが評価されると、 を信頼プロバイダー AWS IAM アイデンティティセンター として定義すると、 AWS Verified Access は、信頼プロバイダー設定で「ポリシー参照名」として指定したキーの Cedar コンテキストに信頼データを含めます。必要に応じて、トラストデータに対して評価するポリシーを作成できます。

**注記**  
信頼プロバイダーのコンテキストキーは、信頼プロバイダーの作成時に設定したポリシーレファレンス名から取得されます。たとえば、ポリシーレファレンスを「idp123」と設定した場合、コンテキストキーは「context.idp123」となります。ポリシーを作成する際は、正しいコンテキストキーを使用していることを確認してください。

次の [JSON スキーマ](https://json-schema.org/)は、評価に含まれるデーを示しています。

```
{
   "title": "AWS IAM Identity Center context specification",
   "type": "object",
   "properties": {
     "user": {
       "type": "object",
       "properties": {
         "user_id": {
           "type": "string",
           "description": "a unique user id generated by AWS IdC"
         },
         "user_name": {
           "type": "string",
           "description": "username provided in the directory"
         },
         "email": {
           "type": "object",
           "properties": {
             "address": {
               "type": "email",
               "description": "email address associated with the user"
             },
             "verified": {
               "type": "boolean",
               "description": "whether the email address has been verified by AWS IdC"
             }
           }
         }
       }
     },
     "groups": {
       "type": "object",
       "description": "A list of groups the user is a member of",
       "patternProperties": {
         "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$": {
           "type": "object",
           "description": "The Group ID of the group",
           "properties": {
             "group_name": {
               "type": "string",
               "description": "The customer-provided name of the group"
             }
           }
         }
       }
     }
   }
 }
```

以下は、 AWS IAM アイデンティティセンターが提供するトラストデータに対して評価を行うポリシーの例です。

```
permit(principal, action, resource) when {
   context.idc.user.email.verified == true
   // User is in the "sales" group with specific ID
   && context.idc.groups has "c242c5b0-6081-1845-6fa8-6e0d9513c107"
 };
```

**注記**  
グループ名は変更できるため、IAM アイデンティティセンターはグループ ID を使用してグループを参照します。これにより、グループの名前を変更する際にポリシーステートメントが破られるのを防ぐことができます。

# Verified Access トラストデータのサードパーティー信頼プロバイダーのコンテキスト
<a name="trust-data-third-party-trust"></a>

このセクションでは、サードパーティーの信頼プロバイダー AWS Verified Access から に提供される信頼データについて説明します。

**注記**  
信頼プロバイダーのコンテキストキーは、信頼プロバイダーの作成時に設定したポリシーレファレンス名から取得されます。たとえば、ポリシーレファレンスを「idp123」と設定した場合、コンテキストキーは「context.idp123」となります。ポリシーを作成する際は、正しいコンテキストキーを使用していることを確認してください。

**Topics**
+ [ブラウザ拡張](#trust-data-browser)
+ [Jamf](#trust-data-iam-jamf)
+ [CrowdStrike](#trust-data-iam-cs)
+ [JumpCloud](#trust-data-jc)

## ブラウザ拡張
<a name="trust-data-browser"></a>

アクセスポリシーにデバイスの信頼コンテキストを組み込む場合は、 AWS Verified Access ブラウザ拡張機能または別のパートナーのブラウザ拡張機能が必要です。Verified Access は、現在 Google Chrome と Mozilla Firefox ブラウザをサポートしています。

現在、Jamf (macOS デバイスをサポート)、CrowdStrike (Windows 11 デバイスと Windows 10 デバイスをサポート)、および JumpCloud (Windows と MacOS の両方をサポート) の 3 つのデバイス信頼プロバイダーをサポートしています。
+ ポリシーで **Jamf** 信頼データを使用している場合、ユーザーは AWS Verified Access ブラウザ拡張機能を [Chrome ウェブストア](https://chromewebstore.google.com/category/extensions)または [Firefox アドオンサイト](https://addons.mozilla.org/en-US/firefox/)からデバイスにダウンロードしてインストールする必要があります。
+ ポリシーで **CrowdStrike** トラストデータを使用している場合、ユーザーはまず [AWS Verified Access Native Messaging Host](https://d3p8dc6667u8pq.cloudfront.net/WPF/latest/AWS_Verified_Access_Native_Messaging_Host.msi) (直接ダウンロードリンク) をインストールする必要があります。このコンポーネントは、ユーザーのデバイスで実行されている CrowdStrike エージェントからトラストデータを取得するために必要です。次に、このコンポーネントをインストールした後、ユーザーは [Chrome ウェブストア](https://chromewebstore.google.com/category/extensions)または [Firefox アドオンサイト](https://addons.mozilla.org/en-US/firefox/)から AWS Verified Access ブラウザ拡張機能をデバイスにインストールする必要があります。
+ **JumpCloud** を使用している場合、ユーザーのデバイスには [Chrome ウェブストア](https://chromewebstore.google.com/category/extensions)または [Firefox アドオンサイトの](https://addons.mozilla.org/en-US/firefox/) JumpCloud ブラウザ拡張機能がインストールされている必要があります。

## Jamf
<a name="trust-data-iam-jamf"></a>

Jamf はサードパーティー信頼プロバイダーです。ポリシーが評価される際に、Jamf を信頼プロバイダーとして定義すると、Verified Access は、信頼プロバイダー設定で「ポリシーレファレンス名」として指定するキーの下の Cedar コンテキスト内のトラストデータを含めます。必要に応じて、トラストデータに対して評価するポリシーを作成できます。次の [JSON スキーマ](https://json-schema.org/)は、評価に含まれるデーを示しています。

Verified Access で Jamf を使用する方法の詳細については、Jamf ウェブサイトの「[AWS Verified Access と Jamf Device Identity との統合](https://docs.jamf.com/technical-papers/jamf-security/aws-verified-access/index.html)」を参照してください。

```
{
    "title": "Jamf device data specification",
    "type": "object",
    "properties": {
        "iss": {
            "type": "string",
            "description": "\"Issuer\" - the Jamf customer ID"
        },
        "iat": {
            "type": "integer",
            "description": "\"Issued at Time\" - a unixtime (seconds since epoch) value of when the device information data was generated"
        },
        "exp": {
            "type": "integer",
            "description": "\"Expiration\" - a unixtime (seconds since epoch) value for when this device information is no longer valid"
        },
        "sub": {
            "type": "string",
            "description": "\"Subject\" - either the hardware UID or a value generated based on device location"
        },
        "groups": {
            "type": "array",
            "description": "Group IDs from UEM connector sync",
            "items": {
                "type": "string"
            }
        },
        "risk": {
            "type": "string",
            "enum": [
                "HIGH",
                "MEDIUM",
                "LOW",
                "SECURE",
                "NOT_APPLICABLE"
            ],
            "description": "a Jamf-reported level of risk associated with the device."
        },
        "osv": {
            "type": "string",
            "description": "The version of the OS that is currently running, in Apple version number format (https://support.apple.com/en-us/HT201260)"
        }
    }
}
```

以下は、Jamf が提供するトラストデータに対して評価を行うポリシーの例です。

```
permit(principal, action, resource) when {
   context.jamf.risk == "LOW"
};
```

Cedar には、Jamf のリスクスコアなどの列挙型を使用する際に役立つ便利な `.contains()` 機能があります。

```
permit(principal, action, resource) when {
   ["LOW", "SECURE"].contains(context.jamf.risk)
};
```

## CrowdStrike
<a name="trust-data-iam-cs"></a>

CrowdStrike はサードパーティー信頼プロバイダーです。ポリシーが評価される際に、CrowdStrike を信頼プロバイダーとして定義すると、Verified Access は、信頼プロバイダー設定で「ポリシーレファレンス名」として指定するキーの下の Cedar コンテキスト内のトラストデータを含めます。必要に応じて、トラストデータに対して評価するポリシーを作成できます。次の [JSON スキーマ](https://json-schema.org/)は、評価に含まれるデーを示しています。

Verified Access で CrowdStrike を使用する方法の詳細については、GitHub ウェブサイトの「[Securing private applications with CrowdStrike and AWS Verified Access](https://github.com/CrowdStrike/aws-verified-access/)」を参照してください。

```
{
  "title": "CrowdStrike device data specification",
  "type": "object",
  "properties": {
    "assessment": {
      "type": "object",
      "description": "Data about CrowdStrike's assessment of the device",
      "properties": {
        "overall": {
          "type": "integer",
          "description": "A single metric, between 1-100, that accounts as a weighted average of the OS and and Sensor Config scores"
        },
        "os": {
          "type": "integer",
          "description": "A single metric, between 1-100, that accounts for the OS-specific settings monitored on the host"
        },
        "sensor_config": {
          "type": "integer",
          "description": "A single metric, between 1-100, that accounts for the different sensor policies monitored on the host"
        },
        "version": {
          "type": "string",
          "description": "The version of the scoring algorithm being used"
        }
      }
    },
    "cid": {
      "type": "string",
      "description": "Customer ID (CID) unique to the customer's environment"
    },
    "exp": {
      "type": "integer",
      "description": "unixtime, The expiration time of the token"
    },
    "iat": {
      "type": "integer",
      "description": "unixtime, The issued time of the token"
    },
    "jwk_url": {
      "type": "string",
      "description": "URL that details the JWT signing"
    },
    "platform": {
      "type": "string",
      "enum": ["Windows 10", "Windows 11", "macOS"],
      "description": "Operating system of the endpoint"
    },
    "serial_number": {
      "type": "string",
      "description": "The serial number of the device derived by unique system information"
    },
    "sub": {
      "type": "string",
      "description": "Unique CrowdStrike Agent ID (AID) of machine"
    },
    "typ": {
      "type": "string",
      "enum": ["crowdstrike-zta+jwt"],
      "description": "Generic name for this JWT media. Client MUST reject any other type"
    }
  }
}
```

以下は、CrowdStrike が提供するトラストデータに対して評価を行うポリシーの例です。

```
permit(principal, action, resource) when {
   context.crowdstrike.assessment.overall > 50
};
```

## JumpCloud
<a name="trust-data-jc"></a>

JumpCloud はサードパーティー信頼プロバイダーです。ポリシーが評価される際に、JumpCloud を信頼プロバイダーとして定義すると、 Verified Access は、信頼プロバイダー設定で「ポリシーレファレンス名」として指定するキーの下の Cedar コンテキスト内のトラストデータを含めます。必要に応じて、トラストデータに対して評価するポリシーを作成できます。次の [JSON スキーマ](https://json-schema.org/)は、評価に含まれるデーを示しています。

JumpCloud と AWS Verified Access の使用の詳細については、JumpCloud [ウェブサイトのJumpCloud と AWS Verified Access の統合](https://jumpcloud.com/support/integrate-with-aws-verified-access)」を参照してください。 JumpCloud 

```
{
  "title": "JumpCloud device data specification",
  "type": "object",
  "properties": {
    "device": {
      "type": "object",
      "description": "Properties of the device",
      "properties": {
        "is_managed": {
          "type": "boolean",
          "description": "Boolean to indicate if the device is under management"
        }
      }
    },
    "exp": {
      "type": "integer",
      "description": "Expiration. Unixtime of the token's expiration."
    },
    "durt_id": {
      "type": "string",
      "description": "Device User Refresh Token ID. Unique ID that represents the device + user."
    },
    "iat": {
      "type": "integer",
      "description": "Issued At. Unixtime of the token's issuance."
    },
    "iss": {
      "type": "string",
      "description": "Issuer. This will be 'go.jumpcloud.com'"
    },
    "org_id": {
      "type": "string",
      "description": "The JumpCloud Organization ID"
    },
    "sub": {
      "type": "string",
      "description": "Subject. The managed JumpCloud user ID on the device."
    },
    "system": {
      "type": "string",
      "description": "The JumpCloud system ID"
    }
  }
}
```

以下は、JumpCloud が提供するトラストコンテキストに対して評価を行うポリシーの例です。

```
permit(principal, action, resource) when {
   context.jumpcloud.org_id == 'Unique_organization_identifier'
};
```

# Verified Access でのユーザークレームの引き渡しと署名の検証
<a name="user-claims-passing"></a>

 AWS Verified Access インスタンスがユーザーを正常に認証すると、IdP から受信したユーザークレームが Verified Access エンドポイントに送信されます。ユーザークレームには署名が付けられているため、アプリケーションは署名を検証するとともに、そのクレームが Verified Access から送信されたものであることを検証できます。この処理中に、以下の HTTP ヘッダーが追加されます。

`x-amzn-ava-user-context`

このヘッダーには、JSON Web Token (JWT) 形式のユーザークレームが含まれます。JWT 形式にはヘッダー、ペイロード、および Base64 URL でエンコードされた署名が含まれています。Verified Access は ES384 (SHA-384 ハッシュアルゴリズムを使用する ECDSA 署名アルゴリズム) を使用して JWT 署名を生成します。

アプリケーションはこれらのクレームをパーソナライズやその他のユーザー固有のエクスペリエンスに使用できます。アプリケーションデベロッパーは、使用前に ID プロバイダーから提供される各クレームの一意性と検証のレベルについて十分に理解しておく必要があります。一般に、`sub` クレームは、特定のユーザーを識別する最良の方法です。

**Topics**
+ [OIDC ユーザークレーム用の JWT](#oidc-sample)
+ [IAM アイデンティティセンターのユーザークレーム](#IdC-sample)
+ [パブリックキー](#public-keys)
+ [JWT の取得とデコード](#sample-code)

## 例：OIDC ユーザークレーム用の署名付き JWT
<a name="oidc-sample"></a>

以下の例は、OIDC ユーザークレームのヘッダーとペイロードが JWT 形式でどのように表示されるかを示しています。

ヘッダーの例：

```
{
   "alg": "ES384",
   "kid": "12345678-1234-1234-1234-123456789012",
   "signer": "arn:aws:ec2:us-east-1:123456789012:verified-access-instance/vai-abc123xzy321a2b3c", 
   "iss": "OIDC Issuer URL",
   "exp": "expiration" (120 secs)
}
```

ペイロードの例：

```
{
   "sub": "xyzsubject",
   "email": "xxx@amazon.com",
   "email_verified": true,
   "groups": [
      "Engineering",
      "finance"
   ],
   "additional_user_context": {
      "aud": "xxx",
      "exp": 1000000000,
      "groups": [
         "group-id-1",
         "group-id-2"
      ],
      "iat": 1000000000,
      "iss": "https://oidc-tp.com/",
      "sub": "xyzsubject",
      "ver": "1.0"
   }
}
```

## 例：IAM アイデンティティセンターのユーザークレーム用署名付き JWT
<a name="IdC-sample"></a>

以下の例は、IAM アイデンティティセンターユーザークレームのヘッダーとペイロードが JWT 形式でどのように表示されるかを示しています。

**注記**  
IAM アイデンティティセンターについては、ユーザー情報のみがクレームに含まれます。

ヘッダーの例：

```
{
   "alg": "ES384",
   "kid": "12345678-1234-1234-1234-123456789012",
   "signer": "arn:aws:ec2:us-east-1:123456789012:verified-access-instance/vai-abc123xzy321a2b3c", 
   "iss": "arn:aws:ec2:us-east-1:123456789012:verified-access-trust-provider/vatp-abc123xzy321a2b3c",
   "exp": "expiration" (120 secs)
}
```

ペイロードの例：

```
{
    "user": {
        "user_id": "f478d4c8-a001-7064-6ea6-12423523",
        "user_name": "test-123",
        "email": {
            "address": "test@amazon.com",
            "verified": false
        }
    }
}
```

## パブリックキー
<a name="public-keys"></a>

Verified Access インスタンスではユーザークレームが暗号化されないため、Verified Access エンドポイントが HTTPS を使用するように設定することをお勧めします。Verified Access エンドポイントが HTTP を使用するように設定する場合は、エンドポイントへのトラフィックをセキュリティグループを使用するトラフィックのみに制限してください。

セキュリティを確保するには、クレームに基づいて認可を行う前に署名を検証し、JWT ヘッダーの `signer` フィールドに、想定される Verified Access インスタンス ARN が含まれていることを確認する必要があります。

パブリックキーを取得するには、JWT ヘッダーからキー ID を取得し、それを使用して次のエンドポイントからパブリックキーを検索します。

それぞれのエンドポイント AWS リージョン は次のとおりです。

`https://public-keys.prod.verified-access.<region>.amazonaws.com/<key-id>`

## 例：JWT の取得とデコード
<a name="sample-code"></a>

次のコードは、Python 3.9 でキー ID、公開キー、およびペイロードを取得する方法を示しています。

```
import jwt
import requests
import base64
import json

# Step 1: Validate the signer
expected_verified_access_instance_arn = 'arn:aws:ec2:region-code:account-id:verified-access-instance/verified-access-instance-id'

encoded_jwt = headers.dict['x-amzn-ava-user-context']
jwt_headers = encoded_jwt.split('.')[0]
decoded_jwt_headers = base64.b64decode(jwt_headers)
decoded_jwt_headers = decoded_jwt_headers.decode("utf-8")
decoded_json = json.loads(decoded_jwt_headers)
received_verified_access_instance_arn = decoded_json['signer']

assert expected_verified_access_instance_arn == received_verified_access_instance_arn, "Invalid Signer"

# Step 2: Get the key id from JWT headers (the kid field)
kid = decoded_json['kid']

# Step 3: Get the public key from regional endpoint
url = 'https://public-keys.prod.verified-access.' + region + '.amazonaws.com/' + kid
req = requests.get(url)
pub_key = req.text

# Step 4: Get the payload
payload = jwt.decode(encoded_jwt, pub_key, algorithms=['ES384'])
```