[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A56KZ0GAFYCDPC31Q7SH4Q":3,"skill-same:01M7A56KZ0GAFYCDPC31Q7SH4Q":145},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M7A56KZ0GAFYCDPC31Q7SH4Q","cloudtrail-org-trail-auditor",null,"Audits AWS CloudTrail organization trails for full-org coverage, multi-region logging, KMS encryption (SSE-KMS) of log delivery, log-file validation (digest integrity), CloudWatch Logs delivery, CloudTrail Insights enablement, and log retention posture. Emits a deterministic verdict (NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS | CONFIG_GAP | OK) per trail with enumerated findings and CLI remediation. Use when reviewing CloudTrail trail configurations, checking org-wide audit coverage, validating log integrity, confirming KMS encryption, verifying CloudTrail Insights, or hardening forensic-readiness posture before compliance assessment.","jhkchan\u002Faws-agent-skills","jhkchan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1083902?v=4","01M7A2SVQYP9GQTPTDXP5JKYQ4","Jacky Chan","01M7A2SVS117YWCTZABB75HZR1",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: cloudtrail-org-trail-auditor\ndescription: Audits AWS CloudTrail organization trails for full-org coverage, multi-region logging, KMS encryption (SSE-KMS) of log delivery, log-file validation (digest integrity), CloudWatch Logs delivery, CloudTrail Insights enablement, and log retention posture. Emits a deterministic verdict (NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS | CONFIG_GAP | OK) per trail with enumerated findings and CLI remediation. Use when reviewing CloudTrail trail configurations, checking org-wide audit coverage, validating log integrity, confirming KMS encryption, verifying CloudTrail Insights, or hardening forensic-readiness posture before compliance assessment.\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline trail-config classification. Live-account audits use aws cloudtrail describe-trails, get-trail-status, get-insight-selectors, and aws logs describe-log-groups (AWS CLI v2, SSO or key-based credentials).\nmetadata:\n  domain: aws-cloudops\n  complexity: medium\n  requires_llm: 'true'\n  phase: '2'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: Governance\n  verdict_shape: NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS | CONFIG_GAP | OK\n  when_to_use: 'Pre-compliance review of an AWS Organizations CloudTrail trail''s configuration: org-wide coverage, multi-region logging, KMS-encryption, log-file integrity validation, Insights enablement, and log retention posture.'\n  when_not_to_use: 'Single-account trail that is NOT part of an AWS Organization (different audit scope)., CloudTrail Lake event-data-store queries (different API surface: list-event-data-stores \u002F start-query)., Configuring data-event selectors for S3\u002FLambda\u002FDynamoDB resources (separate skill)., Macie, GuardDuty, or Security Hub finding triage (use the dedicated triage skills)., Cost-optimization of CloudTrail ingest volume (use a cost-audit skill).'\n  activation_triggers: audit this CloudTrail org trail, is my org trail configured correctly, check CloudTrail org trail log file validation, is the CloudTrail org trail encrypted with KMS, are CloudTrail Insights enabled on the org trail, CloudTrail multi-region check on the org trail, CloudTrail org trail coverage audit, verify CloudTrail forensic readiness for the org\n  invocation_schema: \"{output: 'Deterministic per-trail block: TRAIL \u002F VERDICT \u002F REASON \u002F FINDINGS \u002F REMEDIATION.\\n    VERDICT is one of NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS |\\n    CONFIG_GAP | OK (first-fail-wins order).', properties: {cw_retention_days: {description: CloudWatch\\n        Logs retentionInDays for the trail's log group., type: integer}, insight_selectors: {\\n      description: get-insight-selectors output (optional)., type: array}, trail_config: {\\n      description: describe-trails output (JSON or key-value summary) for one trail.,\\n      type: object}, trail_name_or_arn: {description: Trail name\u002FARN for live-account\\n        audit (alternative to trail_config)., type: string}, trail_status: {description: get-trail-status\\n        output (optional but recommended)., type: object}}, required: [trail_config],\\n  type: object}\"\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: CloudTrail, organization trail, multi-region trail, KMS encryption, log file validation, digest files, CloudWatch Logs, CloudTrail Insights, log retention, audit logging, compliance, forensic readiness, IsOrganizationTrail, IsMultiRegionTrail, LogFileValidationEnabled, trail auditor, API activity logging\n  tags: cloudtrail, governance, audit-logging, compliance, security, insights, kms-encryption\n---\n\n# CloudTrail Organization Trail Auditor\n\n## Quick start (decision tree — read first)\n\nEvaluate dimensions in order; **the first failing dimension is the verdict.**\n\n| # | Check | Fail verdict | Risk |\n|---|---|---|---|\n| 1 | `IsOrganizationTrail: false` (from `describe-trails`) | **NO_ORG_TRAIL** | CRITICAL |\n| 2 | `KmsKeyId` null\u002Fempty (SSE-S3 defaults) | **NO_ENCRYPTION** | CRITICAL |\n| 3 | `LogFileValidationEnabled: false` | **NO_VALIDATION** | HIGH |\n| 4 | `InsightsSelectors: []` (from `get-insight-selectors`) | **NO_INSIGHTS** | MEDIUM |\n| 5 | `IsMultiRegionTrail: false` OR `CloudWatchLogsLogGroupArn: null` OR `IncludeGlobalServiceEvents: false` OR CW retention \u003C 90 days | **CONFIG_GAP** | MEDIUM |\n| 6 | All above pass | **OK** | LOW |\n\n**Pre-flight gate (mandatory):** `get-trail-status` returns `IsLogging`. If `false`, append a CRITICAL finding regardless of the verdict, and recommend `start-logging`.\n\n**Invisible dependencies (require extra API calls — surface gaps in FINDINGS, never silently change the verdict):** Organizations trusted-service access for `cloudtrail.amazonaws.com`, S3 bucket-policy `s3:x-amz-acl: bucket-owner-full-control` ACL, KMS key-policy `kms:GenerateDataKey*` grant, S3 lifecycle rules on the log and digest prefixes.\n\n**Output one block per trail:** `TRAIL \u002F VERDICT \u002F REASON \u002F FINDINGS \u002F REMEDIATION` (see Output format).\n\n## Mindset\n\n**One-line takeaway:** the verdict is the **first** failing dimension in a\nstrict order of severity — org coverage → encryption → validation → insights\n→ config-gap. A trail that is not an org trail fails the most fundamental\naudit gate regardless of how well everything else is configured.\n\nCloudTrail is the forensic bedrock of an AWS account. A misconfigured org\ntrail does not merely \"miss events\"; it creates **silent blind spots** where\nattacker actions leave no trace. Step 0 enumerates the non-obvious\nCloudTrail behaviors that change classification; Steps 1–6 are the\ndeterministic first-fail-wins tree.\n\n## Pre-flight: trail status gate (run before classification)\n\nBefore evaluating trail configuration, verify the trail is actually logging.\nA trail with perfect configuration but `IsLogging: false` collects nothing —\nit is the most overlooked audit dimension because `describe-trails` returns the\nconfig without the status.\n\n| Status field | Value | Effect |\n|---|---|---|\n| `IsLogging` (get-trail-status) | `true` | Proceed with full audit. |\n| `IsLogging` (get-trail-status) | `false` | Trail is STOPPED. This is a CRITICAL finding. Append to FINDINGS: \"Trail isLogging=false — no events are being recorded despite configuration. Run `aws cloudtrail start-logging --name \u003Ctrail>`.\" Continue the config audit so all gaps are surfaced, but note the trail is inactive. |\n| Status unknown (no get-trail-status provided) | — | Proceed but append a WARNING: \"Trail logging status not provided — verify with `aws cloudtrail get-trail-status --name \u003Ctrail>`. A trail may be correctly configured but silently stopped.\" |\n\n**Multi-trail sweep note:** `aws cloudtrail describe-trails` returns all trails\nvisible to the caller, but an org trail is only visible in the management\naccount (or delegated administrator). If the input comes from a member account,\nthe org trail will NOT appear — verify the caller is in the management account\nbefore concluding NO_ORG_TRAIL.\n\n> Malformed-config ERROR block moved verbatim to [references\u002Ferror-handling.md](references\u002Ferror-handling.md) — load on demand.\n\n## Process — Classification logic (apply in order, first-fail wins)\n\n### Step 0: Expert knowledge — non-obvious CloudTrail behaviors\n\n> Step 0 expert knowledge moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — load on demand.\n\n### Step 1: Organization trail check (NO_ORG_TRAIL — CRITICAL)\n\nIf `IsOrganizationTrail` is `false` or absent, the trail does NOT cover member\naccounts. This is the most fundamental gap — an org without an org trail has\nno centralized audit visibility into member-account API activity.\n\n**Verdict: NO_ORG_TRAIL** (CRITICAL risk).\n\nEven if every other dimension (encryption, validation, Insights) is correctly\nconfigured, the trail only logs the account it was created in. Member-account\nactivity is invisible to the management account's security team.\n\n**Edge case — delegated administrator:** If the trail was created by a\ndelegated administrator account (not the management account), the trail is\nstill an org trail — `IsOrganizationTrail: true` applies regardless of which\naccount created it, as long as the org trusted-service access is active.\n\n### Step 2: KMS encryption check (NO_ENCRYPTION — CRITICAL)\n\nIf `IsOrganizationTrail: true` (passed Step 1), check `KmsKeyId`:\n\n- **`KmsKeyId` is null, empty, or absent** → SSE-S3 (Amazon-managed AES-256)\n  is the default. This IS encryption, but the key is not customer-controlled.\n  For compliance frameworks (SOC 2, HIPAA, FedRAMP) requiring customer-managed\n  keys, this is a finding. **Verdict: NO_ENCRYPTION** (CRITICAL risk).\n\n- **`KmsKeyId` is present** → Verify the key is in the same region as the\n  trail and that the key policy grants CloudTrail service access. If the key\n  policy is missing the CloudTrail service principal, log delivery will fail\n  silently — the trail appears active but logs stop appearing in S3. Note as\n  a WARNING in FINDINGS but do not fail the dimension.\n\n**Verify the S3 bucket policy, KMS key policy, and S3 lifecycle rules\n(all three are invisible from `describe-trails` and silently break member-account\nlog access on org trails). Run these in order; treat any non-conformance as a\nCONFIG_GAP finding:**\n\n```bash\n# 1. S3 bucket policy — must allow cloudtrail.amazonaws.com s3:PutObject with\n#    Condition StringEquals s3:x-amz-acl == bucket-owner-full-control.\naws s3api get-bucket-policy --bucket \u003CS3BucketName> --query Policy --output text \\\n  | jq '.Statement[] | select(.Principal.Service==\"cloudtrail.amazonaws.com\")'\n\n# 2. KMS key policy — must allow cloudtrail.amazonaws.com kms:GenerateDataKey*\n#    and kms:Decrypt with EncryptionContext:aws:cloudtrail:arn == \u003Ctrail-arn>.\naws kms describe-key --key-id \u003CKmsKeyId> --query 'KeyMetadata.Policy' --output text \\\n  | jq '.Statement[] | select(.Principal.Service==\"cloudtrail.amazonaws.com\")'\n\n# 3. S3 lifecycle rules — must NOT expire the log prefix (\u003Cprefix>\u002F) or the\n#    digest prefix (\u003Cprefix>\u002FCloudTrail-Digest\u002F) before the compliance window.\naws s3api get-bucket-lifecycle-configuration --bucket \u003CS3BucketName> --output json \\\n  | jq '.Rules[] | select(.Filter.Prefix | test(\"^\u003Cprefix>(CloudTrail-Digest\u002F)?\"))'\n\n# 4. CloudWatch Logs retention — must be on the trail's log group, >= 90 days.\naws logs describe-log-groups --log-group-name-prefix \u003CCloudWatchLogsLogGroupArn-prefix> \\\n  --query 'logGroups[*].[logGroupName,retentionInDays]' --output table\n```\n\n### Step 3: Log file validation check (NO_VALIDATION — HIGH)\n\nIf Steps 1-2 passed, check `LogFileValidationEnabled`:\n\n- **`LogFileValidationEnabled: false` or absent** → No digest files are\n  generated. An attacker with S3 write access can modify, delete, or inject\n  log files without detection. **Verdict: NO_VALIDATION** (HIGH risk).\n\n- **`LogFileValidationEnabled: true`** → Digest files are generated.\n  Integrity checking is possible via `aws cloudtrail validate-logs`.\n  Note: validation detects **offline** tampering (files modified after\n  delivery), not real-time tampering during the write window. Still a\n  critical detective control for compliance and forensic integrity.\n\n### Step 4: CloudTrail Insights check (NO_INSIGHTS — MEDIUM)\n\nIf Steps 1-3 passed, check Insights selectors. The rule is deterministic:\n\n- **No `InsightsSelectors` data provided** → Verdict proceeds to Step 5 (does\n  NOT block OK), but the REASON field MUST begin with the literal phrase\n  `\"Insights unverified\"` and FINDINGS MUST include an `[UNVERIFIED]` line:\n  \"Operator must call `aws cloudtrail get-insight-selectors --trail-name\n  \u003Cname>` to close this dimension.\" Do NOT emit `NO_INSIGHTS` without explicit\n  evidence (empty list); do NOT emit `OK` without surfacing the gap. The\n  fallback is operator-visible, never silent.\n\n- **`InsightsSelectors` is empty (`[]`) or explicitly not configured** → No\n  anomaly detection on API call volume or error rates. **Verdict:\n  NO_INSIGHTS** (MEDIUM risk).\n\n- **`InsightsSelectors` present with `ApiCallRateInsight` and\u002For\n  `ApiErrorRateInsight`** → Insights is enabled. Note: Insights requires a\n  7-day baseline before detecting anomalies — a trail created \u003C7 days ago\n  will not produce Insights findings yet, but this is NOT a misconfiguration.\n\n### Step 5: Configuration-gap check (CONFIG_GAP — MEDIUM)\n\nIf Steps 1-4 passed, evaluate secondary dimensions. ANY of the following\ntriggers CONFIG_GAP:\n\n| Sub-check | Condition | Finding |\n|---|---|---|\n| Multi-region | `IsMultiRegionTrail: false` | Shadow regions — API activity in other regions is invisible. |\n| CloudWatch Logs | `CloudWatchLogsLogGroupArn` null\u002Fempty | No real-time log streaming — SIEM\u002FCW alarms cannot react to CloudTrail events. |\n| Global service events | `IncludeGlobalServiceEvents: false` | IAM, STS, Route 53, CloudFront events dropped. |\n| Log retention | CloudWatch Logs `retentionInDays: null` or `\u003C 90` | No compliance boundary (infinite storage or too-short retention for investigation). |\n| S3 bucket ACL | Not `bucket-owner-full-control` | Member-account logs unreadable by management account. |\n\nIf ANY of these fail, **Verdict: CONFIG_GAP** (MEDIUM risk). Enumerate each\nfailing sub-check in FINDINGS.\n\n### Step 6: All dimensions pass (OK)\n\nIf all dimensions pass (org trail, KMS encryption, validation, Insights,\nmulti-region, CloudWatch Logs, global events, retention >= 90 days):\n**Verdict: OK** (LOW risk).\n\n## Output format (per trail)\n\n```text\nTRAIL: \u003Ctrail-name>\nVERDICT: NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS | CONFIG_GAP | OK\nREASON: \u003C1-2 sentences citing the first failing dimension and its step>\nFINDINGS:\n  - [CRITICAL] \u003Cfinding description (Step N)>\n  - [HIGH] \u003Cfinding description (Step N)>\n  - [OK] \u003Cdimension that passed>\nREMEDIATION: \u003Cspecific CLI per finding, or \"None required\" if OK>\n```\n\n### Worked example — org trail with validation disabled\n\n```text\nTRAIL: org-trail-no-validation\nVERDICT: NO_VALIDATION\nREASON: LogFileValidationEnabled is false on an org trail — digest files are\nnot generated, so log tampering cannot be detected via validate-logs (Step 3).\nFINDINGS:\n  - [OK] IsOrganizationTrail: true — org coverage active (Step 1)\n  - [OK] KmsKeyId configured — SSE-KMS encryption active (Step 2)\n  - [HIGH] LogFileValidationEnabled: false — no digest files, tampering\n    undetectable (Step 3)\nREMEDIATION:\n  1. Enable log file validation:\n     aws cloudtrail update-trail --name org-trail-no-validation --enable-log-file-validation\n  2. Verify digest files appear in S3:\n     aws s3 ls s3:\u002F\u002F\u003Cbucket>\u002FCloudTrail-Digest\u002F --recursive | head -20\n```\n\n## Pre-flight safety checks (run before any remediation CLI)\n\n> Pre-flight safety checks moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — load on demand.\n\n## Anti-Patterns — NEVER\n\n- NEVER assume an org trail is multi-region. `IsOrganizationTrail` and\n  `IsMultiRegionTrail` are independent flags. An org trail logging only one\n  region creates a blind spot for every other region — an attacker can\n  operate from `eu-west-1` against a trail in `us-east-1` and leave no trace.\n\n- NEVER treat SSE-S3 (Amazon-managed key) as satisfying a KMS-encryption\n  requirement. SSE-S3 IS encryption, but the key is managed by AWS — the\n  customer cannot audit key usage, set key policies, or rotate on their own\n  schedule. Compliance frameworks requiring customer-managed keys treat null\n  `KmsKeyId` as NO_ENCRYPTION regardless of S3 default encryption.\n\n- NEVER classify a trail as OK without verifying `IsLogging: true`. A trail\n  with perfect configuration but `IsLogging: false` is collecting nothing.\n  `describe-trails` returns the config; `get-trail-status` returns the status.\n\n- NEVER assume CloudTrail Insights works immediately after enablement. It\n  requires a minimum 7-day baseline of management events before it can detect\n  anomalies.\n\n- NEVER conflate CloudTrail log retention with CloudWatch Logs retention.\n  CloudTrail itself has no retention setting — logs persist in S3 until a\n  lifecycle policy removes them. CloudWatch Logs retention is a separate\n  property on the log group (`retentionInDays`).\n\n- NEVER overlook the S3 bucket policy for org trails. The bucket must grant\n  `cloudtrail.amazonaws.com` `s3:PutObject` with condition\n  `s3:x-amz-acl: bucket-owner-full-control`. Without the ACL condition,\n  member-account logs are owned by the member account and the management\n  account cannot read them.\n\n- NEVER assume `IncludeGlobalServiceEvents: true` is the default in all\n  tooling. Terraform and CloudFormation templates sometimes omit this field;\n  the default varies by SDK version. Explicitly verify it is `true`.\n\n- NEVER recommend `delete-trail` to remediate any configuration gap.\n  `delete-trail` is irreversible, drops the trail name and S3 prefix\n  continuity, breaks downstream EventBridge rules and CloudWatch alarms keyed\n  to the trail ARN, and creates a forensic gap until a replacement trail\n  begins delivery. Always use `update-trail` (in-place modification); it\n  preserves the ARN, S3 prefix, and all downstream integrations. If a\n  deletion is genuinely required (e.g., trail-name conflict), require a\n  second operator confirmation and capture a backup first.\n\n- NEVER ignore the KMS key policy when auditing CloudTrail KMS encryption.\n  A `KmsKeyId` set on the trail with a missing or restrictive key policy\n  causes silent log-delivery failure — the trail is \"encrypted\" but nothing\n  is being written.\n\n- NEVER classify NO_INSIGHTS if the insight-selector data was not provided.\n  Surface the gap as `[UNVERIFIED]` per Step 4 — do not guess.\n\n- NEVER rely on a default S3 lifecycle configuration (e.g., a bucket-wide\n  `ExpirationInDays` shipped by a CDK construct or Terraform module) as the\n  CloudTrail retention control. S3 lifecycle expires objects silently — no\n  notification, no digest-chain check, no object lock. A common compliance\n  failure: the default rule deletes raw log files after 30\u002F60\u002F90 days while\n  digests remain, so `validate-logs` reports a green chain pointing at\n  missing files and the audit trail silently shortens. Always inspect\n  `aws s3api get-bucket-lifecycle-configuration` and surface any\n  non-versioned expiry on the log or digest prefix as CONFIG_GAP. Prefer S3\n  Object Lock + Glacier Deep Archive for compliance retention over lifecycle\n  expiry.\n\n- NEVER assume a single-region trail is sufficient for an org, even if all\n  workloads are in one region. AWS global services (IAM, STS, Route 53) and\n  cross-region API calls (e.g., a Lambda in us-east-1 assuming a role in\n  eu-west-1) generate events in the source region.\n\n## Remediation guidance\n\n### For NO_ORG_TRAIL\n\n1. Verify the caller is in the management account:\n   `aws organizations describe-organization --profile \u003Cp>`\n2. Enable CloudTrail as a trusted service in Organizations:\n   `aws organizations enable-aws-service-access --service-principal cloudtrail.amazonaws.com`\n3. Create or update the trail to be an org trail:\n   `aws cloudtrail update-trail --name \u003Ctrail> --is-organization-trail`\n4. Verify the S3 bucket policy allows writes from all member accounts (see\n   NEVER list — bucket-owner-full-control condition).\n\n### For NO_ENCRYPTION\n\n1. Identify or create a KMS key in the trail's region:\n   `aws kms create-key --description \"CloudTrail SSE-KMS key\" --profile \u003Cp>`\n2. Attach a key policy granting CloudTrail service access:\n   ```json\n   {\"Statement\": [{\"Effect\": \"Allow\", \"Principal\":\n   {\"Service\": \"cloudtrail.amazonaws.com\"}, \"Action\":\n   [\"kms:GenerateDataKey*\", \"kms:Decrypt\"], \"Resource\": \"*\",\n   \"Condition\": {\"StringEquals\": {\"kms:CallerAccount\": \"\u003Caccount>\",\n   \"kms:EncryptionContext:aws:cloudtrail:arn\":\n   \"arn:aws:cloudtrail:\u003Cregion>:\u003Caccount>:trail\u002F\u003Cname>\"}}}]}\n   ```\n3. Update the trail:\n   `aws cloudtrail update-trail --name \u003Ctrail> --kms-key-id \u003Ckey-id>`\n4. Verify log delivery continues:\n   `aws cloudtrail get-trail-status --name \u003Ctrail>`\n\n### For NO_VALIDATION\n\n1. Enable log file validation:\n   `aws cloudtrail update-trail --name \u003Ctrail> --enable-log-file-validation`\n2. Verify digest files appear:\n   `aws s3 ls s3:\u002F\u002F\u003Cbucket>\u002F\u003Cprefix>\u002FCloudTrail-Digest\u002F --recursive | head -20`\n3. Schedule periodic validation:\n   `aws cloudtrail validate-logs --trail-name \u003Ctrail> --start-time \u003Cts> --end-time \u003Cts>`\n\n### For NO_INSIGHTS\n\n1. Enable Insights selectors:\n   `aws cloudtrail put-insight-selectors --trail-name \u003Ctrail>\n   --insight-selectors '[{\"InsightType\": \"ApiCallRateInsight\"},\n   {\"InsightType\": \"ApiErrorRateInsight\"}]'`\n2. Note: Insights requires 7 days of baseline data before producing findings.\n3. Monitor cost — Insights is billed per management event analyzed.\n\n### For CONFIG_GAP\n\n- **Single-region trail:** `aws cloudtrail update-trail --name \u003Ctrail>\n  --is-multi-region-trail`\n- **No CloudWatch Logs:** Create a log group and IAM role, then update:\n  `aws cloudtrail update-trail --name \u003Ctrail>\n  --cloudwatch-logs-log-group-arn \u003Carn> --cloudwatch-logs-role-arn \u003Carn>`\n- **Global service events disabled:** `aws cloudtrail update-trail --name\n  \u003Ctrail> --include-global-service-events`\n- **Short\u002Fmissing retention:** `aws logs put-retention-policy\n  --log-group-name \u003Cgroup> --retention-in-days 365`\n\n### For OK\n\n1. No remediation required.\n2. Recommend periodic `validate-logs` runs (weekly digest verification).\n3. Recommend testing org-trail member-account visibility quarterly.\n\n## Reference — CloudTrail internals (deep material)\n\n> CloudTrail internals deep material moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — load on demand.\n\n## Recent AWS features (2024-2026)\n\n> Recent AWS features moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — load on demand.\n\n## References (load on demand)\n\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Step 0 expert knowledge (non-obvious CloudTrail behaviors), CloudTrail internals deep material, recent AWS features\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight safety checks — confirmation gate, rollback capture, Insights cost, org-trail enablement check\n- [references\u002Ferror-handling.md](references\u002Ferror-handling.md) — malformed trail-configuration ERROR output block\n\n## Domain\n\nAWS CloudOps \u002F CloudTrail Governance, Compliance & Forensic Readiness.\n\n## AWS documentation\n\n- **AWS CloudTrail User Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002Fuserguide\u002Fcloudtrail-user-guide.html\n- **CloudTrail Security** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002Fuserguide\u002Fsecurity.html\n- **CloudTrail API Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002FAPIReference\u002F\n- **CloudTrail CLI Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fcloudtrail\u002F\n- **CloudTrail Lake** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002Fuserguide\u002Fcloudtrail-lake.html\n","# CloudTrail Organization Trail Auditor\n\n## Quick start (decision tree — read first)\n\nEvaluate dimensions in order; **the first failing dimension is the verdict.**\n\n| # | Check | Fail verdict | Risk |\n|---|---|---|---|\n| 1 | `IsOrganizationTrail: false` (from `describe-trails`) | **NO_ORG_TRAIL** | CRITICAL |\n| 2 | `KmsKeyId` null\u002Fempty (SSE-S3 defaults) | **NO_ENCRYPTION** | CRITICAL |\n| 3 | `LogFileValidationEnabled: false` | **NO_VALIDATION** | HIGH |\n| 4 | `InsightsSelectors: []` (from `get-insight-selectors`) | **NO_INSIGHTS** | MEDIUM |\n| 5 | `IsMultiRegionTrail: false` OR `CloudWatchLogsLogGroupArn: null` OR `IncludeGlobalServiceEvents: false` OR CW retention \u003C 90 days | **CONFIG_GAP** | MEDIUM |\n| 6 | All above pass | **OK** | LOW |\n\n**Pre-flight gate (mandatory):** `get-trail-status` returns `IsLogging`. If `false`, append a CRITICAL finding regardless of the verdict, and recommend `start-logging`.\n\n**Invisible dependencies (require extra API calls — surface gaps in FINDINGS, never silently change the verdict):** Organizations trusted-service access for `cloudtrail.amazonaws.com`, S3 bucket-policy `s3:x-amz-acl: bucket-owner-full-control` ACL, KMS key-policy `kms:GenerateDataKey*` grant, S3 lifecycle rules on the log and digest prefixes.\n\n**Output one block per trail:** `TRAIL \u002F VERDICT \u002F REASON \u002F FINDINGS \u002F REMEDIATION` (see Output format).\n\n## Mindset\n\n**One-line takeaway:** the verdict is the **first** failing dimension in a\nstrict order of severity — org coverage → encryption → validation → insights\n→ config-gap. A trail that is not an org trail fails the most fundamental\naudit gate regardless of how well everything else is configured.\n\nCloudTrail is the forensic bedrock of an AWS account. A misconfigured org\ntrail does not merely \"miss events\"; it creates **silent blind spots** where\nattacker actions leave no trace. Step 0 enumerates the non-obvious\nCloudTrail behaviors that change classification; Steps 1–6 are the\ndeterministic first-fail-wins tree.\n\n## Pre-flight: trail status gate (run before classification)\n\nBefore evaluating trail configuration, verify the trail is actually logging.\nA trail with perfect configuration but `IsLogging: false` collects nothing —\nit is the most overlooked audit dimension because `describe-trails` returns the\nconfig without the status.\n\n| Status field | Value | Effect |\n|---|---|---|\n| `IsLogging` (get-trail-status) | `true` | Proceed with full audit. |\n| `IsLogging` (get-trail-status) | `false` | Trail is STOPPED. This is a CRITICAL finding. Append to FINDINGS: \"Trail isLogging=false — no events are being recorded despite configuration. Run `aws cloudtrail start-logging --name \u003Ctrail>`.\" Continue the config audit so all gaps are surfaced, but note the trail is inactive. |\n| Status unknown (no get-trail-status provided) | — | Proceed but append a WARNING: \"Trail logging status not provided — verify with `aws cloudtrail get-trail-status --name \u003Ctrail>`. A trail may be correctly configured but silently stopped.\" |\n\n**Multi-trail sweep note:** `aws cloudtrail describe-trails` returns all trails\nvisible to the caller, but an org trail is only visible in the management\naccount (or delegated administrator). If the input comes from a member account,\nthe org trail will NOT appear — verify the caller is in the management account\nbefore concluding NO_ORG_TRAIL.\n\n> Malformed-config ERROR block moved verbatim to [references\u002Ferror-handling.md](references\u002Ferror-handling.md) — load on demand.\n\n## Process — Classification logic (apply in order, first-fail wins)\n\n### Step 0: Expert knowledge — non-obvious CloudTrail behaviors\n\n> Step 0 expert knowledge moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — load on demand.\n\n### Step 1: Organization trail check (NO_ORG_TRAIL — CRITICAL)\n\nIf `IsOrganizationTrail` is `false` or absent, the trail does NOT cover member\naccounts. This is the most fundamental gap — an org without an org trail has\nno centralized audit visibility into member-account API activity.\n\n**Verdict: NO_ORG_TRAIL** (CRITICAL risk).\n\nEven if every other dimension (encryption, validation, Insights) is correctly\nconfigured, the trail only logs the account it was created in. Member-account\nactivity is invisible to the management account's security team.\n\n**Edge case — delegated administrator:** If the trail was created by a\ndelegated administrator account (not the management account), the trail is\nstill an org trail — `IsOrganizationTrail: true` applies regardless of which\naccount created it, as long as the org trusted-service access is active.\n\n### Step 2: KMS encryption check (NO_ENCRYPTION — CRITICAL)\n\nIf `IsOrganizationTrail: true` (passed Step 1), check `KmsKeyId`:\n\n- **`KmsKeyId` is null, empty, or absent** → SSE-S3 (Amazon-managed AES-256)\n  is the default. This IS encryption, but the key is not customer-controlled.\n  For compliance frameworks (SOC 2, HIPAA, FedRAMP) requiring customer-managed\n  keys, this is a finding. **Verdict: NO_ENCRYPTION** (CRITICAL risk).\n\n- **`KmsKeyId` is present** → Verify the key is in the same region as the\n  trail and that the key policy grants CloudTrail service access. If the key\n  policy is missing the CloudTrail service principal, log delivery will fail\n  silently — the trail appears active but logs stop appearing in S3. Note as\n  a WARNING in FINDINGS but do not fail the dimension.\n\n**Verify the S3 bucket policy, KMS key policy, and S3 lifecycle rules\n(all three are invisible from `describe-trails` and silently break member-account\nlog access on org trails). Run these in order; treat any non-conformance as a\nCONFIG_GAP finding:**\n\n```bash\n# 1. S3 bucket policy — must allow cloudtrail.amazonaws.com s3:PutObject with\n#    Condition StringEquals s3:x-amz-acl == bucket-owner-full-control.\naws s3api get-bucket-policy --bucket \u003CS3BucketName> --query Policy --output text \\\n  | jq '.Statement[] | select(.Principal.Service==\"cloudtrail.amazonaws.com\")'\n\n# 2. KMS key policy — must allow cloudtrail.amazonaws.com kms:GenerateDataKey*\n#    and kms:Decrypt with EncryptionContext:aws:cloudtrail:arn == \u003Ctrail-arn>.\naws kms describe-key --key-id \u003CKmsKeyId> --query 'KeyMetadata.Policy' --output text \\\n  | jq '.Statement[] | select(.Principal.Service==\"cloudtrail.amazonaws.com\")'\n\n# 3. S3 lifecycle rules — must NOT expire the log prefix (\u003Cprefix>\u002F) or the\n#    digest prefix (\u003Cprefix>\u002FCloudTrail-Digest\u002F) before the compliance window.\naws s3api get-bucket-lifecycle-configuration --bucket \u003CS3BucketName> --output json \\\n  | jq '.Rules[] | select(.Filter.Prefix | test(\"^\u003Cprefix>(CloudTrail-Digest\u002F)?\"))'\n\n# 4. CloudWatch Logs retention — must be on the trail's log group, >= 90 days.\naws logs describe-log-groups --log-group-name-prefix \u003CCloudWatchLogsLogGroupArn-prefix> \\\n  --query 'logGroups[*].[logGroupName,retentionInDays]' --output table\n```\n\n### Step 3: Log file validation check (NO_VALIDATION — HIGH)\n\nIf Steps 1-2 passed, check `LogFileValidationEnabled`:\n\n- **`LogFileValidationEnabled: false` or absent** → No digest files are\n  generated. An attacker with S3 write access can modify, delete, or inject\n  log files without detection. **Verdict: NO_VALIDATION** (HIGH risk).\n\n- **`LogFileValidationEnabled: true`** → Digest files are generated.\n  Integrity checking is possible via `aws cloudtrail validate-logs`.\n  Note: validation detects **offline** tampering (files modified after\n  delivery), not real-time tampering during the write window. Still a\n  critical detective control for compliance and forensic integrity.\n\n### Step 4: CloudTrail Insights check (NO_INSIGHTS — MEDIUM)\n\nIf Steps 1-3 passed, check Insights selectors. The rule is deterministic:\n\n- **No `InsightsSelectors` data provided** → Verdict proceeds to Step 5 (does\n  NOT block OK), but the REASON field MUST begin with the literal phrase\n  `\"Insights unverified\"` and FINDINGS MUST include an `[UNVERIFIED]` line:\n  \"Operator must call `aws cloudtrail get-insight-selectors --trail-name\n  \u003Cname>` to close this dimension.\" Do NOT emit `NO_INSIGHTS` without explicit\n  evidence (empty list); do NOT emit `OK` without surfacing the gap. The\n  fallback is operator-visible, never silent.\n\n- **`InsightsSelectors` is empty (`[]`) or explicitly not configured** → No\n  anomaly detection on API call volume or error rates. **Verdict:\n  NO_INSIGHTS** (MEDIUM risk).\n\n- **`InsightsSelectors` present with `ApiCallRateInsight` and\u002For\n  `ApiErrorRateInsight`** → Insights is enabled. Note: Insights requires a\n  7-day baseline before detecting anomalies — a trail created \u003C7 days ago\n  will not produce Insights findings yet, but this is NOT a misconfiguration.\n\n### Step 5: Configuration-gap check (CONFIG_GAP — MEDIUM)\n\nIf Steps 1-4 passed, evaluate secondary dimensions. ANY of the following\ntriggers CONFIG_GAP:\n\n| Sub-check | Condition | Finding |\n|---|---|---|\n| Multi-region | `IsMultiRegionTrail: false` | Shadow regions — API activity in other regions is invisible. |\n| CloudWatch Logs | `CloudWatchLogsLogGroupArn` null\u002Fempty | No real-time log streaming — SIEM\u002FCW alarms cannot react to CloudTrail events. |\n| Global service events | `IncludeGlobalServiceEvents: false` | IAM, STS, Route 53, CloudFront events dropped. |\n| Log retention | CloudWatch Logs `retentionInDays: null` or `\u003C 90` | No compliance boundary (infinite storage or too-short retention for investigation). |\n| S3 bucket ACL | Not `bucket-owner-full-control` | Member-account logs unreadable by management account. |\n\nIf ANY of these fail, **Verdict: CONFIG_GAP** (MEDIUM risk). Enumerate each\nfailing sub-check in FINDINGS.\n\n### Step 6: All dimensions pass (OK)\n\nIf all dimensions pass (org trail, KMS encryption, validation, Insights,\nmulti-region, CloudWatch Logs, global events, retention >= 90 days):\n**Verdict: OK** (LOW risk).\n\n## Output format (per trail)\n\n```text\nTRAIL: \u003Ctrail-name>\nVERDICT: NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS | CONFIG_GAP | OK\nREASON: \u003C1-2 sentences citing the first failing dimension and its step>\nFINDINGS:\n  - [CRITICAL] \u003Cfinding description (Step N)>\n  - [HIGH] \u003Cfinding description (Step N)>\n  - [OK] \u003Cdimension that passed>\nREMEDIATION: \u003Cspecific CLI per finding, or \"None required\" if OK>\n```\n\n### Worked example — org trail with validation disabled\n\n```text\nTRAIL: org-trail-no-validation\nVERDICT: NO_VALIDATION\nREASON: LogFileValidationEnabled is false on an org trail — digest files are\nnot generated, so log tampering cannot be detected via validate-logs (Step 3).\nFINDINGS:\n  - [OK] IsOrganizationTrail: true — org coverage active (Step 1)\n  - [OK] KmsKeyId configured — SSE-KMS encryption active (Step 2)\n  - [HIGH] LogFileValidationEnabled: false — no digest files, tampering\n    undetectable (Step 3)\nREMEDIATION:\n  1. Enable log file validation:\n     aws cloudtrail update-trail --name org-trail-no-validation --enable-log-file-validation\n  2. Verify digest files appear in S3:\n     aws s3 ls s3:\u002F\u002F\u003Cbucket>\u002FCloudTrail-Digest\u002F --recursive | head -20\n```\n\n## Pre-flight safety checks (run before any remediation CLI)\n\n> Pre-flight safety checks moved verbatim to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — load on demand.\n\n## Anti-Patterns — NEVER\n\n- NEVER assume an org trail is multi-region. `IsOrganizationTrail` and\n  `IsMultiRegionTrail` are independent flags. An org trail logging only one\n  region creates a blind spot for every other region — an attacker can\n  operate from `eu-west-1` against a trail in `us-east-1` and leave no trace.\n\n- NEVER treat SSE-S3 (Amazon-managed key) as satisfying a KMS-encryption\n  requirement. SSE-S3 IS encryption, but the key is managed by AWS — the\n  customer cannot audit key usage, set key policies, or rotate on their own\n  schedule. Compliance frameworks requiring customer-managed keys treat null\n  `KmsKeyId` as NO_ENCRYPTION regardless of S3 default encryption.\n\n- NEVER classify a trail as OK without verifying `IsLogging: true`. A trail\n  with perfect configuration but `IsLogging: false` is collecting nothing.\n  `describe-trails` returns the config; `get-trail-status` returns the status.\n\n- NEVER assume CloudTrail Insights works immediately after enablement. It\n  requires a minimum 7-day baseline of management events before it can detect\n  anomalies.\n\n- NEVER conflate CloudTrail log retention with CloudWatch Logs retention.\n  CloudTrail itself has no retention setting — logs persist in S3 until a\n  lifecycle policy removes them. CloudWatch Logs retention is a separate\n  property on the log group (`retentionInDays`).\n\n- NEVER overlook the S3 bucket policy for org trails. The bucket must grant\n  `cloudtrail.amazonaws.com` `s3:PutObject` with condition\n  `s3:x-amz-acl: bucket-owner-full-control`. Without the ACL condition,\n  member-account logs are owned by the member account and the management\n  account cannot read them.\n\n- NEVER assume `IncludeGlobalServiceEvents: true` is the default in all\n  tooling. Terraform and CloudFormation templates sometimes omit this field;\n  the default varies by SDK version. Explicitly verify it is `true`.\n\n- NEVER recommend `delete-trail` to remediate any configuration gap.\n  `delete-trail` is irreversible, drops the trail name and S3 prefix\n  continuity, breaks downstream EventBridge rules and CloudWatch alarms keyed\n  to the trail ARN, and creates a forensic gap until a replacement trail\n  begins delivery. Always use `update-trail` (in-place modification); it\n  preserves the ARN, S3 prefix, and all downstream integrations. If a\n  deletion is genuinely required (e.g., trail-name conflict), require a\n  second operator confirmation and capture a backup first.\n\n- NEVER ignore the KMS key policy when auditing CloudTrail KMS encryption.\n  A `KmsKeyId` set on the trail with a missing or restrictive key policy\n  causes silent log-delivery failure — the trail is \"encrypted\" but nothing\n  is being written.\n\n- NEVER classify NO_INSIGHTS if the insight-selector data was not provided.\n  Surface the gap as `[UNVERIFIED]` per Step 4 — do not guess.\n\n- NEVER rely on a default S3 lifecycle configuration (e.g., a bucket-wide\n  `ExpirationInDays` shipped by a CDK construct or Terraform module) as the\n  CloudTrail retention control. S3 lifecycle expires objects silently — no\n  notification, no digest-chain check, no object lock. A common compliance\n  failure: the default rule deletes raw log files after 30\u002F60\u002F90 days while\n  digests remain, so `validate-logs` reports a green chain pointing at\n  missing files and the audit trail silently shortens. Always inspect\n  `aws s3api get-bucket-lifecycle-configuration` and surface any\n  non-versioned expiry on the log or digest prefix as CONFIG_GAP. Prefer S3\n  Object Lock + Glacier Deep Archive for compliance retention over lifecycle\n  expiry.\n\n- NEVER assume a single-region trail is sufficient for an org, even if all\n  workloads are in one region. AWS global services (IAM, STS, Route 53) and\n  cross-region API calls (e.g., a Lambda in us-east-1 assuming a role in\n  eu-west-1) generate events in the source region.\n\n## Remediation guidance\n\n### For NO_ORG_TRAIL\n\n1. Verify the caller is in the management account:\n   `aws organizations describe-organization --profile \u003Cp>`\n2. Enable CloudTrail as a trusted service in Organizations:\n   `aws organizations enable-aws-service-access --service-principal cloudtrail.amazonaws.com`\n3. Create or update the trail to be an org trail:\n   `aws cloudtrail update-trail --name \u003Ctrail> --is-organization-trail`\n4. Verify the S3 bucket policy allows writes from all member accounts (see\n   NEVER list — bucket-owner-full-control condition).\n\n### For NO_ENCRYPTION\n\n1. Identify or create a KMS key in the trail's region:\n   `aws kms create-key --description \"CloudTrail SSE-KMS key\" --profile \u003Cp>`\n2. Attach a key policy granting CloudTrail service access:\n   ```json\n   {\"Statement\": [{\"Effect\": \"Allow\", \"Principal\":\n   {\"Service\": \"cloudtrail.amazonaws.com\"}, \"Action\":\n   [\"kms:GenerateDataKey*\", \"kms:Decrypt\"], \"Resource\": \"*\",\n   \"Condition\": {\"StringEquals\": {\"kms:CallerAccount\": \"\u003Caccount>\",\n   \"kms:EncryptionContext:aws:cloudtrail:arn\":\n   \"arn:aws:cloudtrail:\u003Cregion>:\u003Caccount>:trail\u002F\u003Cname>\"}}}]}\n   ```\n3. Update the trail:\n   `aws cloudtrail update-trail --name \u003Ctrail> --kms-key-id \u003Ckey-id>`\n4. Verify log delivery continues:\n   `aws cloudtrail get-trail-status --name \u003Ctrail>`\n\n### For NO_VALIDATION\n\n1. Enable log file validation:\n   `aws cloudtrail update-trail --name \u003Ctrail> --enable-log-file-validation`\n2. Verify digest files appear:\n   `aws s3 ls s3:\u002F\u002F\u003Cbucket>\u002F\u003Cprefix>\u002FCloudTrail-Digest\u002F --recursive | head -20`\n3. Schedule periodic validation:\n   `aws cloudtrail validate-logs --trail-name \u003Ctrail> --start-time \u003Cts> --end-time \u003Cts>`\n\n### For NO_INSIGHTS\n\n1. Enable Insights selectors:\n   `aws cloudtrail put-insight-selectors --trail-name \u003Ctrail>\n   --insight-selectors '[{\"InsightType\": \"ApiCallRateInsight\"},\n   {\"InsightType\": \"ApiErrorRateInsight\"}]'`\n2. Note: Insights requires 7 days of baseline data before producing findings.\n3. Monitor cost — Insights is billed per management event analyzed.\n\n### For CONFIG_GAP\n\n- **Single-region trail:** `aws cloudtrail update-trail --name \u003Ctrail>\n  --is-multi-region-trail`\n- **No CloudWatch Logs:** Create a log group and IAM role, then update:\n  `aws cloudtrail update-trail --name \u003Ctrail>\n  --cloudwatch-logs-log-group-arn \u003Carn> --cloudwatch-logs-role-arn \u003Carn>`\n- **Global service events disabled:** `aws cloudtrail update-trail --name\n  \u003Ctrail> --include-global-service-events`\n- **Short\u002Fmissing retention:** `aws logs put-retention-policy\n  --log-group-name \u003Cgroup> --retention-in-days 365`\n\n### For OK\n\n1. No remediation required.\n2. Recommend periodic `validate-logs` runs (weekly digest verification).\n3. Recommend testing org-trail member-account visibility quarterly.\n\n## Reference — CloudTrail internals (deep material)\n\n> CloudTrail internals deep material moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — load on demand.\n\n## Recent AWS features (2024-2026)\n\n> Recent AWS features moved verbatim to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — load on demand.\n\n## References (load on demand)\n\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — Step 0 expert knowledge (non-obvious CloudTrail behaviors), CloudTrail internals deep material, recent AWS features\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight safety checks — confirmation gate, rollback capture, Insights cost, org-trail enablement check\n- [references\u002Ferror-handling.md](references\u002Ferror-handling.md) — malformed trail-configuration ERROR output block\n\n## Domain\n\nAWS CloudOps \u002F CloudTrail Governance, Compliance & Forensic Readiness.\n\n## AWS documentation\n\n- **AWS CloudTrail User Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002Fuserguide\u002Fcloudtrail-user-guide.html\n- **CloudTrail Security** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002Fuserguide\u002Fsecurity.html\n- **CloudTrail API Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002FAPIReference\u002F\n- **CloudTrail CLI Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fcloudtrail\u002F\n- **CloudTrail Lake** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fawscloudtrail\u002Flatest\u002Fuserguide\u002Fcloudtrail-lake.html\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":40},{"tags":25,"phase":26,"author":27,"domain":28,"family":29,"version":30,"keywords":31,"complexity":32,"entry_point":33,"when_to_use":34,"requires_llm":35,"verdict_shape":36,"when_not_to_use":37,"invocation_schema":38,"supports_pipeline":35,"activation_triggers":39},"cloudtrail, governance, audit-logging, compliance, security, insights, kms-encryption","2","Jacky Chan — AWS Community Builder","aws-cloudops","Governance","0.1.0","CloudTrail, organization trail, multi-region trail, KMS encryption, log file validation, digest files, CloudWatch Logs, CloudTrail Insights, log retention, audit logging, compliance, forensic readiness, IsOrganizationTrail, IsMultiRegionTrail, LogFileValidationEnabled, trail auditor, API activity logging","medium","false","Pre-compliance review of an AWS Organizations CloudTrail trail's configuration: org-wide coverage, multi-region logging, KMS-encryption, log-file integrity validation, Insights enablement, and log retention posture.","true","NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS | CONFIG_GAP | OK","Single-account trail that is NOT part of an AWS Organization (different audit scope)., CloudTrail Lake event-data-store queries (different API surface: list-event-data-stores \u002F start-query)., Configuring data-event selectors for S3\u002FLambda\u002FDynamoDB resources (separate skill)., Macie, GuardDuty, or Security Hub finding triage (use the dedicated triage skills)., Cost-optimization of CloudTrail ingest volume (use a cost-audit skill).","{output: 'Deterministic per-trail block: TRAIL \u002F VERDICT \u002F REASON \u002F FINDINGS \u002F REMEDIATION.\n    VERDICT is one of NO_ORG_TRAIL | NO_ENCRYPTION | NO_VALIDATION | NO_INSIGHTS |\n    CONFIG_GAP | OK (first-fail-wins order).', properties: {cw_retention_days: {description: CloudWatch\n        Logs retentionInDays for the trail's log group., type: integer}, insight_selectors: {\n      description: get-insight-selectors output (optional)., type: array}, trail_config: {\n      description: describe-trails output (JSON or key-value summary) for one trail.,\n      type: object}, trail_name_or_arn: {description: Trail name\u002FARN for live-account\n        audit (alternative to trail_config)., type: string}, trail_status: {description: get-trail-status\n        output (optional but recommended)., type: object}}, required: [trail_config],\n  type: object}","audit this CloudTrail org trail, is my org trail configured correctly, check CloudTrail org trail log file validation, is the CloudTrail org trail encrypted with KMS, are CloudTrail Insights enabled on the org trail, CloudTrail multi-region check on the org trail, CloudTrail org trail coverage audit, verify CloudTrail forensic readiness for the org","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline trail-config classification. Live-account audits use aws cloudtrail describe-trails, get-trail-status, get-insight-selectors, and aws logs describe-log-groups (AWS CLI v2, SSO or key-based credentials).","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fcloudtrail-org-trail-auditor",0,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills","https:\u002F\u002Fgithub.com\u002Fjhkchan","CTO & Co-Founder @Beever-AI  & @votee. CAISP. AWS Community Builder. Organizer@GDGCloudHK. MongoDB Champion. Technopreneur + Infornographer.","2026-09-24 08:54:10",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add jhkchan\u002Faws-agent-skills --skill cloudtrail-org-trail-auditor",{"tool":55,"command":56},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill cloudtrail-org-trail-auditor",{"tool":58,"command":59},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill cloudtrail-org-trail-auditor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002FSKILL.md",true,[63,69,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"eval\u002Ftest-cases.yaml","REFERENCE","参考文档",9763,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Feval\u002Ftest-cases.yaml",{"path":70,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":71,"sourceHtmlUrl":72},"evals\u002Fbaselines\u002Fno-org-trail.md",518,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fbaselines\u002Fno-org-trail.md",{"path":74,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":75,"sourceHtmlUrl":76},"evals\u002Fbaselines\u002Forg-trail-config-gap.md",453,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fbaselines\u002Forg-trail-config-gap.md",{"path":78,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":79,"sourceHtmlUrl":80},"evals\u002Fbaselines\u002Forg-trail-no-encryption.md",438,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fbaselines\u002Forg-trail-no-encryption.md",{"path":82,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":83,"sourceHtmlUrl":84},"evals\u002Fbaselines\u002Forg-trail-no-insights.md",383,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fbaselines\u002Forg-trail-no-insights.md",{"path":86,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":87,"sourceHtmlUrl":88},"evals\u002Fbaselines\u002Forg-trail-no-validation.md",418,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fbaselines\u002Forg-trail-no-validation.md",{"path":90,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":91,"sourceHtmlUrl":92},"evals\u002Fbaselines\u002Forg-trail-ok.md",590,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fbaselines\u002Forg-trail-ok.md",{"path":94,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":95,"sourceHtmlUrl":96},"evals\u002Feval_config.yaml",1815,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Feval_config.yaml",{"path":98,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":99,"sourceHtmlUrl":100},"evals\u002Fevals.json",4575,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fevals.json",{"path":102,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":103,"sourceHtmlUrl":104},"evals\u002Fprompts\u002Fno-org-trail.md",930,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fprompts\u002Fno-org-trail.md",{"path":106,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":107,"sourceHtmlUrl":108},"evals\u002Fprompts\u002Forg-trail-config-gap.md",880,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fprompts\u002Forg-trail-config-gap.md",{"path":110,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":111,"sourceHtmlUrl":112},"evals\u002Fprompts\u002Forg-trail-no-encryption.md",934,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fprompts\u002Forg-trail-no-encryption.md",{"path":114,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":115,"sourceHtmlUrl":116},"evals\u002Fprompts\u002Forg-trail-no-insights.md",947,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fprompts\u002Forg-trail-no-insights.md",{"path":118,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":119,"sourceHtmlUrl":120},"evals\u002Fprompts\u002Forg-trail-no-validation.md",997,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fprompts\u002Forg-trail-no-validation.md",{"path":122,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":123,"sourceHtmlUrl":124},"evals\u002Fprompts\u002Forg-trail-ok.md",941,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fevals\u002Fprompts\u002Forg-trail-ok.md",{"path":126,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":127,"sourceHtmlUrl":128},"examples\u002Fend-to-end.md",5288,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fexamples\u002Fend-to-end.md",{"path":130,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":131,"sourceHtmlUrl":132},"references\u002Fadvanced-patterns.md",9741,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Freferences\u002Fadvanced-patterns.md",{"path":134,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":135,"sourceHtmlUrl":136},"references\u002Fdiagnostic-commands.md",1543,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Freferences\u002Fdiagnostic-commands.md",{"path":138,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":139,"sourceHtmlUrl":140},"references\u002Ferror-handling.md",470,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Freferences\u002Ferror-handling.md",{"path":142,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":143,"sourceHtmlUrl":144},"skill.usf.yaml",4101,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcloudtrail-org-trail-auditor\u002Fskill.usf.yaml",[146,153,160,167,174,181],{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":19},"01M7ADVD60X4PCAPKSE58P9NDC","xray-tracing-deployer","Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL \u002F method \u002F service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry \u002F ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS \u002F EKS \u002F Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxray-tracing-deployer\u002FSKILL.md",[],[],{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":19},"01M7ADTVJ7DCBM9CB1FY51GH7J","wellarchitected-workload-auditor","Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-workload-auditor\u002FSKILL.md",[],[],{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":19},"01M7ADT59G6FTTNZYHT2QRPNNP","wellarchitected-review-operator","Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer \u002F get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-review-operator\u002FSKILL.md",[],[],{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":19},"01M7ADSH5JA9QHNPPHQCD7EVA7","wafv2-web-acl-deployer","Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB\u002FAPI Gateway\u002FCloudFront, or configuring CAPTCHA\u002FChallenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-deployer\u002FSKILL.md",[],[],{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":180,"publishedAt":19},"01M7ADRYFAT8R73FBNCHRC573X","wafv2-web-acl-auditor","Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow\u002Fbypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-auditor\u002FSKILL.md",[],[],{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":19},"01M7ADR8W7G72JX4KFGN03QK8Q","waf-rule-deployer","Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaf-rule-deployer\u002FSKILL.md",[],[]]