mirror of
https://github.com/Sea-Haven-Industries/seahaven-org-baseline.git
synced 2026-10-02 15:33:23 +00:00
* Add account detective layer + budget (audit Day 1: H-2/H-3/H-4/M-5/M-10) Adds to the seahaven-account-baseline stack: - AWS Config recorder (all + global resources) + delivery channel + role + hardened delivery bucket (H-2, CIS 3.3/3.5). Recorder role IAM cross-reviewed. - GuardDuty detector, us-east-1 (H-3) - Security Hub with AWS FSBP v1.0.0 + CIS v3.0.0 standards, depends on Config (H-4) - IAM Access Analyzer, account scope (M-5) - Monthly cost budget $1,200 with 80/100% actual + 100% forecast alerts to adam@seahavenind.com (M-10) Scope us-east-1 only (all workloads here); multi-region is a follow-up. The CLI-applied governance toggles (M-6/M-3/M-7/L-8/M-11) are documented separately in the README runbook. * Document Day 1 detective layer + CLI governance toggles in README * Move Config recorder+channel to CLI (L1 stabilization deadlock) The L1 AWS::Config::ConfigurationRecorder hangs the stack: it never reaches CREATE_COMPLETE until recording is active (needs a delivery channel), and the delivery channel cannot be created until the recorder completes — a deadlock that hung the deploy ~27 min before manual cancel (2026-06-01). Keep the cross-reviewed recorder role + delivery bucket in IaC; create the recorder, delivery channel, and start recording via CLI (documented in README). Security Hub no longer takes a CFN dependency on the recorder; CIS/FSBP controls evaluate once Config is recording. Verified live: recording=true, SUCCESS.
192 lines
10 KiB
Markdown
192 lines
10 KiB
Markdown
# seahaven-account-baseline
|
|
|
|
Account-level security and governance baseline for Sea Haven Industries
|
|
(AWS account **328440206208**), managed as a single CDK TypeScript app. Most
|
|
resources are in **us-east-1**; the offsite backup vault is in **us-west-2**.
|
|
This is where account-wide detective and recovery controls live, so they are
|
|
versioned, reviewed, and drift-checked like any other stack.
|
|
|
|
Stacks (all deployed by `cdk deploy --all` / the CD workflow):
|
|
|
|
| Stack | Region | Purpose |
|
|
|---|---|---|
|
|
| `seahaven-account-baseline` | us-east-1 | CloudTrail + future detective controls (C-1) |
|
|
| `seahaven-backup` | us-east-1 | Primary AWS Backup vault + plan + role (C-7) |
|
|
| `seahaven-backup-offsite` | us-west-2 | Governance-locked offsite copy vault (C-7) |
|
|
|
|
## What it deploys
|
|
|
|
### CloudTrail (audit finding C-1)
|
|
|
|
| Resource | Logical ID | Notes |
|
|
|---|---|---|
|
|
| Multi-region trail | `Trail` (`seahaven-org-trail`) | Management events read+write, global service events, **log-file validation on** |
|
|
| Log bucket | `TrailLogBucket` (`seahaven-cloudtrail-logs-328440206208`) | Private (Block Public Access all), SSE-KMS, versioned, **TLS-only**, **Object Lock GOVERNANCE 365d**, lifecycle (Glacier @90d, expire @365d), server access logging → `seahaven-s3-access-logs` |
|
|
| KMS CMK | `TrailKey` (`alias/cloudtrail-logs`) | Encrypts log files; **automatic rotation enabled** |
|
|
| CloudWatch Logs group | created by the L2 `Trail` | 365-day retention; this is the group the CIS Section 4 metric filters (H-1) attach to |
|
|
|
|
**Data flow:** API activity across all regions → CloudTrail → (a) KMS-encrypted,
|
|
Object-Locked S3 bucket for durable/tamper-resistant storage and (b) CloudWatch
|
|
Logs for real-time querying and metric-filter alarms.
|
|
|
|
**Compliance impact:** closes CIS 3.1 (multi-region trail), 3.2 (log-file
|
|
validation), 3.4 (CloudWatch Logs integration), 3.6 (bucket access logging),
|
|
3.7 (KMS CMK encryption), and 3.8 (CMK rotation). Unblocks CIS Section 4 /
|
|
finding H-1 (metric filters + alarms now have a log group to target).
|
|
|
|
### Design decisions
|
|
|
|
- **Management events only.** Object-level S3/Lambda data events (CIS 3.10/3.11)
|
|
are deferred to control cost; revisit with targeted S3 *write* data events on
|
|
sensitive buckets (payments / accounting / kb) if needed.
|
|
- **Object Lock GOVERNANCE, not COMPLIANCE.** Tamper-resistant but still
|
|
deletable by a principal holding `s3:BypassGovernanceRetention` — avoids the
|
|
irreversibility of COMPLIANCE mode. Revisit if a stricter posture is required.
|
|
- **RETAIN** on the bucket and KMS key so a stack teardown never destroys the
|
|
audit trail.
|
|
|
|
### AWS Backup (audit finding C-7)
|
|
|
|
Phase 1 ("critical data first") of fixing the account's complete lack of AWS
|
|
Backup. Protects the data stores with no offsite leg today and copies each
|
|
recovery point cross-region into a governance-locked vault.
|
|
|
|
| Resource | Logical ID | Notes |
|
|
|---|---|---|
|
|
| Primary vault | `seahaven-primary` (us-east-1) | KMS-CMK encrypted, unlocked (working copy), RETAIN |
|
|
| Offsite vault | `seahaven-offsite` (us-west-2) | KMS-CMK encrypted, **Vault Lock GOVERNANCE** (min-retention 30d, no cooling-off window), RETAIN |
|
|
| Backup plan | `seahaven-critical-daily` | Daily 06:00 UTC, delete-after 35d, **cross-region CopyAction → offsite** (retain 90d) |
|
|
| Service role | `seahaven-backup-service-role` | **Backup-only** (Backup + S3-Backup managed policies); restore perms intentionally deferred |
|
|
|
|
**Phase-1 scope** (selected by explicit ARN, not tags, to avoid drifting other
|
|
stacks): RDS `database-1`, RDS `proposal-system-db`, DynamoDB `PaymentsDashboard`,
|
|
DynamoDB `purchase-orders`, S3 `accounting.seahaven.com`,
|
|
`seahaven-payments-csv-328440206208`, `google-workspace-seahavenind.com`.
|
|
|
|
**Coexists with** existing EBS DLM snapshots and DynamoDB PITR — it supplements
|
|
them with the missing offsite + immutable leg; it does not replace them.
|
|
|
|
**Design decisions:**
|
|
|
|
- **Governance lock first, not compliance.** Recovery points can't be silently
|
|
deleted, but a principal with explicit permission can still intervene while
|
|
we validate. Graduate to COMPLIANCE (irreversible) later by adding
|
|
`changeableFor` to the offsite vault lock + redeploy.
|
|
- **Backup-only role.** Restore policies and `allowRestores` are not granted;
|
|
restores get a separate audited path once a restore-test process exists.
|
|
|
|
**Pre-deploy gates** (must clear before the first scheduled run):
|
|
|
|
1. Enable S3 versioning on `seahaven-payments-csv-328440206208` and
|
|
`google-workspace-seahavenind.com` (`accounting.seahaven.com` already has it,
|
|
audit C-9), or their jobs fail silently (folds in H-21).
|
|
2. `database-1` is unencrypted (H-19): smoke-test an on-demand backup + copy of
|
|
it to us-west-2 first; if the copy fails, encrypt it or drop it from the copy.
|
|
3. Enable DynamoDB PITR (H-7) on the two tables for between-window recovery.
|
|
|
|
### Detective controls + budget (audit Day 1)
|
|
|
|
Account-level detective layer, in `lib/detective-controls.ts`, plus the cost
|
|
budget in `lib/governance-toggles.ts`. **Scope is us-east-1 only** (all workloads
|
|
live here); multi-region coverage is a follow-up.
|
|
|
|
| Resource | Logical ID | Finding | Notes |
|
|
|---|---|---|---|
|
|
| Config delivery bucket | `seahaven-config-328440206208` | H-2 | Private (BPA all), SSE-S3, versioned, TLS-only, 365d lifecycle |
|
|
| Config recorder role | `seahaven-config-recorder-role` | H-2 | `AWS_ConfigRole` + scoped S3 delivery; **IAM cross-reviewed** |
|
|
| GuardDuty detector | `DetectiveControls/GuardDutyDetector` | H-3 | Findings every 15 min |
|
|
| Security Hub | `DetectiveControls/SecurityHub` | H-4 | FSBP v1.0.0 + CIS v3.0.0; controls evaluate once Config is recording |
|
|
| Access Analyzer | `seahaven-account-analyzer` | M-5 | ACCOUNT external-access analyzer (free) |
|
|
| Monthly budget | `GovernanceToggles/MonthlyCostBudget` (`seahaven-monthly-cost`) | M-10 | $1,200/mo, 80%/100% actual + 100% forecast → adam@seahavenind.com |
|
|
|
|
**Config recorder + delivery channel are NOT in CloudFormation.** The L1
|
|
`AWS::Config::ConfigurationRecorder` is a stabilizing resource that hangs the
|
|
stack: it never reaches `CREATE_COMPLETE` until recording is active, which needs
|
|
a delivery channel, which can't be created until the recorder completes — a
|
|
deadlock (hit on 2026-06-01). The role + delivery bucket stay in IaC (the role
|
|
is cross-reviewed); the recorder/channel are created via CLI (below), referencing
|
|
the stack's `ConfigRecorderRoleArn` output and the `seahaven-config-328440206208`
|
|
bucket.
|
|
|
|
### CLI-applied governance toggles (no CloudFormation resource)
|
|
|
|
These account toggles have no native CloudFormation resource, so they are applied
|
|
via CLI and recorded here. Applied 2026-06-01.
|
|
|
|
```bash
|
|
# M-3 EBS encryption-by-default (new volumes; existing 5 plaintext volumes are H-19-adjacent)
|
|
aws ec2 enable-ebs-encryption-by-default --region us-east-1
|
|
|
|
# M-6 Inspector2 (EC2 + Lambda + ECR)
|
|
aws inspector2 enable --resource-types EC2 LAMBDA ECR --region us-east-1
|
|
|
|
# M-7 IAM password policy (CIS 1.8/1.9): >=14 chars, full complexity, no reuse of last 24
|
|
aws iam update-account-password-policy \
|
|
--minimum-password-length 14 \
|
|
--require-symbols --require-numbers \
|
|
--require-uppercase-characters --require-lowercase-characters \
|
|
--allow-users-to-change-password --password-reuse-prevention 24
|
|
|
|
# M-11 Activate cost-allocation tags (only activates keys already seen on resources)
|
|
aws ce update-cost-allocation-tags-status --cost-allocation-tags-status \
|
|
'TagKey=Project,Status=Active' 'TagKey=Owner,Status=Active' 'TagKey=Environment,Status=Active'
|
|
```
|
|
|
|
**L-8 (billing-metrics preference) is OUTSTANDING — console only.** Enabling the
|
|
CloudWatch `EstimatedCharges` metric in us-east-1 requires turning on *Receive
|
|
Billing Alerts* under Billing → Billing preferences; there is no public API/CLI.
|
|
The M-10 budget already provides cost alerting independent of that metric, so
|
|
this only affects the legacy `AWS-MonthlyBilling` CloudWatch alarm (L-8).
|
|
|
|
## Roadmap (same stack)
|
|
|
|
Detective layer multi-region expansion (GuardDuty/Config/Security Hub beyond
|
|
us-east-1). H-1: CIS Section 4 metric filters/alarms onto the CloudTrail log
|
|
group. Backup phase 2: expand past the phase-1 set via tag-based selection and
|
|
graduate the offsite vault to compliance mode.
|
|
|
|
## Deploy
|
|
|
|
CI/CD via the org reusable workflows (`ci-typescript-cdk.yaml`,
|
|
`cd-cdk.yaml`); pushes to `main` deploy through the OIDC role in
|
|
`secrets.AWS_DEPLOY_ROLE_ARN`. Local: `npm ci && npm run build && npx cdk diff`.
|
|
|
|
```
|
|
npx cdk deploy seahaven-account-baseline
|
|
```
|
|
|
|
## Verify
|
|
|
|
```
|
|
aws cloudtrail get-trail-status --name seahaven-org-trail # IsLogging: true
|
|
aws cloudtrail describe-trails --trail-name-list seahaven-org-trail
|
|
aws cloudtrail validate-logs --trail-arn <arn> --start-time <t> # digest integrity
|
|
```
|
|
|
|
AWS Backup (C-7):
|
|
|
|
```
|
|
aws backup list-backup-vaults # seahaven-primary
|
|
aws backup list-backup-vaults --region us-west-2 # seahaven-offsite
|
|
aws backup describe-backup-vault --backup-vault-name seahaven-offsite --region us-west-2 # Locked, MinRetentionDays
|
|
aws backup get-backup-plan --backup-plan-id <id> # daily rule + CopyAction
|
|
# Smoke test: on-demand backup of one resource, then confirm the cross-region copy lands
|
|
aws backup start-backup-job --backup-vault-name seahaven-primary \
|
|
--resource-arn arn:aws:rds:us-east-1:328440206208:db:database-1 \
|
|
--iam-role-arn arn:aws:iam::328440206208:role/seahaven-backup-service-role
|
|
aws backup list-copy-jobs --region us-west-2 # copy to offsite present + COMPLETED
|
|
```
|
|
|
|
Detective layer + governance (Day 1):
|
|
|
|
```
|
|
aws configservice describe-configuration-recorder-status # recording: true
|
|
aws guardduty list-detectors # one detector id
|
|
aws securityhub get-enabled-standards # FSBP + CIS v3.0.0
|
|
aws accessanalyzer list-analyzers # seahaven-account-analyzer ACTIVE
|
|
aws inspector2 batch-get-account-status --region us-east-1 # ec2/ecr/lambda ENABLED
|
|
aws iam get-account-password-policy # length 14, reuse 24
|
|
aws ec2 get-ebs-encryption-by-default --region us-east-1 # EbsEncryptionByDefault: true
|
|
aws budgets describe-budgets --account-id 328440206208 # seahaven-monthly-cost $1,200
|
|
aws ce list-cost-allocation-tags --status Active # Project/Owner/Environment Active
|
|
```
|