latest run 54 pass 0 fail 0 skipevidence →
HKB Operations: pages
HKB OperationsKnowledge space

Starred pages

Pages

Page directory · Labels · [ hides this

ADR-0042 accepted

A hand-run script switches the threat detector on for every account

  • Status: Accepted
  • Date: 2026-10-22

Context

GuardDuty, AWS's threat detector, should be on for every account in both Regions, with exactly two optional protections switched on and the rest off. Those settings live on the central Security account.

Everything in HKB is meant to be code (ADR-0002), but CloudFormation has no way to set the organization-wide GuardDuty settings. Its per-account alternative needs each account's email address, may not work for accounts in an organization, and can't set the protections anyway.

Decision

  • Make a narrow exception to everything-as-code. A script, run by Kyle in each Region, turns GuardDuty on for every account automatically, with only the two chosen protections. It also enrolls the management account and sets the same protections there.
  • The detectors themselves stay in code.
  • A verifier check confirms the result on every run: everything is enrolled, and only the chosen protections are on.

Consequences

  • A rebuild runs the script once per Region, and the list of hand steps includes it.
  • Changing the protections means changing both the templates and the script, in one pull request.
  • Drift is caught by the verifier check, not by CloudFormation.

Alternatives considered

  • A small custom function inside a stack, making the same calls. Everything in a stack, but a function, its role and its permission cap to own, for a setting made once.
  • One per-account resource for each account and Region, with emails supplied by hand. The email handling and the unclear support outweigh the gain, and it still can't set the protections.
LLMs look here
  • Records DQ-85; scope from DQ-87 (S3 and Lambda protection only) and DQ-83 (master as a member).
  • Settings on the delegated administrator, hkb-security, via UpdateOrganizationConfiguration and CreateMembers. CloudFormation has no resource for the organization configuration; AWS::GuardDuty::Member needs each account's email, isn't documented for Organizations accounts and can't set plans.
  • Script: scripts/hand/security.sh gd-enroll <region>, hand step H-7.9. Auto-enable ALL, S3 and Lambda auto-enabled, every other plan NONE. Master added by create-members with its email read from the organization at run time; master's plans set to match.
  • Detectors: Security's in hkb-security-services, master's in hkb-master-guardduty (DQ-84).
  • S3-02 checks auto-enable ALL, only those two plans auto-enabled, every member and master enrolled, no other plan on. Hand-steps row per DQ-88.

Page information

Owner
Platform Engineering
Status
accepted From the decision record.
Generated from
docs/adr/0042-guardduty-enrollment-by-hand-run-script.md
Linked from
Decisions