# H-7. Security account

19 manual steps. The [rebuild guide](/wiki/rebuild/) explains the columns, the identities and the change-set commands.


| # | Action | Where | Identity | How | Why not code | Check |
| --- | --- | --- | --- | --- | --- | --- |
| H-7.1 | Security as delegated admin: GuardDuty and Security Hub (both Regions), Access Analyzer, CloudTrail. Config is delegated by Control Tower | master | MasterAdmin | `org-setup.sh delegate-security apply`. Registering GuardDuty and Security Hub also turns on a detector and hub in Security. H-7.6 imports the detector into a stack (DQ-94). The hubs stay, and the central policy in H-7.7 sets everything on them (DQ-90) | no CloudFormation resource for delegated admins | the step's read-back |
| H-7.2 | Access Analyzer service-linked role in master | master | MasterAdmin | `security.sh analyzer-slr` (DQ-41) | the analyzer create needs it first | the role exists |
| H-7.3 | Organization external-access analyzer | Security, both | CT-Exec | `security.sh analyzer-plan <region>`, then `analyzer-exec <region> <cs>`, then `analyzer-archive <region>` (DQ-42) | by hand per DQ-74 | S3-04 |
| H-7.4 | The alert address parameter the Security events topic subscribes | Security | CT-Exec | `security.sh alert-email-put` (from `HKB_ALERT_EMAIL`; DQ-80), before the pipeline's Security stage | no email in the repo | `security.sh alert-email-show` |
| H-7.5 | Confirm the SNS subscription email (`hkb-security-events`) | inbox | - | as H-6.4 | as H-6.4 | as H-6.4 |

H-7.6 to H-7.9 come after H-8, because `hkb-security-services` reads the root ID from the catalog copy that the pipeline delivers to Security. Run each Region before the next, us-east-1 first: the Security Hub resources are in us-east-1 only.

