

# AWS CloudTrail で特権タスクを追跡する
<a name="cloudtrail-track-privileged-tasks"></a>

AWS Organizations 管理アカウントまたは IAM の委任された管理者アカウントは、短期ルートアクセスを使用して、メンバーアカウントで一部のルートユーザータスクを実行できます。短期の特権セッションでは、組織内のメンバーアカウントで[特権アクションを実行](id_root-user-privileged-task.md)する範囲を絞り込むことができる一時的な認証情報が提供されます。次のステップを使用して、[https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoot.html) セッション中に管理アカウントまたは委任された管理者が実行したアクションを特定できます。

**注記**  
グローバルエンドポイントは `sts:AssumeRoot` ではサポートされていません。CloudTrail は、エンドポイントのために指定されたリージョンの `ConsoleLogin` イベントを記録します。

**CloudTrail ログで特権セッションによって実行されたアクションを追跡するには**

1. CloudTrail ログで `AssumeRoot` イベントを検索します。このイベントは、管理アカウントまたは IAM の委任された管理者が `sts:AssumeRoot` から一連の短期の認証情報を取得する際に生成されます。

   次の例では、AssumeRoot の CloudTrail イベントが `eventName` フィールドにログ記録されます。

   ```
   {
       "eventVersion": "1.08",
       "userIdentity": {
           "type": "AssumedRole",
           "principalId": "AIDACKCEVSQ6C2EXAMPLE:JohnRole1",
           "arn": "arn:aws:sts::111111111111:assumed-role/John/JohnRole1",
           "accountId": "111111111111",
           "accessKeyId": "ASIAIOSFODNN7EXAMPLE",
           "sessionContext": {
               "sessionIssuer": {
                   "type": "Role",
                   "principalId": "AIDACKCEVSQ6C2EXAMPLE",
                   "arn": "arn:aws:iam::111111111111:role/John",
                   "accountId": "111111111111",
                   "userName": "Admin2"
               },
               "webIdFederationData": {},
               "attributes": {
                   "creationDate": "2024-10-25T20:45:28Z",
                   "mfaAuthenticated": "false"
               },
               "assumedRoot": "true"
           }
       },
       "eventTime": "2024-10-25T20:52:11Z",
       "eventSource": "sts.amazonaws.com",
       "eventName": "AssumeRoot",
       "awsRegion": "us-west-2",
       "sourceIPAddress": "192.0.2.1",    
       "requestParameters": {
           "targetPrincipal": "222222222222",
           "taskPolicyArn": {
               "arn": "arn:aws:iam::aws:policy/root-task/S3UnlockBucketPolicy"
           }
       },
       "responseElements": {
           "credentials": {
               "accessKeyId": "ASIAIOSFODNN7EXAMPLE",
               "sessionToken": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
               "expiration": "Oct 25, 2024, 9:07:11 PM"
           }
       }
   }
   ```

   CloudTrail ログにアクセスするステップについては、「*AWS CloudTrail ユーザーガイド*」の「[Getting and viewing your CloudTrail log files](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html)」を参照してください。

1. CloudTrail イベントログで、アクションが実行されたメンバーアカウントを指定する `targetPrincipal` と、`AssumeRoot` セッションに対して一意の `accessKeyId` を確認します。

   次の例では、`targetPrincipal` は 222222222222、`accessKeyId` は ASIAIOSFODNN7EXAMPLE です。

   ```
   "eventTime": "2024-10-25T20:52:11Z",
       "eventSource": "sts.amazonaws.com",
       "eventName": "AssumeRoot",
       "awsRegion": "us-west-2",
       "sourceIPAddress": "192.0.2.1",    
       "requestParameters": {
           "targetPrincipal": "{{222222222222}}",
           "taskPolicyArn": {
               "arn": "arn:aws:iam::aws:policy/root-task/S3UnlockBucketPolicy"
           }
       },
       "responseElements": {
           "credentials": {
               "accessKeyId": "{{ASIAIOSFODNN7EXAMPLE}}",
               "sessionToken": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
               "expiration": "Oct 25, 2024, 9:07:11 PM"
       }
   }
   ```

1. ターゲットプリンシパルの CloudTrail ログで、`AssumeRoot` イベントの `accessKeyId` の値に対応するアクセスキー ID を検索します。`eventName` フィールドの値を使用して、`AssumeRoot` セッション中に実行される特権タスクを決定します。単一のセッションで複数の特権タスクが実行される場合があります。`AssumeRoot` の最大セッション時間は 900 秒 (15 分) です。

   次の例では、管理アカウントまたは委任された管理者が Amazon S3 バケットのリソースベースのポリシーを削除しました。

   ```
   {
       "eventVersion": "1.10",
       "userIdentity": {
           "type": "Root",
           "principalId": "{{222222222222}}",
           "arn": "arn:aws:iam::222222222222:root",
           "accountId": "222222222222",
           "accessKeyId": "{{ASIAIOSFODNN7EXAMPLE}}",
           "sessionContext": {
               "attributes": {
                   "creationDate": "2024-10-25T20:52:11Z",
                   "mfaAuthenticated": "false"
               }
           }
       },
       "eventTime": "2024-10-25T20:53:47Z",
       "eventSource": "s3.amazonaws.com",
       "eventName": "DeleteBucketPolicy",
       "awsRegion": "us-west-2",
       "sourceIPAddress": "192.0.2.1",
       "requestParameters": {
           "bucketName": "resource-policy-John",
           "Host": "resource-policy-John.s3.amazonaws.com",
           "policy": ""
       },
       "responseElements": null,
       "requestID": "1234567890abcdef0",
       "eventID": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
       "readOnly": false,
       "resources": [
           {
               "accountId": "222222222222",
               "type": "AWS::S3::Bucket",
               "ARN": "arn:aws:s3:::resource-policy-John"
           }
       ],
       "eventType": "AwsApiCall",
       "managementEvent": true,
       "recipientAccountId": "222222222222",
       "eventCategory": "Management",
       "tlsDetails": {
           "tlsVersion": "TLSv1.3",
           "cipherSuite": "TLS_AES_128_GCM_SHA256",
           "clientProvidedHostHeader": "resource-policy-John.s3.amazonaws.com"
       }
   }
   ```