| # | Action | Where | Identity | How | Why not code | Check |
| --- | --- | --- | --- | --- | --- | --- |
| H-7.6 | Import the GuardDuty detector that H-7.1 made into `hkb-security-services` (once only; GuardDuty will not delete a delegated admin's detector, DQ-94) | Security, both | CT-Exec | `security.sh services-import <region>` (an IMPORT change set from `security/import/hkb-security-services-detector.yaml`), then `services-exec <region> <cs>`. In a rebuild, the same | the detector exists before any stack can create it | the stack is IMPORT_COMPLETE |
| H-7.7 | `hkb-security-services` update: the imported detector's plans set as the template names them, every plan but the EC2 agent and AI Protection (both Regions; DQ-87, amended by DQ-155 and DQ-160); Security Hub central configuration, us-west-2 linked, one policy on the root (us-east-1), with no standards until Config records (DQ-95; FSBP and CIS 5.0.0 at H-10.2) | Security, both | CT-Exec | `security.sh services-plan <region>`, then `services-exec <region> <cs>` (DQ-86, DQ-87, DQ-90) | by hand per DQ-75 | S3-03 |
| H-7.8 | Security Hub on in master with no default standards, so the root policy can enroll it (before H-7.7 in us-east-1; the root association fails without it) | master, both | MasterAdmin | `security.sh sh-master <region>` (DQ-96) | the management account must turn Security Hub on itself | S3-03 (master an Enabled member) |
| H-7.9 | GuardDuty enrollment: auto-enable ALL with the same plans as Security's detector; master added as a member with them (after H-6.7). Master's `hkb-master-guardduty` keeps its first list; S7-03 accepts that drift (DQ-160) | Security, both | MasterAdmin, then CT-Exec | `security.sh gd-enroll <region>`. Master's email is read from the organization (DQ-83, DQ-85, ADR-0042). It first turns on, in master, Organizations trusted access for `malware-protection.guardduty.amazonaws.com` and master's `AWSServiceRoleForAmazonGuardDutyMalwareProtection`: EC2 malware protection can't be auto-enabled from a delegated admin without them | no CloudFormation resource for the organization configuration | S3-02, after up to 24 hours |

H-7.10 to H-7.12 also come after H-8: the replication role carries `hkb-workload-boundary`, which the pipeline delivers to Log Archive. Steps are `log-archive.sh <step>`, in us-east-1.

| # | Action | Where | Identity | How | Why not code | Check |
| --- | --- | --- | --- | --- | --- | --- |
| H-7.10 | `hkb-log-archive-protection`: the Object Lock replica bucket (governance, 365 days), its key and `hkb-log-archive-replication` | Log Archive | CT-Exec | `protection-plan`, then `protection-exec <cs>` (D72, DQ-91, DQ-92) | by hand per DQ-75 | S3-08 (bucket settings) |
| H-7.11 | Update the Control Tower key so the replication role can decrypt through S3 (only on an environment built before 3.7; a rebuild has it from H-3.3) | master | MasterAdmin | `ms hkb-security-controltower-key` | DQ-24 | the change set shows one key-policy change |
| H-7.12 | The replication rule on the Control Tower trail bucket, to the replica. **Re-run after any landing zone update or reset**, which can redeploy Control Tower's bucket | Log Archive | CT-Exec | `replication-put` (refuses to replace a rule that is not HKB's), `replication-show` | Control Tower's SCP lets only AWSControlTowerExecution change its bucket, and its own StackSet owns the bucket | S3-08 |
| H-7.15 | `hkb-log-archive-site-logs`: the Prod site's CloudFront access-log bucket (v2 delivery from Prod, 30-day expiry), its key, the delivery destination Prod delivers to (cross-account delivery needs it here), reads for HKB-ReadOnly and the Prod traffic job. Before the site template switches the delivery on | Log Archive | CT-Exec | `site-logs-plan`, then `site-logs-exec <cs>` (DQ-132) | by hand per DQ-75, like H-7.10 | the bucket and key exist; after the Prod delivery, log objects arrive within the hour |
| H-7.16 | The Prod traffic job's two settings: `/hkb/site/traffic_key` (the data file's key, `ops/<slug>/data.js`, which names the unlisted page) and the SecureString `/hkb/site/traffic_ignore_ips` (Kyle's own addresses). Before or right after the first `hkb-baseline-site-traffic` deploy; the job stops with a clear message until they exist | Prod | CT-Exec | set `HKB_TRAFFIC_KEY` and `HKB_TRAFFIC_IGNORE_IPS` in hand.env, then `site-traffic.sh settings` (DQ-134) | the addresses never go in the repo (DQ-136) | `site-traffic.sh status` lists both |
| H-7.17 | Run the traffic job once instead of waiting for 01:30 UTC (the first time, and after a change to H-7.16) | Prod | CT-Exec | `site-traffic.sh run` | the schedule runs it daily | SUCCEEDED and the job's summary line; the traffic page shows "Live from the daily job" |
| H-7.18 | Run Prowler once instead of waiting for Monday 04:00 UTC (the first time, and after a change to `tools/prowler/` or the scanner roles) | Security | CT-Exec | `tools.sh prowler-run`, then `prowler-status` after about an hour (TL.3, DQ-130) | the schedule runs it weekly | SUCCEEDED and "all accounts scanned"; Prowler's failed findings in Security Hub in Security; reports under `prowler/<date>/` in `hkb-tools-findings-<account>`, with `summary.json` from DQ-138 on |
| H-7.19 | Delete `hkb-tool-noop`, the empty tool from TL.2, once `hkb-pipeline-tools` has deployed `hkb-tool-prowler` | Security | CT-Exec | `tools.sh noop-delete` (refuses unless the stack holds only its wait condition handle) | `hkb-pipeline-tools` makes change sets and cannot delete a stack | the stack is gone |
| H-7.20 | Run the detection test once instead of waiting for the first Wednesday (the first time, and after a change to it), on a weekday between 07:00 and 19:00 Denver time, when `hkb-nat` runs | Sandbox | CT-Exec | `tools.sh detection-run` (it refuses to start while `hkb-nat` is stopped), then `detection-status` after about five minutes (TL.8, DQ-142) | the schedule runs it monthly | SUCCEEDED; a GuardDuty alert email from Sandbox within about 15 minutes; `hkb-verify.sh` TL-02 PASS; no `hkb-detection-test` instance left running |
| H-7.21 | Drift detection on every `hkb-*` stack and StackSet (step 7.3, monthly from 2026-12-01 per DQ-150 B, and after any suspected change by hand), while no pipeline is deploying | master and every member | MasterAdmin, CT-Exec | `drift.sh run` | HKB-ReadOnly can read drift status but not start detection | `hkb-verify.sh` S7-03 PASS |

